support use of git submodules with the Makefiles
git=1 when invoking make will use the submodule submodules/lua. On windows, it will also use the submodule submodules/pdcurses.
This commit is contained in:
@@ -104,7 +104,13 @@ DATNODLB = $(VARDATND) license symbols
|
||||
DATDLB = $(DATHELP) dungeon.lua tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD)
|
||||
DAT = $(DATNODLB) $(DATDLB)
|
||||
|
||||
LUAHEADERS = lib/lua-$(LUA_VERSION)/src
|
||||
LUATESTTARGET = $(LUAHEADERS)/lua.h
|
||||
LUATOP = $(LUAHEADERS)
|
||||
LUAMAKEFLAGS = CC='$(CC)' SYSCFLAGS='$(SYSCFLAGS)'
|
||||
LUA2NHTOP = ../../..
|
||||
TOPLUALIB = lib/lua/liblua.a
|
||||
|
||||
ALLDEP = $(GAME) recover Guidebook $(VARDAT) spec_levs check-dlb
|
||||
|
||||
# first target is also the default target for 'make' without any arguments
|
||||
@@ -117,23 +123,28 @@ $(GAME): lua_support
|
||||
|
||||
lua_support: $(TOPLUALIB) include/nhlua.h
|
||||
@true
|
||||
lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VERSION)/src/lua.h
|
||||
( cd lib/lua-$(LUA_VERSION)/src \
|
||||
&& make CC='$(CC)' SYSCFLAGS='$(SYSCFLAGS)' a && cd ../../.. )
|
||||
lib/lua/liblua.a: lib/lua-$(LUA_VERSION)/src/liblua.a
|
||||
$(LUATOP)/liblua.a: $(LUAHEADERS)/lua.h
|
||||
( cd $(LUATOP) \
|
||||
&& make $(LUAMAKEFLAGS) a && cd $(LUA2NHTOP) )
|
||||
lib/lua/liblua.a: $(LUATOP)/liblua.a
|
||||
@( if test -d lib/lua ; then true ; else mkdir -p lib/lua ; fi )
|
||||
cp lib/lua-$(LUA_VERSION)/src/liblua.a $@
|
||||
cp $(LUATOP)/liblua.a $@
|
||||
include/nhlua.h: $(TOPLUALIB)
|
||||
echo '/* nhlua.h - generated by top Makefile */' > $@
|
||||
@echo '#include "../lib/lua-$(LUA_VERSION)/src/lua.h"' >> $@
|
||||
@echo '#include "../$(LUAHEADERS)/lua.h"' >> $@
|
||||
@sed -e '/(lua_error)/!d' -e '/(lua_error)/s/;/ NORETURN;/1' \
|
||||
< lib/lua-$(LUA_VERSION)/src/lua.h >> $@
|
||||
@echo '#include "../lib/lua-$(LUA_VERSION)/src/lualib.h"' >> $@
|
||||
@echo '#include "../lib/lua-$(LUA_VERSION)/src/lauxlib.h"' >> $@
|
||||
< $(LUAHEADERS)/lua.h >> $@
|
||||
@echo '#include "../$(LUAHEADERS)/lualib.h"' >> $@
|
||||
@echo '#include "../$(LUAHEADERS)/lauxlib.h"' >> $@
|
||||
@echo '/*nhlua.h*/' >> $@
|
||||
# LUATESTTARGET is this by default
|
||||
lib/lua-$(LUA_VERSION)/src/lua.h:
|
||||
@echo "Please do 'make fetch-lua' to obtain lua-$(LUA_VERSION)"
|
||||
@false
|
||||
# hints file could set LUATESTTARGET to this if GITSUBMODULES is defined
|
||||
submodules/lua/lua.h:
|
||||
git submodule init submodules/lua
|
||||
git submodule update --remote submodules/lua
|
||||
|
||||
# Note: many of the dependencies below are here to allow parallel make
|
||||
# to generate valid output
|
||||
@@ -339,7 +350,7 @@ clean: clean-lib clean-keep-lib
|
||||
@true
|
||||
|
||||
clean-lib:
|
||||
-( cd lib/lua-$(LUA_VERSION)/src && $(MAKE) clean )
|
||||
-( cd $(LUATOP) && $(MAKE) clean )
|
||||
|
||||
clean-keep-lib:
|
||||
( cd src ; $(MAKE) clean )
|
||||
|
||||
Reference in New Issue
Block a user