]> granicus.if.org Git - nethack/commitdiff
Guidebook make sequencing
authorPatR <rankin@nethack.org>
Mon, 27 Sep 2021 08:30:53 +0000 (01:30 -0700)
committerPatR <rankin@nethack.org>
Mon, 27 Sep 2021 08:30:53 +0000 (01:30 -0700)
Be able to run 'make Guidebook{|.txt|.ps}' in the doc subdirectory
without requring a full install first.

makedefs is no longer one of the first things built when building
nethack, and even if it was, nobody should have to rebuild all of
nethack after 'make spotless' when they just want to create one
or more of the formatted Guidebooks.  The 'roff versions (.ps and
also .txt) use makedefs as a filter by default, so wouldn't build
if it wasn't there.

Have Makefile.doc build makedefs when needed.

Clean up some dependencies in Makefile.utl.

Add a couple of comments to Makefile.src.

sys/unix/Makefile.doc
sys/unix/Makefile.src
sys/unix/Makefile.utl

index d1c3c183146459d6642614ff24013919d59a3bf5..a30787e5aa3ffb45be46d1c1ab1d92ee9e68cae4 100644 (file)
@@ -39,10 +39,13 @@ ONEPAGECMD = $(ONEPAGE_PREFORMAT) | nroff -c -Tascii | $(COLCMD) \
 
 # Only generate output for the current configuration:
 NHGREP = $(MAKEDEFS) --grep --input - --output -
+NEEDMAKEDEFS = $(MAKEDEFS)
 # Generate output for all configurations:
 #NHGREP = $(MAKEDEFS) --grep --input - --output - --grep-define ALLDOCS
+#NEEDMAKEDEFS = $(MAKEDEFS)
 # Fallback:
 #NHGREP = cat
+#NEEDMAKEDEFS =
 
 GUIDE_PREFORMAT = cat Guidebook.mn | $(NHGREP) | tbl tmac.n -
 # for Guidebook.dat, unpaginated version of Guidebook.txt
@@ -50,21 +53,27 @@ ONEPAGE_PREFORMAT = cat Gbk-1pg-pfx.mn Guidebook.mn Gbk-1pg-sfx.mn \
        | $(NHGREP) | tbl tmac.n -
 
 # the basic guidebook
-Guidebook:     Guidebook.mn tmac.n tmac.nh
+Guidebook      : Guidebook.mn tmac.n tmac.nh $(NEEDMAKEDEFS)
        $(GUIDECMD) > Guidebook
 
 # Fancier output for those with ditroff, psdit and a PostScript printer.
-Guidebook.ps:  Guidebook.mn tmac.n tmac.nh
+Guidebook.ps   : Guidebook.mn tmac.n tmac.nh $(NEEDMAKEDEFS)
        $(GUIDE_PREFORMAT) | $(PSCMD) > Guidebook.ps
 
 # Guidebook.tex is the same as Guidebook.mn but formatted with LaTeX.
 # - The invocation command for LaTeX may vary in different installations.
 # - To print Guidebook.dvi you need to use a suitable dvi-driver.
 # - LaTeX needs to be run twice; second pass uses Guidebook.aux made by first.
-Guidebook.dvi: Guidebook.tex
+Guidebook.dvi  : Guidebook.tex
        latex Guidebook.tex
        latex Guidebook.tex
 
+# makedefs has more dependencies than these; this is mainly to cope with the
+# case where it hasn't been built yet since it is usually needed for $(NHGREP)
+# (note: 'make makedefs', not 'make $(MAKEDEFS)')
+$(MAKEDEFS)    : ../util/makedefs.c ../include/config.h ../src/mdlib.c \
+                 ../util/mdgrep.h
+       ( cd ../util ; make makedefs )
 
 GAME   = nethack
 MANDIR = /usr/man/man6
@@ -94,9 +103,10 @@ DISTRIB = Guidebook.txt nethack.txt recover.txt \
 distrib: $(DISTRIB)
        @echo "Plain text documentation is up to date."
 
