From: PatR Date: Mon, 27 Sep 2021 08:30:53 +0000 (-0700) Subject: Guidebook make sequencing X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e52f38b3a36d1e84655c7836d69d1608c0f8cc64;p=nethack Guidebook make sequencing 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. --- diff --git a/sys/unix/Makefile.doc b/sys/unix/Makefile.doc index d1c3c1831..a30787e5a 100644 --- a/sys/unix/Makefile.doc +++ b/sys/unix/Makefile.doc @@ -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) diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index 153b3ebc2..bb3e175ce 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -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 diff --git a/sys/unix/Makefile.utl b/sys/unix/Makefile.utl index 1998e3c2b..57b1fcec3 100644 --- a/sys/unix/Makefile.utl +++ b/sys/unix/Makefile.utl @@ -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.