From 20511564f75dc993cef7cb1c5fba80bebd8e993f Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 21 Dec 2024 00:47:18 -0500 Subject: [PATCH] utility to help maintain lua files on platform builds Use by: make -f dat/luahelper [target] Target examples: Visual Studio nmake : make -f dat/luahelper devhelp-nmake >file.txt msys2 GNUmakefile : make -f dat/luahelper devhelp-msys >file.txt Xcode project.pbxproj: make -f dat/luahelper devhelp-xcode >file.txt all: generate txt files for all the above --- dat/luahelper | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 dat/luahelper diff --git a/dat/luahelper b/dat/luahelper new file mode 100644 index 000000000..cc209a0ba --- /dev/null +++ b/dat/luahelper @@ -0,0 +1,80 @@ +# NetHack 3.7 luahelper $NHDT-Date: $ $NHDT-Branch: NetHack-3.7 $ +# +# Makefile to assist developers in adding lines to various build +# Makefiles, or project files, as lua files are added or removed. +# NetHack may be freely redistributed. See license for details. +# +# Must be run while your current directory is the top of the +# NetHack source tree. +# +# make -f dat/luahelper [target] +# +# Target examples: +# +# Visual Studio nmake : make -f dat/luahelper devhelp-nmake >file.txt +# +# MSYS2 GNUmakefile : make -f dat/luahelper devhelp-msys >file.txt +# +# Xcode project.pbxproj: make -f dat/luahelper devhelp-xcode >file.txt +# +# + +luanames = asmodeus baalz bigrm-* castle fakewiz? juiblex knox medusa-? \ + minend-? minefill minetn-? oracle orcus sanctum soko?-? tower? \ + valley wizard? nhcore nhlib themerms astral air earth fire water \ + hellfill tut-? ???-goal ???-fil? ???-loca ???-strt \ + dungeon quest + +alllua = $(wildcard $(addsuffix .lua,$(addprefix dat/, $(luanames)))) + +# +# generates lines to insert into +# sys/windows/Makefile.nmake +# +devhelp-nmake: + @echo "$(notdir $(alllua))" | \ + awk '{for (i=1; i<=NF; ++i)printf "%s%s%s%s", \ + i == 1? "ALL_LUA_FILES = " : "", \ + "$$(DAT)\\", \ + $$i, \ + i % 3? " ": ((i == NF)? "\n" : " \\\n\t")} \ + i % 3{print ""}' + @echo "" + +# +# generates lines to insert into +# sys/windows/GNUmakefile +# +devhelp-msys2: + @echo "$(basename $(notdir $(alllua)))" | \ + awk '{for (i=1; i<=NF; ++i)printf "%s%s%s", \ + i == 1? "LUALIST = " : "", \ + $$i, \ + i % 5? " ": ((i == NF)? "\n" : " \\\n\t")} \ + i % 5{print ""}' + @echo "" + +xcodeextra = bogusmon cmdhelp data engrave epitaph help hh \ + history keyhelp opthelp optmenu options oracles \ + rumors tribute wizhelp +# +# generates lines to insert into +# sys/unix/NetHack.xcodeproj/project.pbxproj +# +devhelp-xcode: + @echo "\t\t\tinputPaths = (" + @echo "$(xcodeextra) $(notdir $(alllua))" | \ + awk '{for (i=1; i<=NF; ++i)printf "%s%s%s%s%s", \ + i == 1? "\t" : "", \ + "\t\t\t\042$$(NH_DAT_DIR)/", \ + $$i, \ + "\042", \ + i % 1? " ": ((i == NF)? "\n" : ",\n\t")} \ + i % 1{print ""}' + @echo "\t\t\t);" + +all: + make -f dat/luahelper devhelp-nmake >./luahelp-nmake.txt + make -f dat/luahelper devhelp-msys2 >./luahelp-msys2.txt + make -f dat/luahelper devhelp-xcode >./luahelp-xcode.txt +# end