help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why are phony order-only prerequisites always fired?


From: Akim Demaille
Subject: Why are phony order-only prerequisites always fired?
Date: Thu, 5 May 2011 15:05:11 +0200

Hi!

I have this set of LaTeX documents that should display accurate revision 
information each time they are compiled.  So they all include a file 
revision.sty which contains VCS-related information.  This file is declared 
phony because there's no visible way for Make to know when to update it: just 
update it each time we need it.

Of course, my PDF documents must have it as a prerequisite, so that (i) it 
exists, (ii) it is up-to-date when I compile the PDF.  Yet it is not because 
revision.sty is updated that the PDFs should be recompiled, so making 
revision.sty an order-only prerequisite makes perfect sense.

Yet, GNU Make seems to always run the recipes of the order-only prerequisites, 
and I don't understand why it is so.  No big deal, I can live with revision.sty 
being updating uselessly, but I would have expected it not to be.  But since 
the documentation does not seem to make this point (phony order-only 
prerequisite handling) explicit, maybe there is room for changes here, I don't 
know; or some explanations on why it was decided to do it this way.

The attached self-contained Makefile demonstrates my point:

First run creates everybody in proper order.
> $ make -j4
> date >>revision.sty
> touch foo.tex
> touch bar.tex
> echo foo.tex >>foo.pdf
> echo bar.tex >>bar.pdf
> rm bar.tex foo.tex

Following runs update revision.sty (why?) but leave the PDF alone (good).

> $ make
> date >>revision.sty
> 
> $ make
> date >>revision.sty

Of course updating a source file fires the compilation

> $ touch foo.tex
> $ make
> date >>revision.sty
> echo foo.tex >>foo.pdf

Taking care of concurrency properly

> $ touch foo.tex bar.tex
> $ make -j2
> date >>revision.sty
> echo foo.tex >>foo.pdf
> echo bar.tex >>bar.pdf

Thanks in advance!

Attachment: Makefile
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]