aboutsummaryrefslogtreecommitdiff
path: root/build2/target
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-01-18 13:50:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-01-18 13:50:58 +0200
commitd402bc96297c6ed3dd6ee883dcff8cc39bd01030 (patch)
tree634d397f48022935926e26123c13ab8adad6796e /build2/target
parent34be21a72a396240642acf3050eead875d3ed4b4 (diff)
Ignore prerequisite mtimes that are not linker inputs
This makes sure, for example, that we don't unnecessarily re-link an executable when its testscript prerequisite is changes.
Diffstat (limited to 'build2/target')
-rw-r--r--build2/target15
1 files changed, 15 insertions, 0 deletions
diff --git a/build2/target b/build2/target
index 1b75da3..dd9461c 100644
--- a/build2/target
+++ b/build2/target
@@ -1098,6 +1098,21 @@ namespace build2
mtime_ = mt;
}
+ // Return true if this target is newer than the specified timestamp.
+ //
+ bool
+ newer (timestamp mt)
+ {
+ timestamp mp (mtime ());
+
+ // What do we do if timestamps are equal? This can happen, for example,
+ // on filesystems that don't have subsecond resolution. There is not
+ // much we can do here except detect the case where the target was
+ // changed on this run.
+ //
+ return mt < mp || (mt == mp && state () == target_state::changed);
+ }
+
protected:
// Return timestamp_unknown if the mtime cannot be loaded.
//