Inputs changing during long compiles
Early versions of tmake using time-based comparison only created a virtual
timestamp for a target after the target was built. This suffered from a number of problems:
-
It assumed that [file mtime] can be compared directly against [clock seconds]
-
If source files changed between when the 'do' started, and when it finished, this information was lost.
-
This situation is complicated with high resolution timestamps as some tools write files with 1-second resolution timestamps and thus built targets can have timestamps before the inputs.
Note that hash-based builds don't suffer from this problem as the hash is always compared against the previously stored hash. No ordering is required.
Therefore the solution was to use the same approach for time-based builds and consider the mtime as a proxy hash of the source file. If the hash/mtime for any dependency changes from the previous build, the target is out of date and needs to be rebuilt. This simplifies the logic as the same algorithm is used in both time-based and hash-based builds, simply with a different "hash" calculation.
The results of the search are