-Guidebook.txt  : Guidebook.mn tmac.n tmac.nh
+Guidebook.txt  : Guidebook.mn tmac.n tmac.nh $(NEEDMAKEDEFS)
        $(GUIDECMD) > Guidebook.txt
-Guidebook.dat  : Gbk-1pg-pfx.mn Gbk-1pg-sfx.mn Guidebook.mn tmac.n tmac.nh
+Guidebook.dat  : Gbk-1pg-pfx.mn Gbk-1pg-sfx.mn Guidebook.mn tmac.n tmac.nh \
+                 $(NEEDMAKEDEFS)
        $(ONEPAGECMD) > Guidebook.dat
 
 MAN2TXT = $(NHGREP) | nroff -man - | $(COLCMD)
index 153b3ebc288daea6bfec8a6ea65740b3d0c20b2a..bb3e175cea997a4755889bcf8747ec63baba0df6 100644 (file)
@@ -710,7 +710,8 @@ $(MAKEDEFS): $(FIRSTOBJ) \
                ../include/patchlevel.h
        @( cd ../util ; $(MAKE) makedefs )
 
-#      Source files created by 'makedefs' at build time.
+#      Source files formerly created by 'makedefs' at build time
+#      but no longer used.
 #      Each is given an artificial dependency upon the one before
 #      so that parallel makes will have to build them sequentially.
 #      (More for documentation than effect; 'make' should know not
@@ -771,7 +772,8 @@ clean:
 spotless: clean
        -rm -f a.out core $(GAMEBIN) Sys*
        -rm -f ../include/nhlua.h
-       -rm -f ../include/date.h ../include/onames.h ../include/pm.h
+       -rm -f ../include/date.h #created but no longer used, at least by core
+       -rm -f ../include/onames.h ../include/pm.h #obsolete generated files
        -rm -f tile.c *.moc
        -rm -f ../win/gnome/gn_rip.h
 
index 1998e3c2ba730f24ecd17637f0d80f8cbf07923e..57b1fcec3c653319259cabd3c014f277d57ad986 100644 (file)
@@ -3,6 +3,11 @@
 # Copyright (c) 2018 by Robert Patrick Rankin
 # NetHack may be freely redistributed.  See license for details.
 
+#
+# Note: as of nethack 3.7, 'lev_comp' and 'dgn_comp' are no longer present
+#      so use of yacc and lex to build them is no longer required.
+#
+
 # Root of source tree:
 NHSROOT=..
 
@@ -206,12 +211,18 @@ TARGET_CXXFLAGS = $(CXXFLAGS)
 makedefs:      $(MAKEOBJS) mdgrep.h
        $(CLINK) $(LFLAGS) -o makedefs $(MAKEOBJS)
 
-makedefs.o: makedefs.c ../src/mdlib.c $(CONFIG_H) ../include/permonst.h \
-               ../include/objclass.h ../include/sym.h ../include/defsym.h \
+
+# note: the headers listed here are maintained manually rather than via
+#      'make depend'; only the ones which are directly included by
+#      makedefs.c are listed, without various nested ones that they include;
+#      for makedefs (but not for nethack's core), mdlib.c gets included
+#      rather than be compiled separately
+makedefs.o: makedefs.c ../src/mdlib.c $(CONFIG_H) \
+               ../include/permonst.h ../include/objclass.h \
                ../include/artilist.h ../include/dungeon.h ../include/obj.h \
                ../include/monst.h ../include/monsters.h ../include/objects.h \
-               ../include/you.h ../include/flag.h ../include/dlb.h \
-               ../include/patchlevel.h
+               ../include/you.h ../include/context.h ../include/flag.h \
+               ../include/dlb.h ../include/patchlevel.h mdgrep.h
        $(CC) $(CFLAGS) -c makedefs.c -o $@
 
 # Don't require perl to build; that is why mdgrep.h is spelled wrong below.