lua reorganization

Reduce the implied reliance of a specific version of lua.

Instead of copying liblua.a to src/, copy it to lib/.  Instead of
telling the compiler to look for headers in lib/lua-5.3.5/src/ as
well as in include/, copy the relevant ones to lib/ and tell the
compiler to look for them there.  'make spotless' in src/ will
remove both the object library and the header files from lib/ but
there really should be a new Makefile.lib to take care of that
directory.

Update Makefile.src to be able to build lua in case someone starts
with 'make all' there instead of in the top Makefile.  It doesn't
duplicate the option to fetch the lua source package though.

NHinternal/../genFiles.c has been updated to mention lib/liblua.a
and lib/lua*.h as 'generated at compile time' in Files and to skip
lib/lua-* entirely if it comes across that (so not operating on a
completely clean tree).  But it won't be accurate unless/until
other ports stage their lua files there instead of in src/ and
lib/lua-$(VERSION)/src/.

I haven't tried 'make depend' to see what it makes of the numerous
changes....
This commit is contained in:
PatR
2019-11-25 12:20:42 -08:00
parent 05e64d2429
commit 1b2b330e9f
2 changed files with 41 additions and 18 deletions
+18 -12
View File
@@ -1,5 +1,5 @@
# NetHack Makefile. # NetHack Makefile.
# NetHack 3.6 Makefile.src $NHDT-Date: 1550876124 2019/02/22 22:55:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.70 $ # NetHack 3.6 Makefile.src $NHDT-Date: 1574713234 2019/11/25 20:20:34 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.76 $
# Copyright (c) 2018 by Pasi Kallinen # Copyright (c) 2018 by Pasi Kallinen
# NetHack may be freely redistributed. See license for details. # NetHack may be freely redistributed. See license for details.
@@ -49,7 +49,7 @@ SHELL=/bin/sh
# for UNIX systems # for UNIX systems
SYSSRC = ../sys/share/ioctl.c ../sys/share/unixtty.c ../sys/unix/unixmain.c \ SYSSRC = ../sys/share/ioctl.c ../sys/share/unixtty.c ../sys/unix/unixmain.c \
../sys/unix/unixunix.c ../sys/unix/unixres.c ../sys/unix/unixunix.c ../sys/unix/unixres.c
SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o liblua.a SYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o unixres.o ../lib/liblua.a
# #
# for Systos # for Systos
# SYSSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \ # SYSSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \
@@ -173,7 +173,7 @@ GNOMEINC=-I/usr/lib/glib/include -I/usr/lib/gnome-libs/include -I../win/gnome
#CFLAGS = -O -I../include #CFLAGS = -O -I../include
#LFLAGS = #LFLAGS =
CFLAGS += -I../lib/lua-5.3.5/src CFLAGS += -I../lib
# -lm required by lua # -lm required by lua
LIBS += -lm LIBS += -lm
@@ -447,9 +447,9 @@ HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
dungeon.c eat.c end.c engrave.c exper.c explode.c extralev.c \ dungeon.c eat.c end.c engrave.c exper.c explode.c extralev.c \
files.c fountain.c hack.c hacklib.c invent.c isaac64.c light.c \ files.c fountain.c hack.c hacklib.c invent.c isaac64.c light.c \
lock.c mail.c makemon.c mapglyph.c mcastu.c mhitm.c mhitu.c \ lock.c mail.c makemon.c mapglyph.c mcastu.c mhitm.c mhitu.c \
minion.c mklev.c mkmap.c nhlua.c nhlsel.c \ minion.c mklev.c mkmap.c mkmaze.c mkobj.c mkroom.c mon.c \
mkmaze.c mkobj.c mkroom.c mon.c mondata.c monmove.c monst.c \ mondata.c monmove.c monst.c mplayer.c mthrowu.c muse.c music.c \
mplayer.c mthrowu.c muse.c music.c o_init.c objects.c objnam.c \ nhlua.c nhlsel.c o_init.c objects.c objnam.c \
options.c pager.c pickup.c pline.c polyself.c potion.c pray.c \ options.c pager.c pickup.c pline.c polyself.c potion.c pray.c \
priest.c quest.c questpgr.c read.c rect.c region.c restore.c \ priest.c quest.c questpgr.c read.c rect.c region.c restore.c \
rip.c rnd.c role.c rumors.c save.c sfstruct.c \ rip.c rnd.c role.c rumors.c save.c sfstruct.c \
@@ -504,8 +504,10 @@ HACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h beconf.h botl.h \
tradstdc.h trampoli.h trap.h unixconf.h vision.h vmsconf.h wintty.h \ tradstdc.h trampoli.h trap.h unixconf.h vision.h vmsconf.h wintty.h \
wincurs.h winX.h winprocs.h wintype.h you.h youprop.h wincurs.h winX.h winprocs.h wintype.h you.h youprop.h
HSOURCES = $(HACKINCL) date.h onames.h pm.h vis_tab.h \ HSOURCES = $(HACKINCL) date.h onames.h pm.h vis_tab.h dgn_file.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) # the following .o's _must_ be made before any others (for makedefs)
FIRSTOBJ = monst.o objects.o FIRSTOBJ = monst.o objects.o
@@ -516,9 +518,9 @@ HOBJ = $(FIRSTOBJ) allmain.o alloc.o apply.o artifact.o attrib.o ball.o \
drawing.o dungeon.o eat.o end.o engrave.o exper.o explode.o \ drawing.o dungeon.o eat.o end.o engrave.o exper.o explode.o \
extralev.o files.o fountain.o hack.o hacklib.o invent.o isaac64.o \ extralev.o files.o fountain.o hack.o hacklib.o invent.o isaac64.o \
light.o lock.o mail.o makemon.o mapglyph.o mcastu.o mhitm.o mhitu.o \ light.o lock.o mail.o makemon.o mapglyph.o mcastu.o mhitm.o mhitu.o \
minion.o mklev.o mkmap.o nhlua.o nhlsel.o \ minion.o mklev.o mkmap.o mkmaze.o mkobj.o mkroom.o mon.o \
mkmaze.o mkobj.o mkroom.o mon.o mondata.o monmove.o \ mondata.o monmove.o mplayer.o mthrowu.o muse.o music.o \
mplayer.o mthrowu.o muse.o music.o o_init.o objnam.o options.o \ nhlua.o nhlsel.o o_init.o objnam.o options.o \
pager.o pickup.o pline.o polyself.o potion.o pray.o priest.o \ pager.o pickup.o pline.o polyself.o potion.o pray.o priest.o \
quest.o questpgr.o read.o rect.o region.o restore.o rip.o rnd.o \ quest.o questpgr.o read.o rect.o region.o restore.o rip.o rnd.o \
role.o rumors.o save.o sfstruct.o \ role.o rumors.o save.o sfstruct.o \
@@ -587,6 +589,8 @@ DUMB.Setup: ../include/extern.h
all: $(GAME) all: $(GAME)
lib/liblua.a $(LUA_HEADERS):
@( cd .. ; $(MAKE) lua_support )
# dependencies for makedefs and its outputs, which the util # dependencies for makedefs and its outputs, which the util
# Makefile is responsible for keeping up to date # Makefile is responsible for keeping up to date
@@ -720,6 +724,7 @@ clean:
spotless: clean spotless: clean
-rm -f a.out core $(GAME) Sys* -rm -f a.out core $(GAME) Sys*
-rm -f ../lib/liblua.a $(LUA_HEADERS)
-rm -f ../include/date.h ../include/onames.h ../include/pm.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 ../include/vis_tab.h vis_tab.c tile.c *.moc
-rm -f ../win/gnome/gn_rip.h -rm -f ../win/gnome/gn_rip.h
@@ -751,7 +756,8 @@ $(CONFIG_H): ../include/config.h ../include/config1.h ../include/tradstdc.h \
../include/system.h ../include/unixconf.h ../include/os2conf.h \ ../include/system.h ../include/unixconf.h ../include/os2conf.h \
../include/micro.h ../include/pcconf.h ../include/tosconf.h \ ../include/micro.h ../include/pcconf.h ../include/tosconf.h \
../include/amiconf.h ../include/macconf.h ../include/beconf.h \ ../include/amiconf.h ../include/macconf.h ../include/beconf.h \
../include/wceconf.h ../include/ntconf.h ../include/wceconf.h ../include/ntconf.h \
../lib/lua.h ../lib/luaconf.h ../lib/lualib.h ../lib/lauxlib.h
touch $(CONFIG_H) touch $(CONFIG_H)
# hack.h timestamp # hack.h timestamp
$(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \ $(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \
+23 -6
View File
@@ -1,5 +1,5 @@
# NetHack Top-level Makefile. # NetHack Top-level Makefile.
# NetHack 3.6 Makefile.top $NHDT-Date: 1524689449 2018/04/25 20:50:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.36 $ # NetHack 3.6 Makefile.top $NHDT-Date: 1574713236 2019/11/25 20:20:36 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.42 $
# Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland # Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland
# NetHack may be freely redistributed. See license for details. # NetHack may be freely redistributed. See license for details.
@@ -94,8 +94,23 @@ DATNODLB = $(VARDATND) license symbols
DATDLB = $(DATHELP) dungeon.lua tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD) DATDLB = $(DATHELP) dungeon.lua tribute $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD)
DAT = $(DATNODLB) $(DATDLB) DAT = $(DATNODLB) $(DATDLB)
$(GAME): LUA_HEADERS = lib/lua.h lib/luaconf.h lib/lualib.h lib/lauxlib.h
( cd lib/lua-5.3.5/src && make a && cp liblua.a ../../../src/ ) lua_support: lib/liblua.a $(LUA_HEADERS)
@true
lib/liblua.a: lib/lua-$(LUA_VERSION)/src/liblua.a
@( cd lib/lua-$(LUA_VERSION)/src ; make a ; cd ../../.. )
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 $@
$(GAME): lua_support
( cd src ; $(MAKE) ) ( cd src ; $(MAKE) )
all: $(GAME) recover Guidebook $(VARDAT) spec_levs check-dlb all: $(GAME) recover Guidebook $(VARDAT) spec_levs check-dlb
@@ -238,11 +253,13 @@ dofiles-nodlb:
# This is not part of the dependency build hierarchy. # This is not part of the dependency build hierarchy.
# It requires an explicit "make fetch-Lua". # It requires an explicit "make fetch-Lua".
fetch-lua: fetch-Lua fetch-lua: fetch-Lua
@true
fetch-Lua: fetch-Lua:
( mkdir -p lib ; cd lib ; \ ( mkdir -p lib ; cd lib ; \
curl -R -O http://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz ; \ curl -R -O http://www.lua.org/ftp/lua-$(LUA_VERSION).tar.gz ; \
tar zxf lua-$(LUA_VERSION).tar.gz ; rm -f lua-$(LUA_VERSION).tar.gz ) tar zxf lua-$(LUA_VERSION).tar.gz ; rm -f lua-$(LUA_VERSION).tar.gz )
update: $(GAME) recover $(VARDAT) spec_levs update: $(GAME) recover $(VARDAT) spec_levs
# (don't yank the old version out from under people who're playing it) # (don't yank the old version out from under people who're playing it)
-mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old -mv $(INSTDIR)/$(GAME) $(INSTDIR)/$(GAME).old
@@ -291,7 +308,7 @@ clean:
( cd src ; $(MAKE) clean ) ( cd src ; $(MAKE) clean )
( cd util ; $(MAKE) clean ) ( cd util ; $(MAKE) clean )
( cd doc ; $(MAKE) clean ) ( cd doc ; $(MAKE) clean )
( cd lib/lua-5.3.5/src && $(MAKE) clean ) ( cd lib/lua-$(LUA_VERSION)/src && $(MAKE) clean )
# 'make spotless' returns the source tree to near-distribution condition. # 'make spotless' returns the source tree to near-distribution condition.
# it removes .o files, executables, and compiled data files # it removes .o files, executables, and compiled data files