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.
This commit is contained in:
PatR
2019-11-26 19:27:00 -08:00
parent 2a78011030
commit 865607a392
4 changed files with 23 additions and 29 deletions
+14 -14
View File
@@ -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) )