From: PatR Date: Thu, 3 Jun 2021 00:13:56 +0000 (-0700) Subject: unix/Makefile.top fetch-Lua bit X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=acfbf20958f47f9def65004e35e8755cbc68b767;p=nethack unix/Makefile.top fetch-Lua bit % make spotless % sh sys/unix/setup.sh sys/unix/hints/macOS.2020 % make fetch-Lua worked, but the last ended with |rm include/nhlua.h |rm: include/nhlua.h: No such file or directory |make: [fetch-Lua] Error 1 (ignored) which might frighten skittish users (like me). Check whether the constructed header file exists (so is assumed to be for an earlier Lua version) and only delete it in that case. No more scary report of benign failure when it isn't there (after 'make spotless' or for brand new source setup). Also, some time ago we came to the conclusion that 'if [ ]' was an extension for GNU 'bash' and wouldn't work with some older actual 'sh' implementations. This replaces the one post-3.6 instance of |if [ ! -d foo ] then bar; fi in Makefile.top with |if test -d foo; then true; else bar; fi Testing was successful but done with bash rather than an old sh. :-} --- diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index 533c80a6d..1c8bdf54a 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -121,7 +121,7 @@ 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 - @( if [ ! -d lib/lua ] ; then mkdir -p lib/lua ; fi ) + @( if test -d lib/lua ; then true ; else mkdir -p lib/lua ; fi ) cp lib/lua-$(LUA_VERSION)/src/liblua.a $@ include/nhlua.h: $(TOPLUALIB) echo '/* nhlua.h - generated by top Makefile */' > $@ @@ -286,8 +286,9 @@ fetch-Lua: 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 ) -#if we just fetched lua, force include/nhlua.h to be built based on it - -rm include/nhlua.h +# remove include/nhlua.h in case it was created for some other Lua version + @( if test -f include/nhlua.h ; then \ + rm -f include/nhlua.h && echo 'rm include/nhlua.h' ; fi ) # 'make update' can be used to install a revised version after making # customizations or such. Unlike 'make install', it doesn't delete everything