define PREPROCESS_LUA # Wrap the LUA source code into a string, using the thorn name and # file name to create a variable name, and create a C file # for i in `perl -n -e 'if (\$_=~/function +([^ (]*)/) { print "\$1 "; }' $^`; do \ # echo 'char const *const Lua_function_$(THORN)_\$i = Lua_source_$(THORN)_$*; \ # done \ # { \ echo 'char const *const Lua_source_$(THORN)_$* ='; \ sed -e 's/\\/\\\\/g;s/"/\\"/g;s/\(.*\)/"\1\\n"/g'; \ echo ';'; \ for i in `sed -e 's:FILENAME:$^:' /home/knarf/Cactus/arrangements/ExternalLibraries/lua/src/findluafuns.lua | /home/knarf/Cactus/configs/lua/scratch/external/lua/bin/lua -`; do \ echo "const char *Lua_function_$(THORN)_$$i = Lua_source_$(THORN)_$*;"; \ done \ } < $^ > $(notdir $<).cpp endef define COMPILE_LUA # Basically a C compile, but with a different source file name current_wd=`$(GET_WD)` ; cd $(SCRATCH_BUILD) ; $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CCOMPILEONLY)$(OPTIONSEP)$$current_wd$(DIRSEP)$@ $$current_wd$(DIRSEP)$(notdir $<).cpp $(INCLUDE_LINE) $(EXTRA_DEFINES:%=-D%) -DCCODE endef %.lua.o: $(SRCDIR)/%.lua $(NOTIFY_PREPROCESSING) $(PREPROCESS_LUA) $(NOTIFY_COMPILING) $(COMPILE_LUA)