summaryrefslogtreecommitdiffhomepage
path: root/build/module.mk
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-15 15:50:43 +0000
committerSteven Barth <steven@midlink.org>2008-08-15 15:50:43 +0000
commit5941f334ff118be916468101c7994a92e86cf0c2 (patch)
tree0c5224e86f865121661d1b6f13ec06c914890b98 /build/module.mk
parent95e4976968621071b16db0ee626474f36bf91d1f (diff)
Added XML -> Lua translation transform target to Makefiles
Diffstat (limited to 'build/module.mk')
-rw-r--r--build/module.mk13
1 files changed, 11 insertions, 2 deletions
diff --git a/build/module.mk b/build/module.mk
index 20fdb4376..3a947546b 100644
--- a/build/module.mk
+++ b/build/module.mk
@@ -1,16 +1,24 @@
+MAKEPATH:=$(dir $(lastword $(MAKEFILE_LIST)))
+-include $(MAKEPATH)config.mk
+-include $(MAKEPATH)gccconfig.mk
+
.PHONY: all build compile luacompile luasource clean luaclean
all: build
build: luabuild gccbuild
-luabuild: lua$(LUA_TARGET)
+luabuild: lua$(LUA_TARGET) i18n
gccbuild: compile
compile:
clean: luaclean
+i18n: luasource
+ [ -n "$(XSLTPROC)" ] && for i in dist$(LUCI_MODULEDIR)/i18n/*.xml; do [ -f "$$i" ]\
+ && { $(XSLTPROC) $(MAKEPATH)i18n-lua-xhtml1.xsl $$i > $${i/.xml/.lua}; rm $$i; }; done || true
+
luasource:
mkdir -p dist$(LUA_MODULEDIR)
mkdir -p dist$(LUCI_MODULEDIR)
@@ -19,7 +27,8 @@ luasource:
cp -a luasrc/* dist$(LUCI_MODULEDIR) -R 2>/dev/null || true
cp -a lua/* dist$(LUA_MODULEDIR) -R 2>/dev/null || true
cp -a htdocs/* dist$(HTDOCS) -R 2>/dev/null || true
- for i in $$(find dist -name .svn); do rm $$i -rf; done
+ for i in $$(find dist -name .svn); do rm $$i -rf || true; done
+
luastrip: luasource
for i in $$(find dist -type f -name '*.lua'); do perl -e 'undef $$/; open( F, "< $$ARGV[0]" ) || die $$!; $$src = <F>; close F; $$src =~ s/--\[\[.*?\]\](--)?//gs; $$src =~ s/^\s*--.*?\n//gm; open( F, "> $$ARGV[0]" ) || die $$!; print F $$src; close F' $$i; done