Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re-entrancy in Make

12 views
Skip to first unread message

Peter Flynn

unread,
Sep 25, 2012, 5:39:13 PM9/25/12
to
I'm trying to construct a Makefile to handle the processing of
machine-generated LaTeX documents. The Makefile will eventually be
written by the same routine that creates the .tex file[s], so that each
one can ship with its own custom Makefile.

Because of the two-stage nature of LaTeX processing of cross-references,
tables of contents, bibliographic references, indexes, etc, a complete
cycle is:

latex fn; bibtex fn; latex fn; makeindex fn; latex fn

(where the bibtex input [yes, the actual .bib file as well as the .aux
file] is written during the first latex pass, and the makeindex input is
written during the second latex pass).

Is there a way for Make to know whether (for example) a particular
file's *content* has changed since the last time LaTeX was run? as
opposed to merely its timestamp.

My (possibly flaky) understanding is that Make looks at the timestamps
of the target and the dependencies to compute if a rule is to be
executed; is there a technique to store and compare some other values
such as the MD5 of the current and previous versions of a file, or the
diff output? Or can this be done manually with shell calls and conditionals?

///Peter

Bob Proulx

unread,
Sep 26, 2012, 12:29:47 PM9/26/12
to Peter Flynn, help-gn...@gnu.org
Peter Flynn wrote:
> Is there a way for Make to know whether (for example) a particular
> file's *content* has changed since the last time LaTeX was run? as
> opposed to merely its timestamp.

This would be a great question for help...@gnu.org where the make
experts hang out. I know I have seen this question asked there before
too but I don't recall and can't find an example at this moment.

Sidestepping that for a moment you might find these two references
useful:

http://www.cmcrossroads.com/ask-mr-make/6795-rebuilding-when-a-files-checksum-changes

But perhaps this more directly useful:

http://www.phys.psu.edu/~collins/software/latexmk-jcc/

Note that I am not using either of those methods at the moment and so
don't have direct first hand experience.

Bob

Peter Flynn

unread,
Sep 26, 2012, 2:11:37 PM9/26/12
to
On 26/09/12 17:29, Bob Proulx wrote:
> This would be a great question for help...@gnu.org where the make
> experts hang out. I know I have seen this question asked there before
> too but I don't recall and can't find an example at this moment.

Thanks very much for the pointers.

///Peter


0 new messages