On Mon, Apr 06, 2026 at 04:10:30PM -0400, Ben Boeckel wrote:
> On Mon, Apr 06, 2026 at 12:41:15 -0400, Paul Smith wrote:
> > However, I can imagine a reason why timestamps are updated.  If you
> > don't update the timestamps, then every time you run make subsequently
> > autoconf and automake will be re-run again: you invoke make, it sees
> > the files are out of date and runs autoconf/automake, the contents will
> > be checked and found to be identical, and the files will not be
> > updated.  Then you run make again, it sees the files are out of date,
> > re-runs autoconf  and/or automake, sees the output is identical and
> > does not update the targets.
> 
> Note that `ninja` has a `restat = 1` to support this pattern of not
> updating timestamps when commands are rerun. The "last rerun" times are
> stored in `.ninja_log` and used to avoid rerunning in this case. Note
> that this means you can be "smart" and not update the timestamp if the
> contents *are* different, but not in a meaningful way (e.g., comments,
> whitespace).
> 
> I assume `gmake` could implement this in some way, but POSIX `make` is
> probably a "no" for all practical purposes.

It is straightforward to achieve a similar result with a portable makefile
by using a dedicated witness file, for example (totally untested):

  configure.stamp: configure.ac
        autoconf -o configure.new
        cmp configure.new configure >/dev/null 2>&1 \
          || mv -f configure.new configure
        echo >configure.stamp

  configure: configure.stamp

Cheers,
  Nick

Reply via email to