* Reworked Makefiles
* 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
This commit is contained in:
parent
38844ccb31
commit
4e53d007bf
6 changed files with 84 additions and 42 deletions
27
Makefile
27
Makefile
|
@ -1,27 +1,42 @@
|
|||
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
|
||||
|
||||
.PHONY: all build clean host hostclean
|
||||
|
||||
.PHONY: all build gccbuild luabuild clean host gcchost luahost hostcopy hostclean
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
rm host -rf
|
||||
rm -rf host
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
22
build/gccconfig.mk
Normal file
22
build/gccconfig.mk
Normal file
|
@ -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)
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
@ -25,11 +25,12 @@ include $(INCLUDE_DIR)/package.mk
|
|||
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
|
||||
|
||||
|
||||
### Templates ###
|
||||
|
||||
define Package/luci/libtemplate
|
||||
|
@ -115,6 +116,8 @@ define Package/luci-ff-halle
|
|||
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
|
||||
|
||||
|
||||
|
@ -270,6 +273,26 @@ define Package/luci-sgi-webuci/install
|
|||
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))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
include ../../build/config.mk
|
||||
include ../../build/gccconfig.mk
|
||||
include ../../build/module.mk
|
||||
|
||||
BOA_VERSION = 0.94.13
|
||||
|
|
Loading…
Reference in a new issue