]> gitweb.michael.orlitzky.com - mjotex.git/blobdiff - GNUmakefile
GNUmakefile: use SOURCE_DATE_EPOCH=0 instead of "sed" to prevent rebuilds.
[mjotex.git] / GNUmakefile
index 25ae0893c57ccac77cf8154db73c19a4b8ad8abd..622570769ac4829021450afb8065815e2d7516d8 100644 (file)
@@ -2,8 +2,12 @@
 # Example makefile using mjotex and a BibTeX references database.
 #
 
-# The latex compiler.
-LATEX = pdflatex -file-line-error -halt-on-error
+# The latex compiler. The SOURCE_DATE_EPOCH=0 prevents the creation
+# and modification dates from being embedded as metadata into the
+# output file; that in turn is important because it allows us to tell
+# when the output stops changing (that is, when we are done). The
+# variable is supported in pdftex v1.40.17 and later.
+LATEX = SOURCE_DATE_EPOCH=0 pdflatex -file-line-error -halt-on-error
 
 # The name of this document.
 #
@@ -84,40 +88,20 @@ endif
 # in a makefile?
 #
 # At the start of this target, we call $(LATEX) to compile $(PN).tex.
-# If you ignore the "sed" for now, then the next step is to check for
-# the existence of a "previous" file. If there isn't one, this is the
-# first time that we've tried to build the PDF. In that case, take the
-# PDF that we've just built and make *that* the previous file. Then
-# start all over. If there is a previous file, then this is the second
-# (or more) time that we've tried to build the PDF. We diff the PDF
-# file that we've just built against the previous file; if they're the
-# same, then we've succeeded and stop. Otherwise, we make the new PDF
-# the previous file, and start all over. The end result is that we
-# will loop until the newly-created PDF and the previous file are
-# identical.
-#
-# But what about the "sed" call? By default, pdflatex will compile the
-# creation date, modification date, and a unique ID into the output
-# PDF. That means that two otherwise-identical documents, created
-# seconds apart, will look different. We only need to know when the
-# *contents* of the document are the same -- we don't care about the
-# metadata -- so sed is used to remove those three nondeterministic
-# pieces of information.
-#
-# The creation and modification dates should become optional in pdftex
-# v1.40.17 thanks to Debian's SOURCE_DATE_EPOCH initiative. When that
-# version of pdflatex makes it into TeX Live 2016, we can replace
-# those two sed scripts with something smarter.
+# The first step is to check for the existence of a "previous"
+# file. If there isn't one, this is the first time that we've tried to
+# build the PDF. In that case, take the PDF that we've just built and
+# make *that* the previous file. Then start all over. If there is a
+# previous file, then this is the second (or more) time that we've
+# tried to build the PDF. We diff the PDF file that we've just built
+# against the previous file; if they're the same, then we've succeeded
+# and stop. Otherwise, we make the new PDF the previous file, and
+# start all over. The end result is that we will loop until the
+# newly-created PDF and the previous file are identical.
 #
 $(PN).pdf: $(SRCS) $(PN).bbl $(INDEX_DSTS)
        $(LATEX) $(PN).tex
 
-       sed --in-place \
-           -e '/^\/ID \[<.*>\]/d' \
-            -e "s/^\/\(ModDate\) (.*)/\/\1 (D:19700101000000Z00'00')/" \
-            -e "s/^\/\(CreationDate\) (.*)/\/\\1 (D:19700101000000Z00'00')/" \
-            $@
-
        if [ ! -f $@.previous ]; then \
                mv $@ $@.previous; \
                $(MAKE) $@; \