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:
nhmall
2022-02-04 14:48:29 -05:00
parent 8499c71fcc
commit b8489de8eb
6 changed files with 381 additions and 78 deletions

View File

@@ -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 )

View File

@@ -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

View File

@@ -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

View File

@@ -45,30 +45,19 @@ DEBUGINFO = N
#
#---------------------------------------------------------------
# Location of pdcurses
# Do you have a connection to the internet available that you want
# to utilize for obtaining prerequisite Lua source code and pdcurses source code
#
# NetHack obtained via git clone (default)
PDCURSES_TOP = ../submodules/pdcurses
# NetHack sources obtained by zip file download
#PDCURSES_TOP = ../lib/pdcurses
INTERNET_AVAILABLE = N
#
#---------------------------------------------------------------
# Location of LUA on this machine
# Do you have git commands available and NetHack in a git repository?
#
# Original Lua source can be obtained from:
# http://www.lua.org/ftp/lua-5.4.4.tar.gz
#
# This build assumes that the LUA sources are located
# at the specified location. If they are actually elsewhere
# you'll need to specify the correct spot below in order to
# successfully build NetHack-3.7.
#
# NetHack obtained via git clone (default)
LUATOP = ../submodules/lua
# NetHack sources obtained by zip file download (see Install.windows)
#LUATOP = ../lib/lua-5.4.4
GIT_AVAILABLE = N
#
#===============================================
#======= End of Modification Section ===========
@@ -85,7 +74,6 @@ LUATOP = ../submodules/lua
SKIP_NETHACKW = N
USE_LUADLL = Y
WANT_LUAC = N
ADD_CURSES=Y
ifndef LUA_VERSION
LUAVER=5.4.4
@@ -93,6 +81,106 @@ else
LUAVER=$(LUA_VERSION)
endif
# if GIT=1 is passed on the make command, allow use of git and internet
if "$(GIT)" "1"
INTERNET_AVAILABLE=Y
GIT_AVAILABLE=Y
endif
if "$(git)" "1"
INTERNET_AVAILABLE=Y
GIT_AVAILABLE=Y
endif
#
#==============================================================================
# Sanity checks for prerequisite Lua and pdcurses
#
LUA_MAY_PROCEED=N
ADD_CURSES=N
# First, Lua
ifeq "$(INTERNET_AVAILABLE)" "Y"
ifeq "$(GIT_AVAILABLE)" "Y"
LUATOP=../submodules/lua
LUASRC=$(LUATOP)
LUA_MAY_PROCEED=Y
else # GIT_AVAILABLE
LUATOP = ../lib/lua-$(LUAVER)
LUASRC = $(LUATOP)/src
LUA_MAY_PROCEED=Y
endif # GIT_AVAILABLE
else # INTERNET_AVAILABLE not
# The internet is not available for obtaining Lua using either
# method (git or download). Check to see if it is available already, with
# precedence given to ../submodules, then ../lib.
#
ifneq ("$(wildcard ../submodules/lua/lua.h)", "")
$(info Here- ../submodules/lua/lua.h)
LUATOP=../submodules/lua
LUASRC=$(LUATOP)
LUA_MAY_PROCEED=Y
else ifneq ("$(wildcard ../lib/lua-$(LUAVER)/src/lua.h)", "")
$(info Here- ../lib/lua-$(LUAVER)/src/lua.h)
LUATOP = ../lib/lua-$(LUAVER)
LUASRC = $(LUATOP)/src
LUA_MAY_PROCEED=Y
else
$(info NO MATCH)
endif # Lua sources
ifeq "$(LUA_MAY_PROCEED)" "Y"
$(info No internet connection was authorized in the Makefile,)
$(info but a copy of lua-$(LUAVER) was found in $(LUASRC), so that will be used.)
endif # LUA_MAY_PROCEED
endif # INTERNET_AVAILABLE
ifneq "$(LUA_MAY_PROCEED)" "Y"
ifneq "$(INTERNET_AVAILABLE)" "Y"
$(info Your Makefile settings do not allow use of the internet to obtain Lua)
endif # INTERNET_AVAILABLE
$(info and no copy of Lua was found in either ../submodules/lua or ../lib/lua-$(LUAVER).)
$(info Change youf make command line to include:)
$(info GIT=1)
$(info or modify your Makefile to set the following:)
$(info INTERNET_AVAILABLE=Y)
$(info GIT_AVAILABLE=Y)
$(error Stopping because NetHack 3.7 requires Lua for its build.)
endif # LUA_MAY_PROCEED
# Now, pdcurses
ifeq "$(INTERNET_AVAILABLE)" "Y"
ifeq "$(GIT_AVAILABLE)" "Y"
PDCURSES_TOP=../submodules/pdcurses
ADD_CURSES=Y
else # GIT_AVAILABLE
PDCURSES_TOP=../lib/pdcurses
ADD_CURSES=Y
endif # GIT_AVAILABLE
else # INTERNET_AVAILABLE is not Y below
# Your Makefile settings to not allow pdcurses to be obtained by
# git or by download). Check to see if it is available at one of
# the expected locations already, with precedence given to ../submodules,
# then ../lib.
#
ifeq (,$(wildcard ../submodules/pdcurses/curses.h))
PDCURSES_TOP=../submodules/pdcurses
ADD_CURSES=Y
else ifeq (,$(wildcard ../lib/pdcurses/curses.h))
PDCURSES_TOP=../lib/pdcurses
ADD_CURSES=Y
endif # pdcurses sources available somewhere
ifeq "$(ADD_CURSES)" "Y"
$(info Your Makefile settings do not allow pdcurses to be obtained by)
$(info git or by download, but a copy of pdcurses was found in $(PDCURSES_TOP),)
$(info so that will be used.)
endif # ADD_CURSES == Y
endif # INTERNET_AVAILABLE
ifneq "$(ADD_CURSES)" "Y"
$(info NetHack 3.7 will be built without support for the curses window-port.)
endif
#==============================================================================
# The version of the game this Makefile was designed for
@@ -219,7 +307,6 @@ CLEAN_DIR = $(GAMEDIR) $(OBJ)
#=================================================================
OLUA = $(O)lua
LUASRC = $(LUATOP)
LUAOBJS = $(addprefix $(OLUA)/, $(addsuffix .o, lapi lauxlib lbaselib lcode lcorolib lctype \
ldblib ldebug ldo ldump lfunc lgc linit liolib llex lmathlib lmem \
loadlib lobject lopcodes loslib lparser lstate lstring lstrlib ltable ltablib ltm \
@@ -275,7 +362,7 @@ CLEAN_FILE += $(LUATARGETS) $(LUAOBJS) $(OLUA)/lua.o $(OLUA)/luac.o
NHLUAH = $(INCL)/nhlua.h
$(NHLUAH):
echo "/* nhlua.h - generated by top Makefile */" > $@
echo "/* nhlua.h - generated by Makefile.mingw32 */" > $@
@echo "#include \"$(LUASRC)/lua.h\"" >> $@
@echo "LUA_API int (lua_error) (lua_State *L) NORETURN;" >>$@
@echo "#include \"$(LUASRC)/lualib.h\"" >> $@
@@ -346,6 +433,7 @@ PDCSRC = $(PDCURSES_TOP)/pdcurses
PDCWINCON = $(PDCURSES_TOP)/wincon
PDCINCL = -I$(PDCURSES_TOP) -I$(PDCSRC) -I$(PDCWINCON)
PDCLIB = $(O)pdcurses.a
PDCDEP = $(PDCURSES_TOP)/curses.h
pdcurses: $(PDCLIB)
@@ -575,6 +663,52 @@ $(DLB): $(U)dlb.exe $(DLBLST) | $(GAMEDIR)
CLEAN_DIR += $(ODLB)
CLEAN_FILE += $(DTARGETS) $(DLBOBJS) $(INCL)/date.h
#==========================================
# Fetching other sources
#==========================================
ifeq "$(INTERNET_AVAILABLE)" "Y"
ifeq "$(GIT_AVAILABLE)" "Y"
fetchlua:
mkdir -p ../lib
if [ ! -f "$(LUASRC)/lua.h" ]; then \
git submodule init ../submodules/lua; \
git submodule update --remote ../submodules/lua; \
fi
fetchpdcurses:
mkdir -p ../lib
if [ ! -f "$(PDCURSES_TOP)/curses.h" ]; then \
git submodule init ../submodules/pdcurses; \
git submodule update --remote ../submodules/pdcurses; \
fi
else # GIT_AVAILABLE no
CURLLUASRC=http://www.lua.org/ftp/lua-5.4.4.tar.gz
CURLLUADST=lua-5.4.4.tar.gz
CURLPDCSRC=https://github.com/wmcbrine/PDCurses/archive/refs/tags/3.9.zip
CURLPDCDST=pdcurses.zip
fetchlua:
mkdir -p ../lib
if [ ! -f "$(LUASRC)/lua.h" ]; then \
cd ../lib; \
curl -L $(CURLLUASRC) -o $(CURLLUADST); \
/c/Windows/System32/tar -xvf $(CURLLUADST); \
cd ../src; \
fi
fetchpdcurses:
mkdir -p ../lib
if [ ! -f "$(PDCURSES_TOP)/curses.h" ]; then \
cd ../lib; \
curl -L $(CURLPDCSRC) -o $(CURLPDCDST); \
mkdir -p pdcurses; \
/c/Windows/System32/tar -C pdcurses --strip-components=1 -xvf $(CURLPDCDST); \
cd ../src; \
fi
endif # GIT_AVAILABLE
endif # INTERNET_AVAILABLE
#==========================================
# nethackw
#==========================================
@@ -723,7 +857,8 @@ CLEAN_FILE += $(NHTARGET) $(NHOBJS) $(NHRES)
#==========================================
.PHONY: all clean default install lua makedefs recover pdcurses \
tile2bmp tilemap uudecode dlb nethackw nethack tileutil
tile2bmp tilemap uudecode dlb nethackw nethack tileutil \
fetchlua fetchpdcurses
#
# Everything
@@ -747,7 +882,7 @@ ifeq "$(USE_DLB)" "Y"
TO_INSTALL += $(DLB)
endif
install: $(TO_INSTALL)
install: fetchlua fetchpdcurses $(TO_INSTALL)
ifdef CI_COMPILER
ls -l $(SRC)
ls -l $(DAT)

View File

@@ -45,32 +45,27 @@ GAMEDIR = ..\binary # Default game build directory
DEBUGINFO = Y
#------------------------------------------------------------------------------
#
#---------------------------------------------------------------
# Location of pdcurses
#
# NetHack obtained via git clone (default)
PDCURSES_TOP = ../submodules/pdcurses
# Do you have a connection to the internet available that you want
# to utilize for obtaining prerequisite Lua source code and pdcurses source code?
#
# NetHack sources obtained by zip file download
#PDCURSES_TOP = ../lib/pdcurses
#
#---------------------------------------------------------------
# Location of LUA on this machine
#
# Original Lua source can be obtained from:
# http://www.lua.org/ftp/lua-5.4.4.tar.gz
#
# This build assumes that the LUA sources are located
# at the specified location. If they are actually elsewhere
# you'll need to specify the correct spot below in order to
# successfully build NetHack-3.7.
#
# NetHack obtained via git clone (default)
LUATOP = ..\submodules\lua
INTERNET_AVAILABLE = N
# NetHack sources obtained by zip file download
#LUATOP = ..\lib\lua-5.4.4
#------------------------------------------------------------------------------
#
# Do you have git commands available and NetHack in a git repository?
GIT_AVAILABLE = N
# If not, because you obtained the NetHack sources in a zip file download,
# set GIT_AVAILABLE = N
# You can override INTERNET_AVAILABLE and GIT_AVAILABLE on the nmake command
# line by adding GIT=1
# for example:
# nmake GIT=1 install
#
#------------------------------------------------------------------------------
# This Makefile will attempt to auto-detect your selected target architecture
@@ -83,15 +78,6 @@ LUATOP = ..\submodules\lua
#TARGET_CPU=x64
#TARGET_CPU=x86
#------------------------------------------------------------------------------
#
#
# Do you have git commands available and NetHack in a git repository.
# If not, such as if you obtained the NetHack sources in a zip file download,
# set GIT_AVAILABLE = 0
#
GIT_AVAILABLE = 1
#==============================================================================
#======================== End of Modification Section =========================
#==============================================================================
@@ -105,7 +91,6 @@ GIT_AVAILABLE = 1
#==============================================================================
SKIP_NETHACKW = N
ADD_CURSES=Y
!IFNDEF LUA_VERSION
LUAVER=5.4.4
@@ -113,6 +98,99 @@ LUAVER=5.4.4
LUAVER=$(LUA_VERSION)
!ENDIF
# if GIT=1 is passed on the make command, allow use of git and internet
!IF "$(GIT)" == "1"
INTERNET_AVAILABLE=Y
GIT_AVAILABLE=Y
!ENDIF
!IF "$(git)" == "1"
INTERNET_AVAILABLE=Y
GIT_AVAILABLE=Y
!ENDIF
#==============================================================================
# Sanity checks for prerequisite Lua and pdcurses
#
LUA_MAY_PROCEED=N
ADD_CURSES=N
# First, Lua
!IF "$(INTERNET_AVAILABLE)" == "Y"
!IF "$(GIT_AVAILABLE)" == "Y"
LUATOP=..\submodules\lua
LUASRC=$(LUATOP)
LUA_MAY_PROCEED=Y
!ELSE # GIT_AVAILABLE
LUATOP = ..\lib\lua-$(LUAVER)
LUASRC = $(LUATOP)\src
LUA_MAY_PROCEED=Y
!ENDIF # GIT_AVAILABLE
!ELSE # INTERNET_AVAILABLE is not Y below
# The internet is not available for obtaining Lua using either
# method (git or download). Check to see if it is available already, with
# precedence given to ../submodules, then ../lib.
#
!IF EXIST("..\submodules\lua\lua.h")
LUATOP=..\submodules\lua
LUASRC=$(LUATOP)
LUA_MAY_PROCEED=Y
!ELSEIF EXIST("..\lib\lua-$(LUAVER)\src\lua.h")
LUATOP = ..\lib\lua-$(LUAVER)
LUASRC = $(LUATOP)\src
LUA_MAY_PROCEED=Y
!ENDIF # Lua sources
!IF "$(LUA_MAY_PROCEED)" == "Y"
!MESSAGE No internet connection was authorized in the Makefile,
!MESSAGE but a copy of lua-$(LUAVER) was found in $(LUATOP), so that will be used.
!ENDIF # LUA_MAY_PROCEED
!ENDIF # INTERNET_AVAILABLE
!IF "$(LUA_MAY_PROCEED)" != "Y"
!IF "$(INTERNET_AVAILABLE)" != "Y"
!MESSAGE Your Makefile settings do not allow use of the internet to obtain Lua
!ENDIF # INTERNET_AVAILABLE
!MESSAGE and no copy of Lua was found in either ..\submodules\lua or ..\lib\lua-$(LUAVER).
!MESSAGE Change your nmake command line to include:
!MESSAGE GIT=1
!MESSAGE or modify your Makefile to set the following:
!MESSAGE INTERNET_AVAILABLE=Y
!MESSAGE GIT_AVAILABLE=Y
!ERROR Stopping because NetHack 3.7 requires Lua for its build.
!ENDIF # LUA_MAY_PROCEED
# Now, pdcurses
!IF "$(INTERNET_AVAILABLE)" == "Y"
!IF "$(GIT_AVAILABLE)" == "Y"
PDCURSES_TOP=..\submodules\pdcurses
ADD_CURSES=Y
!ELSE # GIT_AVAILABLE
PDCURSES_TOP=..\lib\pdcurses
ADD_CURSES=Y
!ENDIF # GIT_AVAILABLE
!ELSE # INTERNET_AVAILABLE is not Y below
# Your Makefile settings do not allow pdcurses to be obtained by
# git or by download. Check to see if it is available at one of
# the expected locations already, with precedence given to ../submodules,
# then ../lib.
#
!IF EXIST("..\submodules\pdcurses\curses.h")
PDCURSES_TOP=..\submodules\pdcurses
ADD_CURSES=Y
!ELSEIF EXIST("..\lib\pdcurses\curses.h")
PDCURSES_TOP=..\lib\pdcurses
ADD_CURSES=Y
!ENDIF # pdcurses sources available somewhere
!IF "$(ADD_CURSES)" == "Y"
!MESSAGE Your Makefile settings do not allow pdcurses to be obtained by
!MESSAGE git or by download, but a copy of pdcurses was found in $(PDCURSES_TOP),
!MESSAGE so that will be used.
!ENDIF # ADD_CURSES == Y
!ENDIF # INTERNET_AVAILABLE
!IF "$(ADD_CURSES)" != "Y"
!MESSAGE NetHack 3.7 will be built without support for the curses window-port.
!ENDIF
#TEST_CROSSCOMPILE=Y
#==============================================================================
@@ -233,7 +311,6 @@ CROSSCOMPILE=
LUAVER=5.4.4
!ENDIF
LUASRC = $(LUATOP)
LUALIB = $(O)lua$(LUAVER)-static.lib
LUADLL = $(O)lua$(LUAVER).dll
LUAINCL = /I$(LUASRC)
@@ -269,12 +346,12 @@ LUAOBJFILES = $(LUAOBJFILES) $(O)lbitlib.o
# is https://github.com/wmcbrine/PDCurses.git
#=================================================================
!IF "$(ADD_CURSES)" == "Y"
PDCURSES_TOP = ..\submodules\pdcurses
PDCURSES_CURSES_H = $(PDCURSES_TOP)\curses.h
PDCURSES_CURSPRIV_H = $(PDCURSES_TOP)\curspriv.h
PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H)
PDCSRC = $(PDCURSES_TOP)\pdcurses
PDCWINCON = $(PDCURSES_TOP)\wincon
PDCDEP = $(PDCURSES_TOP)\curses.h
PDCLIBOBJS = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o \
$(O)bkgd.o $(O)border.o $(O)clear.o $(O)color.o $(O)delch.o $(O)deleteln.o \
@@ -293,6 +370,7 @@ PDCINCL = /I$(PDCURSES_TOP) /I$(PDCSRC) /I$(PDCWINCON)
!ELSE
PDCLIB =
PDCDEP =
!ENDIF
HACKINCL = $(INCL)\align.h $(INCL)\artifact.h $(INCL)\artilist.h \
@@ -805,7 +883,7 @@ DLB =
#==========================================
{$(WCURSES)}.c{$(OBJ)}.o:
@$(cc) -DPDC_NCMOUSE $(PDCINCL) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $<
$(cc) -DPDC_NCMOUSE $(PDCINCL) $(cflagsBuild) $(CROSSCOMPILE) $(CROSSCOMPILE_TARGET) -Fo$@ $<
#{$(WCURSES)}.txt{$(DAT)}.txt:
# @copy $< $@
@@ -843,15 +921,44 @@ DLB =
all : install
install: $(LUATOP)\lua.h $(INCL)\nhlua.h $(O)envchk.tag $(O)obj.tag $(O)utility.tag \
install: $(LUASRC)\lua.h $(PDCDEP) $(INCL)\nhlua.h $(O)envchk.tag $(O)obj.tag $(O)utility.tag \
$(DAT)\data $(DAT)\rumors $(DAT)\oracles $(DAT)\engrave \
$(DAT)\epitaph $(DAT)\bogusmon $(GAMEDIR)\NetHack.exe \
$(GAMEDIR)\NetHackW.exe $(O)install.tag
@echo Done.
$(LUATOP)\lua.h:
git submodule init
git submodule update --remote
!IF "$(INTERNET_AVAILABLE)" == "Y"
!IF "$(GIT_AVAILABLE)" == "Y"
$(LUASRC)\lua.h:
git submodule init ../submodules/lua
git submodule update --remote ../submodules/lua
$(PDCURSES_TOP)\curses.h:
git submodule init ../submodules/pdcurses
git submodule update --remote ../submodules/pdcurses
!ELSE # GIT_AVAILABLE no
CURLLUASRC=http://www.lua.org/ftp/lua-5.4.4.tar.gz
CURLLUADST=lua-5.4.4.tar.gz
CURLPDCSRC=https://github.com/wmcbrine/PDCurses/archive/refs/tags/3.9.zip
CURLPDCDST=pdcurses.zip
$(LUASRC)\lua.h:
cd ..\lib
curl -L $(CURLLUASRC) -o $(CURLLUADST)
tar -xvf $(CURLLUADST)
cd ..\src
$(PDCURSES_TOP)\curses.h:
cd ..\lib
curl -L $(CURLPDCSRC) -o $(CURLPDCDST)
if not exist pdcurses\*.* mkdir pdcurses
tar -C pdcurses --strip-components=1 -xvf $(CURLPDCDST)
cd ..\src
!ENDIF # GIT_AVAILABLE
!ELSE # INTERNET_AVAILABLE
$(LUASRC)\lua.h:
$(PDCURSES_TOP)\curses.h:
!ENDIF # INTERNET_AVAILABLE
#==========================================
# Main game targets.
@@ -1001,10 +1108,10 @@ $(O)utility.tag: $(INCL)\nhlua.h $(U)tile2bmp.exe $(U)makedefs.exe
$(INCL)\nhlua.h:
@echo /* nhlua.h - generated by Makefile from Makefile.msc */ > $@
@echo #include "../submodules/lua/lua.h" >> $@
@echo #include "lua.h" >> $@
@echo LUA_API int (lua_error) (lua_State *L) NORETURN; >> $@
@echo #include "../submodules/lua/lualib.h" >> $@
@echo #include "../submodules/lua/lauxlib.h" >> $@
@echo #include "lualib.h" >> $@
@echo #include "lauxlib.h" >> $@
@echo /*nhlua.h*/ >> $@
tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe