* Reworked Makefiles
authorSteven Barth <steven@midlink.org>
Wed, 28 May 2008 19:37:43 +0000 (19:37 +0000)
committerSteven Barth <steven@midlink.org>
Wed, 28 May 2008 19:37:43 +0000 (19:37 +0000)
* Introduced following targets:
build: gccbuild luabuild
gccbuild: compile
luabuild: luasource||luacompile
* Removed requirement for lua-headers respecting lua-only builds
* Split compile part of OpenWRT Makefile

Makefile
build/config.mk
build/gccconfig.mk [new file with mode: 0644]
build/module.mk
contrib/package/luci/Makefile
libs/sgi-webuci/Makefile

index d76be9a2de8b0b8b5838a7a4d4a738fca348bed0..c78f5a8108ae8c9fc36ef26917761a5f79133502 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,27 +1,42 @@
 include build/config.mk
 
 MODULES = applications/* libs/* modules/* themes/* i18n/*
 include build/config.mk
 
 MODULES = applications/* libs/* modules/* themes/* i18n/*
-LUA_TARGET = compile
+LUA_TARGET = source
+
+### luaposix merge (temporary) ###
 OS:=$(shell uname)
 export OS
 ifeq ($(OS),Darwin)
   MODULES += contrib/luaposix
 endif
 
 OS:=$(shell uname)
 export OS
 ifeq ($(OS),Darwin)
   MODULES += contrib/luaposix
 endif
 
-.PHONY: all build clean host hostclean
+
+.PHONY: all build gccbuild luabuild clean host gcchost luahost hostcopy hostclean
 
 all: build
 
 
 all: build
 
-build:
-       for i in $(MODULES); do make -C$$i $(LUA_TARGET); done
+build: luabuild gccbuild
+
+gccbuild:
+       for i in $(MODULES); do make -C$$i compile; done        
+
+luabuild:
+       for i in $(MODULES); do make -C$$i lua$(LUA_TARGET); done
 
 clean:
        for i in $(MODULES); do make -C$$i clean; done
 
 
 clean:
        for i in $(MODULES); do make -C$$i clean; done
 
-host: build
+
+host: build hostcopy
+
+gcchost: gccbuild hostcopy
+
+luahost: luabuild hostcopy
+
+hostcopy: 
        mkdir -p host
        for i in $(MODULES); do cp $$i/dist/* host/ -R 2>/dev/null || true; done
        ln -sf .$(LUCI_INSTALLDIR) host/luci
        
 hostclean: clean
        mkdir -p host
        for i in $(MODULES); do cp $$i/dist/* host/ -R 2>/dev/null || true; done
        ln -sf .$(LUCI_INSTALLDIR) host/luci
        
 hostclean: clean
-       rm host -rf
+       rm -rf host
index 9db99cd6ba1f47ab6fa18677b0e72de4a28373fe..1755974f2e54542a57222d6e80c447f6a176d954 100644 (file)
@@ -1,28 +1,4 @@
-OS ?= $(shell uname)
-
 LUAC = luac
 LUAC_OPTIONS = -s
 LUCI_INSTALLDIR = /usr/lib/lua/luci
 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 (file)
index 0000000..0e4de27
--- /dev/null
@@ -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)
+
index 923caad70c4ac86a7d10712b468d85c45fd989cd..2288608386167aaf03c0e699cb4cf6595b20cf58 100644 (file)
@@ -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  
        
        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
 
        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
 
        rm -rf dist
 
index f2a26245db9c6ea883138528ef3a587fe48a4404..997b9f901fd5084e50491a1c9ceaa50d947779cf 100644 (file)
@@ -25,11 +25,12 @@ include $(INCLUDE_DIR)/package.mk
 define Build/Configure
 endef
 
 define Build/Configure
 endef
 
-define Build/Compile
-       $(MAKE) -C$(PKG_BUILD_DIR) build LUA_TARGET=$(LUA_TARGET)
+define Package/luci/compiletpl
+       ifneq ($(CONFIG_PACKAGE_$(1)),)
+               $(MAKE) -C$(PKG_BUILD_DIR)/$(2) build LUA_TARGET=$(LUA_TARGET)
+       endif
 endef
 
 endef
 
-
 ### Templates ###
 
 define Package/luci/libtemplate
 ### Templates ###
 
 define Package/luci/libtemplate
@@ -115,6 +116,8 @@ define Package/luci-ff-halle
 endef
 
 define Package/luci-ff-halle/install
 endef
 
 define Package/luci-ff-halle/install
+       $(call Package/luci/install/template,$(1),applications/community-halle)
+       $(CP) -a ./ipkg/luci-ff-halle.postinst $(1)/CONTROL/postinst
 endef
 
 
 endef
 
 
@@ -270,6 +273,26 @@ define Package/luci-sgi-webuci/install
 endef
 
 
 endef
 
 
+define Build/Compile 
+       $(call Package/luci/compiletpl,luci-core,libs/core)
+       $(call Package/luci/compiletpl,luci-cbi,libs/cbi)
+       $(call Package/luci/compiletpl,luci-web,libs/web)
+
+       $(call Package/luci/compiletpl,luci-ff-halle,applications/community-halle)
+       $(call Package/luci/compiletpl,luci-ff-leipzig,applications/community-leipzig)
+       $(call Package/luci/compiletpl,luci-ff-hannover,applications/community-hannover)
+
+       $(call Package/luci/compiletpl,luci-mod-admin-core,modules/admin-core)
+       $(call Package/luci/compiletpl,luci-mod-freifunk,modules/freifunk)
+
+       $(call Package/luci/compiletpl,luci-app-ffwizard-leipzig,applications/luci-ffwizard-leipzig)
+       $(call Package/luci/compiletpl,luci-app-firewall,applications/luci-fw)
+       $(call Package/luci/compiletpl,luci-app-splash,applications/luci-splash)
+       $(call Package/luci/compiletpl,luci-app-statistics,applications/luci-statistics)
+
+       $(call Package/luci/compiletpl,luci-sgi-haserl,libs/sgi-haserl)
+       $(call Package/luci/compiletpl,luci-sgi-webuci,libs/sgi-webuci)
+endef
 
 
 $(eval $(call BuildPackage,luci-core))
 
 
 $(eval $(call BuildPackage,luci-core))
index 9efe0fe14e6d5c1af1d3cea2bece750021dbdc41..5be84dcb39b795a1a78ed4963262c19fad742ea9 100644 (file)
@@ -1,4 +1,5 @@
 include ../../build/config.mk
 include ../../build/config.mk
+include ../../build/gccconfig.mk
 include ../../build/module.mk
 
 BOA_VERSION = 0.94.13
 include ../../build/module.mk
 
 BOA_VERSION = 0.94.13