diff options
Diffstat (limited to 'build')
-rw-r--r-- | build/config.mk | 24 | ||||
-rw-r--r-- | build/gccconfig.mk | 22 | ||||
-rw-r--r-- | build/module.mk | 23 |
3 files changed, 36 insertions, 33 deletions
diff --git a/build/config.mk b/build/config.mk index 9db99cd6b..1755974f2 100644 --- a/build/config.mk +++ b/build/config.mk @@ -1,28 +1,4 @@ -OS ?= $(shell uname) - LUAC = luac LUAC_OPTIONS = -s LUCI_INSTALLDIR = /usr/lib/lua/luci -LUA_SHLIBS = $(shell pkg-config --silence-errors --libs lua5.1) -LUA_LIBS = $(if $(LUA_SHLIBS),$(LUA_SHLIBS),$(firstword $(wildcard /usr/lib/liblua.a /usr/local/lib/liblua.a /opt/local/lib/liblua.a))) -LUA_CFLAGS = $(shell pkg-config --silence-errors --cflags lua5.1) -ifeq ($(LUA_LIBS),) - $(error LUA installation not found) -endif - -CC = gcc -AR = ar -RANLIB = ranlib -CFLAGS = -O2 -FPIC = -fPIC -EXTRA_CFLAGS = --std=gnu99 -WFLAGS = -Wall -Werror -pedantic -CPPFLAGS = -COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $(WFLAGS) -ifeq ($(OS),Darwin) - SHLIB_FLAGS = -bundle -undefined dynamic_lookup -else - SHLIB_FLAGS = -shared -endif -LINK = $(CC) diff --git a/build/gccconfig.mk b/build/gccconfig.mk new file mode 100644 index 000000000..0e4de2795 --- /dev/null +++ b/build/gccconfig.mk @@ -0,0 +1,22 @@ +OS ?= $(shell uname) + +LUA_SHLIBS = $(shell pkg-config --silence-errors --libs lua5.1) +LUA_LIBS = $(if $(LUA_SHLIBS),$(LUA_SHLIBS),$(firstword $(wildcard /usr/lib/liblua.a /usr/local/lib/liblua.a /opt/local/lib/liblua.a))) +LUA_CFLAGS = $(shell pkg-config --silence-errors --cflags lua5.1) + +CC = gcc +AR = ar +RANLIB = ranlib +CFLAGS = -O2 +FPIC = -fPIC +EXTRA_CFLAGS = --std=gnu99 +WFLAGS = -Wall -Werror -pedantic +CPPFLAGS = +COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $(WFLAGS) +ifeq ($(OS),Darwin) + SHLIB_FLAGS = -bundle -undefined dynamic_lookup +else + SHLIB_FLAGS = -shared +endif +LINK = $(CC) + diff --git a/build/module.mk b/build/module.mk index 923caad70..228860838 100644 --- a/build/module.mk +++ b/build/module.mk @@ -1,20 +1,25 @@ -.PHONY: all compile compile-module source source-module clean clean-module +.PHONY: all build compile luacompile luasource clean luaclean -all: compile -compile: source-module -compile-all: compile-module -clean: clean-module -source: source-module +all: build -source-module: +build: luabuild gccbuild + +luabuild: lua$(LUA_TARGET) + +gccbuild: compile +compile: + +clean: luaclean + +luasource: mkdir -p dist$(LUCI_INSTALLDIR) cp root/* dist -R 2>/dev/null || true cp luasrc/* dist$(LUCI_INSTALLDIR) -R 2>/dev/null || true for i in $$(find dist -name .svn); do rm $$i -rf; done -compile-module: source-module +luacompile: luasource for i in $$(find dist -name *.lua -not -name debug.lua); do $(LUAC) $(LUAC_OPTIONS) -o $$i $$i; done -clean-module: +luaclean: rm -rf dist |