On 08/13/2011 03:02 PM, Bruno Haible wrote: > is it possible to extend GNU Make in a way that supports this? Possibly > by defining a new kind of special built-in target?
Well, one can imagine a new special target .TIME, say, which would look like this: .TIME: foo.h foo.h: a b c etc generate a b c etc >$@.time cmp $@ $@.time || cp $@.time $@ The idea is that a target foo.h that .TIME depends on would have special semantics: for the purpose of the rule creating foo.h, its timestamp is that of foo.h.time, but for the purpose of rules depending on foo.h, foo.h's timestamp is that of the file foo.h itself. There are downsides to this approach. A standard 'make' that does not understand .TIME would needlessly reexecute the foo.h rule every time one does a 'make', and a tarball built with the new GNU Make would preserve this problem in its timestamps. It'd be nice if someone could think of a way to overcome these downsides. I'll CC: this to bug-m...@gnu.org to see if there's any interest in pursuing a better solution. Bug-make readers, this is in response to <http://lists.gnu.org/archive/html/bug-gnulib/2011-08/msg00108.html> on the bug-gnulib list.