# 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
| $(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
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)
../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
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
# 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=..
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.