]> gitweb.michael.orlitzky.com - mjotex.git/commitdiff
GNUmakefile: ensure the indices are rebuilt when the document changes.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 21 Nov 2019 20:21:40 +0000 (15:21 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 21 Nov 2019 20:21:40 +0000 (15:21 -0500)
GNUmakefile

index 3f941fbeab7dd637502a99481e73c497dad57aeb..dd8af234683c49057a0045aa3e3919f17835cb01 100644 (file)
@@ -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;