From: PatR Date: Wed, 27 Nov 2019 03:27:00 +0000 (-0800) Subject: 3.7 Unix Makefiles X-Git-Tag: NetHack-3.7.0_WIP~228^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=865607a39271b8138e8e769ed9e812f6c1b1e65c;p=nethack 3.7 Unix Makefiles Copy lib/lua-$(VERSION)/src/liblua.h to lib/lua/ rather than lib/. Instead of copying any of the header files or telling the compiler where to find the lua ones, generate include/nhlua.h on the fly and restrict the knowledge of where they are to it (paths are relative to include/). |/* nhlua.h - generated by top Makefile */ |#include "../lib/lua-5.3.5/src/lua.h" |LUA_API int (lua_error) (lua_State *L) NORETURN; |#include "../lib/lua-5.3.5/src/lualib.h" |#include "../lib/lua-5.3.5/src/lauxlib.h" |/*nhlua.h*/ This might need to be redone (or augmented by having CFLAGS add back '-I path-to-lua') if some compiler can't find '#include "luaconf.h"' issued by lua.h. --- diff --git a/include/system.h b/include/system.h index 265f46f98..60437f0bc 100644 --- a/include/system.h +++ b/include/system.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 system.h $NHDT-Date: 1550268586 2019/02/15 22:09:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.17 $ */ +/* NetHack 3.6 system.h $NHDT-Date: 1574825213 2019/11/27 03:26:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.22 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -570,9 +570,7 @@ E int FDECL(atoi, (const char *)); #endif /* WIN32 */ #if !defined(CROSSCOMPILE) || defined(CROSSCOMPILE_TARGET) -#include "lua.h" -#include "lualib.h" -#include "lauxlib.h" +#include "nhlua.h" #if defined(WIN32) #define LUA_INTCAST(i) ((int) i) @@ -580,4 +578,5 @@ E int FDECL(atoi, (const char *)); #define LUA_INTCAST(i) (i) #endif #endif /* !CROSSCOMPILE || CROSSCOMPILE_TARGET */ + #endif /* SYSTEM_H */ diff --git a/src/nhlua.c b/src/nhlua.c index 73431fc7f..a8f33ca8e 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 nhlua.c $NHDT-Date: 1574646949 2019/11/25 01:55:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.8 $ */ +/* NetHack 3.6 nhlua.c $NHDT-Date: 1574825214 2019/11/27 03:26:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.9 $ */ /* Copyright (c) 2018 by Pasi Kallinen */ /* NetHack may be freely redistributed. See license for details. */ @@ -37,7 +37,6 @@ nhl_error(L, msg) lua_State *L; const char *msg; { - extern int FDECL(lua_error, (lua_State *)) NORETURN; lua_Debug ar; char buf[BUFSZ]; diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index 4e580ba2c..18323ccb2 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -1,5 +1,5 @@ # NetHack Makefile. -# NetHack 3.6 Makefile.src $NHDT-Date: 1574713234 2019/11/25 20:20:34 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.76 $ +# NetHack 3.6 Makefile.src $NHDT-Date: 1574825214 2019/11/27 03:26:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.77 $ # Copyright (c) 2018 by Pasi Kallinen # NetHack may be freely redistributed. See license for details. @@ -49,7 +49,7 @@ SHELL=/bin/sh # for UNIX systems SYSSRC = ../sys/share/ioctl.c ../sys/share/unixtty.c ../sys/unix/unixmain.c \ ../sys/unix/unixunix.c ../sys/unix/unixres.c -SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o ../lib/liblua.a +SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o ../lib/lua/liblua.a # # for Systos # SYSSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \ @@ -173,7 +173,6 @@ GNOMEINC=-I/usr/lib/glib/include -I/usr/lib/gnome-libs/include -I../win/gnome #CFLAGS = -O -I../include #LFLAGS = -CFLAGS += -I../lib # -lm required by lua LIBS += -lm @@ -506,9 +505,6 @@ HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h botl.h \ HSOURCES = $(HACKINCL) date.h onames.h pm.h vis_tab.h dgn_file.h -# relative to src -LUA_HEADERS = ../lib/lua.h ../lib/luaconf.h ../lib/lualib.h ../lib/lauxlib.h - # the following .o's _must_ be made before any others (for makedefs) FIRSTOBJ = monst.o objects.o @@ -589,7 +585,7 @@ DUMB.Setup: ../include/extern.h all: $(GAME) -lib/liblua.a $(LUA_HEADERS): +../lib/lua/liblua.a ../include/nhlua.h: @( cd .. ; $(MAKE) lua_support ) # dependencies for makedefs and its outputs, which the util @@ -724,7 +720,7 @@ clean: spotless: clean -rm -f a.out core $(GAME) Sys* - -rm -f ../lib/liblua.a $(LUA_HEADERS) + -rm -f ../lib/lua/liblua.a ../include/nhlua.h -rm -f ../include/date.h ../include/onames.h ../include/pm.h -rm -f ../include/vis_tab.h vis_tab.c tile.c *.moc -rm -f ../win/gnome/gn_rip.h @@ -757,7 +753,7 @@ $(CONFIG_H): ../include/config.h ../include/config1.h ../include/tradstdc.h \ ../include/micro.h ../include/pcconf.h ../include/tosconf.h \ ../include/amiconf.h ../include/macconf.h ../include/beconf.h \ ../include/wceconf.h ../include/ntconf.h \ - ../lib/lua.h ../lib/luaconf.h ../lib/lualib.h ../lib/lauxlib.h + ../include/nhlua.h touch $(CONFIG_H) # hack.h timestamp $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \ diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index da01f1a95..9d930aaa1 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -1,5 +1,5 @@ # NetHack Top-level Makefile. -# NetHack 3.6 Makefile.top $NHDT-Date: 1574713236 2019/11/25 20:20:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.42 $ +# NetHack 3.6 Makefile.top $NHDT-Date: 1574825215 2019/11/27 03:26:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.43 $ # Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland # NetHack may be freely redistributed. See license for details. @@ -94,21 +94,21 @@ DATNODLB = $(VARDATND) license symbols DATDLB = $(DATHELP) dungeon.lua tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD) DAT = $(DATNODLB) $(DATDLB) -LUA_HEADERS = lib/lua.h lib/luaconf.h lib/lualib.h lib/lauxlib.h -lua_support: lib/liblua.a $(LUA_HEADERS) +lua_support: lib/lua/liblua.a include/nhlua.h @true -lib/liblua.a: lib/lua-$(LUA_VERSION)/src/liblua.a - @( cd lib/lua-$(LUA_VERSION)/src ; make a ; cd ../../.. ) +lib/lua-$(LUA_VERSION)/src/liblua.a: lib/lua-$(LUA_VERSION)/src/lua.h + ( cd lib/lua-$(LUA_VERSION)/src ; make a ; cd ../../.. ) +lib/lua/liblua.a: lib/lua-$(LUA_VERSION)/src/liblua.a + @( if [ ! -d lib/lua ] ; then mkdir -p lib/lua ; fi ) cp lib/lua-$(LUA_VERSION)/src/liblua.a $@ -lib/lua.h: lib/lua-$(LUA_VERSION)/src/lua.h - sed -e '/(lua_error)/s/;/ NORETURN;/' \ - < lib/lua-$(LUA_VERSION)/src/lua.h > $@ -lib/luaconf.h: lib/lua-$(LUA_VERSION)/src/luaconf.h - cp lib/lua-$(LUA_VERSION)/src/luaconf.h $@ -lib/lualib.h: lib/lua-$(LUA_VERSION)/src/lualib.h - cp lib/lua-$(LUA_VERSION)/src/lualib.h $@ -lib/lauxlib.h: lib/lua-$(LUA_VERSION)/src/lauxlib.h - cp lib/lua-$(LUA_VERSION)/src/lauxlib.h $@ +include/nhlua.h: lib/lua/liblua.a + echo '/* nhlua.h - generated by top Makefile */' > $@ + @echo '#include "../lib/lua-$(LUA_VERSION)/src/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"' >> $@ + @echo '/*nhlua.h*/' >> $@ $(GAME): lua_support ( cd src ; $(MAKE) )