copying a timestamp

Ralf Wildenhues Ralf.Wildenhues@gmx.de
Sun Nov 21 00:21:00 GMT 2010


Hello Nathanael,

* Nathanael Nerode (GCC) wrote on Mon, Nov 15, 2010 at 03:52:44AM CET:
> Just in case anyone's looking for a good project, I figured out a VERY
> long time ago that the true long-term solution to practically all
> problems I've ever encountered in Makefile design, including this one,
> lies in creating an extension to "make".  Unfortunately I've never
> gotten around to digging into the internals of anyone's version of
> 'make' in order to figure out where to implement this, and the GNU make
> people were completely uninterested, since they didn't get why it was a
> good idea.

> 'make' badly needs a mechanism whereby the Makefile programmer can
> specify a code fragment for a given target A which answers the question
> 'is A up to date?'.

I assume you are hinting at
<http://thread.gmane.org/gmane.comp.gnu.make.bugs/1007>.

The reply from Paul is still mostly correct though: make walks the
complete dependency tree down and then back up.  When walking back up,
the mechanism you desire is easily implemented in a small shell command
(as shown in the example of Paul's reply).

When first walking down, you just need to ensure that the graph really
is a tree.  There are (at least) two choices you can make at that time,
and in GNU make you can implement them with arbitrary shell statements:

- should T be updated if P is newer?

    T : $(shell if $$condition; then echo P; fi)

- should T, if it is to be updated, be updated after P is updated
  (order-only dependency, since GNU make 3.80)?

    T : | $(shell if $$condition; then echo P; fi)

So, in summary, I think what you want is already possible, albeit maybe
not in a concise notation.

Cheers,
Ralf



More information about the Gcc-patches mailing list