autoconf: Timestamps and Make

1 
1 12.20 Timestamp Resolution and Make
1 ===================================
1 
1 Traditionally, file timestamps had 1-second resolution, and `make' used
1 those timestamps to determine whether one file was newer than the
1 other.  However, many modern file systems have timestamps with
1 1-nanosecond resolution.  Some `make' implementations look at the
1 entire timestamp; others ignore the fractional part, which can lead to
1 incorrect results.  Normally this is not a problem, but in some extreme
1 cases you may need to use tricks like `sleep 1' to work around
1 timestamp truncation bugs.
1 
1    Commands like `cp -p' and `touch -r' typically do not copy file
11 timestamps to their full resolutions (⇒Limitations of Usual Tools
 touch.).  Hence you should be wary of rules like this:
1 
1      dest: src
1              cp -p src dest
1 
1    as `dest' often appears to be older than `src' after the timestamp
1 is truncated, and this can cause `make' to do needless rework the next
1 time it is invoked.  To work around this problem, you can use a
1 timestamp file, e.g.:
1 
1      dest-stamp: src
1              cp -p src dest
1              date >dest-stamp
1 
1    Apart from timestamp resolution, there are also differences in
1 handling equal timestamps.  HP-UX `make' updates targets if it has the
1 same time stamp as one of its prerequisites, in violation of Posix
1 rules.
1 
1    This can cause spurious rebuilds for repeated runs of `make'.  This
1 in turn can cause `make' to fail if it tries to rebuild generated files
1 in a possibly read-only source tree with tools not present on the
1 end-user machine.  Use GNU `make' instead.
1