-# 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.
-#
-$(PN).pdf: $(SRCS) $(PN).bbl
+# At the start of this rule, we call $(LATEX) to compile $(PN).tex.
+# It stores the resulting PDF in a separate "build" directory, so this
+# will not actually create or overwrite the target $(PN).pdf. If there
+# is no $(PN).pdf already, then we rename the new one to $(PN).pdf and
+# we are done. But if there was a previous version, then we compare
+# the two (new & old) versions. In either case, we rename the new one
+# over the old one. But if the two differ, then we repeat this process
+# in a loop until the just-built PDF is identical to the one from the
+# previous iteration.
+$(PN).pdf: $(SRCS) $(BUILDDIR)/$(PN).bbl $(INDEX_DSTS)