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 )
|
||||
|
||||
@@ -68,6 +68,17 @@ GAMEGRP = games
|
||||
# you're reading this in Makefile augmented by hints, that may not be true).
|
||||
#
|
||||
|
||||
ifeq "$(GIT)" "1"
|
||||
ifndef GITSUBMODULES
|
||||
GITSUBMODULES=1
|
||||
endif
|
||||
endif
|
||||
ifeq "$(git)" "1"
|
||||
ifndef GITSUBMODULES
|
||||
GITSUBMODULES=1
|
||||
endif
|
||||
endif
|
||||
|
||||
#-INCLUDE multiw-2.370
|
||||
|
||||
# compiler.370 contains compiler detection and adjustments common
|
||||
@@ -237,10 +248,21 @@ POSTINSTALL+= sed -i -e 's;^GDBPATH=/usr/bin/gdb;\#GDBPATH=/usr/bin/gdb;' \
|
||||
-e 's;PANICTRACE_GDB=1;PANICTRACE_GDB=0;' $(INSTDIR)/sysconf;
|
||||
endif
|
||||
|
||||
# Lua
|
||||
# when building liblua.a, avoid warning that use of tmpnam() should be
|
||||
# replaced by mkstemp(); the lua code doesn't use nethack's config.h so
|
||||
# this needs to be passed via make rather than defined in unixconf.h
|
||||
SYSCFLAGS=-DLUA_USE_POSIX
|
||||
SYSCFLAGS=-DLUA_USE_LINUX
|
||||
ifdef GITSUBMODULES
|
||||
LUAFLAGS=CC='$(CC)' SYSCFLAGS='$(SYSCFLAGS)'
|
||||
ifneq "$(CCISCLANG)" ""
|
||||
# clang
|
||||
LUAFLAGS +=CWARNGCC=''
|
||||
endif # clang
|
||||
override LUAHEADERS = submodules/lua
|
||||
override LUA2NHTOP = ../..
|
||||
override LUAMAKEFLAGS=$(LUAFLAGS)
|
||||
endif # GITSUBMODULES
|
||||
|
||||
# Only needed for GLIBC stack trace:
|
||||
LFLAGS=-rdynamic
|
||||
|
||||
@@ -68,6 +68,17 @@ endif
|
||||
# you're reading this in Makefile augmented by hints, that may not be true).
|
||||
#
|
||||
|
||||
ifeq "$(GIT)" "1"
|
||||
ifndef GITSUBMODULES
|
||||
GITSUBMODULES=1
|
||||
endif
|
||||
endif
|
||||
ifeq "$(git)" "1"
|
||||
ifndef GITSUBMODULES
|
||||
GITSUBMODULES=1
|
||||
endif
|
||||
endif
|
||||
|
||||
#-INCLUDE multiw-2.370
|
||||
|
||||
# compiler.370 contains compiler detection and adjustments common
|
||||
@@ -194,6 +205,22 @@ override GAME=
|
||||
MOREALL += ( cd src ; $(MAKE) pregame ; $(MAKE) $(TARGETPFX)libnh.a )
|
||||
endif # WANT_LIBNH
|
||||
|
||||
# Lua
|
||||
# when building liblua.a, avoid warning that use of tmpnam() should be
|
||||
# replaced by mkstemp(); the lua code doesn't use nethack's config.h so
|
||||
# this needs to be passed via make rather than defined in unixconf.h
|
||||
SYSCFLAGS=-DLUA_USE_MACOSX
|
||||
ifdef GITSUBMODULES
|
||||
LUAFLAGS=CC='$(CC)' SYSCFLAGS='$(SYSCFLAGS)'
|
||||
ifneq "$(CCISCLANG)" ""
|
||||
# clang
|
||||
LUAFLAGS +=CWARNGCC=''
|
||||
endif # clang
|
||||
override LUAHEADERS = submodules/lua
|
||||
override LUA2NHTOP = ../..
|
||||
override LUAMAKEFLAGS=$(LUAFLAGS)
|
||||
endif # GITSUBMODULES
|
||||
|
||||
WANT_BUNDLE=1
|
||||
ifdef WANT_SHARE_INSTALL
|
||||
# if $GAMEUID is root, we install into roughly proper Mac locations, otherwise
|
||||
|
||||
Reference in New Issue
Block a user