diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-01-18 13:50:58 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-01-18 13:50:58 +0200 |
commit | d402bc96297c6ed3dd6ee883dcff8cc39bd01030 (patch) | |
tree | 634d397f48022935926e26123c13ab8adad6796e /build2/cc/compile.cxx | |
parent | 34be21a72a396240642acf3050eead875d3ed4b4 (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/cc/compile.cxx')
-rw-r--r-- | build2/cc/compile.cxx | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index 6fd64c2..3318f21 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -888,16 +888,7 @@ namespace build2 } } - if (ts != timestamp_unknown) - { - timestamp mt (pt.mtime ()); - - // See execute_prerequisites() for rationale behind the equal part. - // - return ts < mt || (ts == mt && pt.state () != target_state::changed); - } - - return false; + return ts != timestamp_unknown ? pt.newer (ts) : false; }; // Update and add a header file to the list of prerequisite targets. @@ -1394,10 +1385,18 @@ namespace build2 perform_update (action a, target& xt) const { file& t (static_cast<file&> (xt)); - file* s (execute_prerequisites<file> (x_src, a, t, t.mtime ())); - if (s == nullptr) - return target_state::unchanged; + // Update prerequisites and determine if any relevant ones render us + // out-of-date. Note that currently we treat all the prerequisites + // as potentially affecting the result (for simplicity/performance). + // + file* s; + { + auto p (execute_prerequisites<file> (x_src, a, t, t.mtime ())); + + if ((s = p.first) == nullptr) + return p.second; + } scope& bs (t.base_scope ()); scope& rs (*bs.root_scope ()); |