Compatibility with tolua++ 1.0.93
authorTim Niemueller <niemueller@kbsg.rwth-aachen.de>
Thu, 25 Feb 2010 14:30:51 +0000 (15:30 +0100)
committerTim Niemueller <niemueller@kbsg.rwth-aachen.de>
Fri, 26 Feb 2010 00:22:51 +0000 (01:22 +0100)
There is a bug in tolua++ 1.0.93 which makes the generator fail when passing
the package file on stdin. We now generate a temporary file that is then
fed to the generator. That is a trivial change.
Basic tests suggest that Fawkes seems to work just fine with both versions.

The CLEAN_FILES make variable can now be set to file (patterns) which should
be removed  on "make clean" in addition to the files which are cleaned anyway.
This is used to remove files generated by tolua++.

.gitignore
etc/buildsys/lua.mk
etc/buildsys/rules.mk

index 0af0160..9759b8f 100644 (file)
@@ -3,6 +3,7 @@
 .deps_*
 .objs_*
 *_tolua.cpp
+*_tolua.pkg
 
 # Specific paths, _ variants for cross compilation environments
 /bin/
index 75e56c8..7c7cc01 100644 (file)
@@ -43,13 +43,14 @@ ifeq ($(HAVE_LUA),1)
     TOLUAPP=/usr/local/bin/lua$(subst .,,$(LUA_VERSION))/tolua++
     TOLUA_LIBS=tolua++
   endif
+  CLEAN_FILES=*_tolua.{pkg,cpp}
 
   ifeq ($(HAVE_TOLUA),1)
 .SECONDEXPANSION:
 %_tolua.cpp: $$(TOLUA_$$(subst /,_,$$*))
        $(SILENT) echo "$(INDENT_PRINT)--- Generating Lua package C++ file $(@F)"
-       $(SILENT)cat $(addprefix $(SRCDIR)/,$(subst $(SRCDIR)/,,$(filter %.tolua,$^))) | \
-       $(TOLUAPP) -n $(TOLUA_PKGPREFIX_$(subst /,_,$*))$(notdir $*) | \
+       $(SILENT)cat $(addprefix $(SRCDIR)/,$(subst $(SRCDIR)/,,$(filter %.tolua,$^))) > $(patsubst %.cpp,%.pkg,$@)
+       $(SILENT)$(TOLUAPP) -n $(TOLUA_PKGPREFIX_$(subst /,_,$*))$(notdir $*) $(patsubst %.cpp,%.pkg,$@) | \
        sed -e 's/^\(.*Generated automatically .*\) on .*$$/\1/' | \
        awk '/^#if defined/ { f=1 }; f { t = t "\n" $$0 }; !f {print}; f && /^#endif/ {print "extern \"C\" {" t "\n}\n"; f=0}' | \
        awk '/^\*\/$$/ { print; while ((getline line < "$(BASEDIR)/doc/headers/lichead_c.GPL_WRE") > 0) print line }; ! /^\*\/$$/ { print }' \
index e374ae6..f944149 100644 (file)
@@ -104,6 +104,7 @@ clean: presubdirs subdirs
        $(SILENT)$(foreach L,$(LIBS_gui),rm -f $(L);)
        $(SILENT)$(foreach P,$(PLUGINS_gui),rm -f $(P);)
        $(SILENT)$(foreach T,$(TARGETS_gui),rm -rf $(T);)
+       $(SILENT)$(foreach E,$(CLEAN_FILES),rm -rf $(E);)
 
 ifeq (,$(findstring qa,$(SUBDIRS)))
 .PHONY: qa