From 74340e0de5df0a269dd39e9af9d15f76f25e26eb Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 21 Nov 2023 10:18:24 -0500 Subject: [PATCH] follow-up to Makefile out-of-date checking linux.370 and macOS.370 pass the name of the hints file and the list of included files, that they use, to Makefile.check. The name of the hints file is in variable HINTSFILE, the definition of which is now inserted by setup.sh The list of hints include files is in variable HINTSINCLFILES. --- sys/unix/Makefile.check | 33 ++++++++++++++++++++------------- sys/unix/hints/linux.370 | 21 ++++++++++++++++++++- sys/unix/hints/macOS.370 | 21 +++++++++++++++++++-- sys/unix/mkmkfile.sh | 2 ++ 4 files changed, 61 insertions(+), 16 deletions(-) diff --git a/sys/unix/Makefile.check b/sys/unix/Makefile.check index c3e933a0f..d2e2905b2 100755 --- a/sys/unix/Makefile.check +++ b/sys/unix/Makefile.check @@ -1,30 +1,37 @@ # NetHack 3.7 Makefile.check $NHDT-Date: 1599687610 2020/09/09 21:40:10 $ $NHDT-Branch: NetHack-3.7 -mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) -mkfile_dir := $(dir $(mkfile_path)) SUPATH := sys/unix/ MKINCLVERS := 370 +MKHINTSPATH := $(SUPATH)hints/ MKINCLPATH := $(SUPATH)hints/include/ -MKINCLNAMES := compiler cross-pre cross-post \ - gbdates-pre gbdates-post \ - multiw-1 multiw-2 multiw-3 \ - multisnd1-pre multisnd2-pre multisnd-post -MKINCLFILES := $(addprefix $(MKINCLPATH), $(addsuffix .$(MKINCLVERS), $(MKINCLNAMES))) -allmakefiles: dat/Makefile src/Makefile util/Makefile doc/Makefile Makefile +# +# Expectations: +# HINTSFILE and HINTSINCLFILES are passed from the calling Makefile +# which is the case with the hints/*.370 and hints/include/*.370 +# set. +# +ifneq ("$(HINTSFILE)","") +MKHINTSFILE := $(addprefix $(MKHINTSPATH), $(notdir $(HINTSFILE))) +endif +ifneq ("$(HINTSINCLFILES)","") +MKINCLFILES := $(addprefix $(MKINCLPATH), $(HINTSINCLFILES)) +endif -dat/Makefile: $(SUPATH)Makefile.dat $(MKINCLFILES) +checkmakefiles: dat/Makefile src/Makefile util/Makefile doc/Makefile Makefile + +dat/Makefile: $(SUPATH)Makefile.dat $(MKHINTSFILE) $(MKINCLFILES) @echo Attention: $@ is older than: $? -src/Makefile: $(SUPATH)Makefile.src $(MKINCLFILES) +src/Makefile: $(SUPATH)Makefile.src $(MKHINTSFILE) $(MKINCLFILES) @echo Attention: $@ is older than: $? -util/Makefile: $(SUPATH)Makefile.utl $(MKINCLFILES) +util/Makefile: $(SUPATH)Makefile.utl $(MKHINTSFILE) $(MKINCLFILES) @echo Attention: $@ is older than: $? -doc/Makefile: $(SUPATH)Makefile.doc $(MKINCLFILES) +doc/Makefile: $(SUPATH)Makefile.doc $(MKHINTSFILE) $(MKINCLFILES) @echo Attention: $@ is older than: $? -Makefile: $(SUPATH)Makefile.top $(MKINCLFILES) +Makefile: $(SUPATH)Makefile.top $(MKHINTSFILE) $(MKINCLFILES) @echo Attention: $@ is older than: $? diff --git a/sys/unix/hints/linux.370 b/sys/unix/hints/linux.370 index 537cd66da..7cec1ff89 100755 --- a/sys/unix/hints/linux.370 +++ b/sys/unix/hints/linux.370 @@ -20,7 +20,21 @@ # multiw-1.370 contains sections 1 to 2 #-INCLUDE multiw-1.370 +HINTSVERSION := 370 + +ifdef MAKEFILE_TOP +ifeq ($(MAKELEVEL),0) PRECHECK+=checkmakefiles +HINTSVERSION := 370 +# all files included from this hints file get listed +# in HINTSINCLNAMES (without suffix and without a path) +HINTSINCLNAMES := compiler cross-pre cross-post \ + gbdates-pre gbdates-post \ + multiw-1 multiw-2 multiw-3 \ + multisnd1-pre multisnd2-pre multisnd-post +HINTSINCLFILES := $(addsuffix .$(HINTSVERSION), $(HINTSINCLNAMES)) +endif +endif ifndef LIBXPM LIBXPM= -L/opt/X11/lib -lXpm @@ -359,9 +373,14 @@ GAMEPERM = 0755 #-INCLUDE multisnd-post.370 # +ifdef MAKEFILE_TOP +ifeq ($(MAKELEVEL),0) .PHONY: checkmakefiles checkmakefiles: - ( $(MAKE) -f sys/unix/Makefile.check ) + @$(MAKE) -f sys/unix/Makefile.check \ + HINTSFILE="$(HINTSFILE)" HINTSINCLFILES="$(HINTSINCLFILES)" +endif +endif ifdef WANT_LIBNH $(TARGETPFX)libnh.a: $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a diff --git a/sys/unix/hints/macOS.370 b/sys/unix/hints/macOS.370 index 294313cdb..c043782b4 100755 --- a/sys/unix/hints/macOS.370 +++ b/sys/unix/hints/macOS.370 @@ -20,8 +20,21 @@ # note: '#-INCLUDE' is not just a comment; multiw-1 contains sections 1 to 2 #-INCLUDE multiw-1.370 +HINTSVERSION := 370 +ifdef MAKEFILE_TOP +ifeq ($(MAKELEVEL),0) PRECHECK+=checkmakefiles +HINTSVERSION := 370 +# all files included from this hints file get listed +# in HINTSINCLNAMES (without suffix and without a path) +HINTSINCLNAMES := compiler cross-pre cross-post \ + gbdates-pre gbdates-post \ + multiw-1 multiw-2 multiw-3 \ + multisnd1-pre multisnd2-pre multisnd-post +HINTSINCLFILES := $(addsuffix .$(HINTSVERSION), $(HINTSINCLNAMES)) +endif +endif ifneq "$(USEMACPORTS)" "1" HAVE_HOMEBREW := $(shell expr `which -s brew; echo $$?` = 0) @@ -488,10 +501,14 @@ endif # MAKEFILE_SRC #-INCLUDE multisnd-post.370 # +ifdef MAKEFILE_TOP +ifeq ($(MAKELEVEL),0) .PHONY: checkmakefiles checkmakefiles: - ( $(MAKE) -f sys/unix/Makefile.check ) - + @$(MAKE) -f sys/unix/Makefile.check \ + HINTSFILE="$(HINTSFILE)" HINTSINCLFILES="$(HINTSINCLFILES)" +endif +endif ifdef WANT_LIBNH $(TARGETPFX)libnh.a: $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a diff --git a/sys/unix/mkmkfile.sh b/sys/unix/mkmkfile.sh index 90e134657..12894305b 100755 --- a/sys/unix/mkmkfile.sh +++ b/sys/unix/mkmkfile.sh @@ -17,6 +17,8 @@ echo "# Your changes will be lost. See sys/unix/NewInstall.unx." >> $3 echo "# Identify this file:" >> $3 echo "MAKEFILE_$2=1" >> $3 echo "" >> $3 +echo "HINTSFILE=$5" >> $3 +echo "" >> $3 echo "###" >> $3 echo "### Start $5 PRE" >> $3