Guidebook datestamping
Allow the hints file to apply a correct timestamp to the Guidebooks prior to use. Detect the NH_DATESUB in the Guidebook.mn or Guidebook.tex files and replace the datestamping line that follows. If git is available, it determines the hash of the last commit applied to doc/Guidebook.mn, and then determines the date of that commit. The interim Guidebook.dated.mn (or Guidebook.dated.tex) gets the datestamp applied. If git isn't available or doesn't correctly provide the hash for doc/Guidebook.mn, it should just continue to use whatever hard-coded date in the Guidebook.mn source file (it uses it instead of the interim file).
This commit is contained in:
@@ -12,5 +12,6 @@ Guidebook.dvi
|
|||||||
Guidebook.log
|
Guidebook.log
|
||||||
Guidebook.pdf
|
Guidebook.pdf
|
||||||
Guidebook.ps
|
Guidebook.ps
|
||||||
|
Guidebook.dated.*
|
||||||
*.synctex.*
|
*.synctex.*
|
||||||
|
|
||||||
|
|||||||
+18
-13
@@ -47,26 +47,31 @@ NEEDMAKEDEFS = $(MAKEDEFS)
|
|||||||
#NHGREP = cat
|
#NHGREP = cat
|
||||||
#NEEDMAKEDEFS =
|
#NEEDMAKEDEFS =
|
||||||
|
|
||||||
GUIDE_PREFORMAT = cat Guidebook.mn | $(NHGREP) | tbl tmac.n -
|
GUIDEBOOK_MN_SRC = Guidebook.mn
|
||||||
|
GUIDEBOOK_MN = $(GUIDEBOOK_MN_SRC)
|
||||||
|
GUIDEBOOK_TEX_SRC = Guidebook.tex
|
||||||
|
GUIDEBOOK_TEX = $(GUIDEBOOK_TEX_SRC)
|
||||||
|
|
||||||
|
GUIDE_PREFORMAT = cat $(GUIDEBOOK_MN) | $(NHGREP) | tbl tmac.n -
|
||||||
# for Guidebook.dat, unpaginated version of Guidebook.txt
|
# for Guidebook.dat, unpaginated version of Guidebook.txt
|
||||||
ONEPAGE_PREFORMAT = cat Gbk-1pg-pfx.mn Guidebook.mn Gbk-1pg-sfx.mn \
|
ONEPAGE_PREFORMAT = cat Gbk-1pg-pfx.mn $(GUIDEBOOK_MN) Gbk-1pg-sfx.mn \
|
||||||
| $(NHGREP) | tbl tmac.n -
|
| $(NHGREP) | tbl tmac.n -
|
||||||
|
|
||||||
# the basic guidebook
|
# the basic guidebook
|
||||||
Guidebook : Guidebook.mn tmac.n tmac.nh $(NEEDMAKEDEFS)
|
Guidebook : $(GUIDEBOOK_MN) tmac.n tmac.nh $(NEEDMAKEDEFS)
|
||||||
$(GUIDECMD) > Guidebook
|
$(GUIDECMD) > Guidebook
|
||||||
|
|
||||||
# Fancier output for those with ditroff, psdit and a PostScript printer.
|
# Fancier output for those with ditroff, psdit and a PostScript printer.
|
||||||
Guidebook.ps : Guidebook.mn tmac.n tmac.nh $(NEEDMAKEDEFS)
|
Guidebook.ps : $(GUIDEBOOK_MN) tmac.n tmac.nh $(NEEDMAKEDEFS)
|
||||||
$(GUIDE_PREFORMAT) | $(PSCMD) > Guidebook.ps
|
$(GUIDE_PREFORMAT) | $(PSCMD) > Guidebook.ps
|
||||||
|
|
||||||
# Guidebook.tex is the same as Guidebook.mn but formatted with LaTeX.
|
# Guidebook.tex is the same as Guidebook.mn but formatted with LaTeX.
|
||||||
# - The invocation command for LaTeX may vary in different installations.
|
# - The invocation command for LaTeX may vary in different installations.
|
||||||
# - To print Guidebook.dvi you need to use a suitable dvi-driver.
|
# - 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.
|
# - 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)
|
||||||
latex Guidebook.tex
|
latex $(GUIDEBOOK_TEX)
|
||||||
|
|
||||||
# makedefs has more dependencies than these; this is mainly to cope with the
|
# 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)
|
# case where it hasn't been built yet since it is usually needed for $(NHGREP)
|
||||||
@@ -97,17 +102,17 @@ manpages:
|
|||||||
-$(MDMANCREATE) $(MANDIR)/makedefs.$(MANEXT)
|
-$(MDMANCREATE) $(MANDIR)/makedefs.$(MANEXT)
|
||||||
|
|
||||||
# manual creation for distribution
|
# manual creation for distribution
|
||||||
DISTRIB = Guidebook.txt nethack.txt recover.txt \
|
DISTRIB = $(GUIDEBOOK_TEX) nethack.txt recover.txt \
|
||||||
dlb.txt makedefs.txt
|
dlb.txt makedefs.txt
|
||||||
|
|
||||||
distrib: $(DISTRIB)
|
distrib: $(DISTRIB)
|
||||||
@echo "Plain text documentation is up to date."
|
@echo "Plain text documentation is up to date."
|
||||||
|
|
||||||
Guidebook.txt : Guidebook.mn tmac.n tmac.nh $(NEEDMAKEDEFS)
|
Guidebook.txt : $(GUIDEBOOK_MN) tmac.n tmac.nh $(NEEDMAKEDEFS)
|
||||||
$(GUIDECMD) > Guidebook.txt
|
$(GUIDECMD) > $@
|
||||||
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)
|
$(NEEDMAKEDEFS)
|
||||||
$(ONEPAGECMD) > Guidebook.dat
|
$(ONEPAGECMD) > $@
|
||||||
|
|
||||||
MAN2TXT = $(NHGREP) | nroff -man - | $(COLCMD)
|
MAN2TXT = $(NHGREP) | nroff -man - | $(COLCMD)
|
||||||
nethack.txt : nethack.6
|
nethack.txt : nethack.6
|
||||||
@@ -120,7 +125,7 @@ makedefs.txt : makedefs.6
|
|||||||
cat makedefs.6 | $(MAN2TXT) > makedefs.txt
|
cat makedefs.6 | $(MAN2TXT) > makedefs.txt
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f Guidebook.aux Guidebook.log
|
-rm -f Guidebook.aux Guidebook.log $(DOC_EXTRAS)
|
||||||
|
|
||||||
spotless: clean
|
spotless: clean
|
||||||
-rm -f Guidebook Guidebook.dat Guidebook.ps Guidebook.dvi
|
-rm -f Guidebook Guidebook.dat Guidebook.ps Guidebook.dvi
|
||||||
|
|||||||
@@ -154,6 +154,9 @@ submodules/lua/lua.h:
|
|||||||
Guidebook:
|
Guidebook:
|
||||||
( cd doc ; $(MAKE) Guidebook )
|
( cd doc ; $(MAKE) Guidebook )
|
||||||
|
|
||||||
|
Guidebook.txt:
|
||||||
|
( cd doc ; $(MAKE) Guidebook.txt )
|
||||||
|
|
||||||
manpages:
|
manpages:
|
||||||
( cd doc ; $(MAKE) manpages )
|
( cd doc ; $(MAKE) manpages )
|
||||||
|
|
||||||
|
|||||||
Executable
+10
@@ -0,0 +1,10 @@
|
|||||||
|
# NetHack 3.7 gbdates-post.370 $NHDT-Date: 1599687610 2020/09/09 21:40:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.11 $
|
||||||
|
ifdef MAKEFILE_DOC
|
||||||
|
ifdef GB_DATESTAMP
|
||||||
|
Guidebook.dated.mn: $(GUIDEBOOK_MN_SRC)
|
||||||
|
@awk 'f{$$0=".ds f2 \"$(GB_DATESTAMP)";f=0}/NH_DATESUB/{f=1} 1' < $(GUIDEBOOK_MN_SRC) > $@
|
||||||
|
Guidebook.dated.tex: $(GUIDEBOOK_TEX_SRC)
|
||||||
|
@awk 'f{$$0="\\date{$(GB_DATESTAMP)}";f=0}/NH_DATESUB/{f=1} 1' < $(GUIDEBOOK_TEX_SRX) > $@
|
||||||
|
endif # GB_DATESTAMP
|
||||||
|
endif # MAKEFILE_DOC
|
||||||
|
#
|
||||||
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
# NetHack 3.7 gbdates-pre.370 $NHDT-Date: 1599687610 2020/09/09 21:40:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.11 $
|
||||||
|
|
||||||
|
ifdef MAKEFILE_DOC
|
||||||
|
ifneq "$(GIT)" "0"
|
||||||
|
#Get the hash of the last update to Guidebook.mn
|
||||||
|
GB_LAST_COMMIT := $(shell git log -n 1 --pretty=format:%H -- Guidebook.mn)
|
||||||
|
ifneq "$(GB_LAST_COMMIT)" ""
|
||||||
|
GB_DATESTAMP := $(shell git show -s --format=%cd --date=format:'%B %d, %Y' $(GB_LAST_COMMIT))
|
||||||
|
endif # GB_LAST_COMMIT
|
||||||
|
ifneq "$(GB_DATESTAMP)" ""
|
||||||
|
DOC_EXTRAS += Guidebook.dated.mn Guidebook.dated.tex
|
||||||
|
override GUIDEBOOK_MN = Guidebook.dated.mn
|
||||||
|
override GUIDEBOOK_TEX = Guidebook.dated.tex
|
||||||
|
endif # GB_DATESTAMP
|
||||||
|
endif # GIT=0 explicitly
|
||||||
|
endif # MAKEFILE_DOC
|
||||||
|
#
|
||||||
@@ -336,7 +336,17 @@ GAMEPERM = 0755
|
|||||||
#
|
#
|
||||||
#-INCLUDE cross-pre.370
|
#-INCLUDE cross-pre.370
|
||||||
#
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
#-INCLUDE gbdates-pre.370
|
||||||
|
#
|
||||||
|
|
||||||
#-POST
|
#-POST
|
||||||
|
|
||||||
|
#
|
||||||
|
#-INCLUDE gbdates-post.370
|
||||||
|
#
|
||||||
|
|
||||||
#
|
#
|
||||||
#-INCLUDE cross-post.370
|
#-INCLUDE cross-post.370
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -409,8 +409,15 @@ VARDIR=$(HACKDIR)
|
|||||||
#
|
#
|
||||||
#-INCLUDE cross-pre.370
|
#-INCLUDE cross-pre.370
|
||||||
#
|
#
|
||||||
|
#
|
||||||
|
#-INCLUDE gbdates-pre.370
|
||||||
|
#
|
||||||
#-POST
|
#-POST
|
||||||
|
|
||||||
|
#
|
||||||
|
#-INCLUDE gbdates-post.370
|
||||||
|
#
|
||||||
|
|
||||||
ifdef WANT_LIBNH
|
ifdef WANT_LIBNH
|
||||||
$(TARGETPFX)libnh.a: $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a
|
$(TARGETPFX)libnh.a: $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a
|
||||||
$(AR) rcs $@ $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a
|
$(AR) rcs $@ $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a
|
||||||
|
|||||||
Reference in New Issue
Block a user