From d402bc96297c6ed3dd6ee883dcff8cc39bd01030 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 18 Jan 2017 13:50:58 +0200 Subject: 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. --- build2/target | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'build2/target') 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. // -- cgit v1.1