From: Michael Orlitzky Date: Thu, 21 Nov 2019 20:21:40 +0000 (-0500) Subject: GNUmakefile: ensure the indices are rebuilt when the document changes. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=27f00374a2bf78ce1bf1e649f0881c31e92bd92b;p=mjotex.git GNUmakefile: ensure the indices are rebuilt when the document changes. --- diff --git a/GNUmakefile b/GNUmakefile index 3f941fb..dd8af23 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -44,6 +44,16 @@ SAGE_LISTING_DSTS = $(patsubst %.listing,%.py,$(SAGE_LISTING_SRCS)) # INDICES = $(PN) +# We have to rebuild the index whenever the contents of the document +# change, because page numbers get moved around. But when no INDICES +# are defined, rebuilding them should be a no-op. This next definition +# ensures that. +ifdef INDICES +REMAKE_INDICES = makeindex $(INDEX_SRCS) +else +REMAKE_INDICES = true +endif + # Use kpsewhich (from the kpathsea suite) to find the absolute paths # of the bibtex/mjotex files listed in in $(BIBS)/$(MJOTEX). The SRCS # variable should contain all (Bib)TeX source files for the document. @@ -117,6 +127,7 @@ $(PN).pdf: $(SRCS) $(PN).bbl $(INDEX_DSTS) rm $@.previous; \ else \ mv $@ $@.previous; \ + $(REMAKE_INDICES); \ $(MAKE) $@; \ fi;