aboutsummaryrefslogtreecommitdiff
path: root/build2/rule.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/rule.cxx')
-rw-r--r--build2/rule.cxx29
1 files changed, 18 insertions, 11 deletions
diff --git a/build2/rule.cxx b/build2/rule.cxx
index cbb7d08..0fcfde2 100644
--- a/build2/rule.cxx
+++ b/build2/rule.cxx
@@ -44,18 +44,25 @@ namespace build2
{
path_target& pt (dynamic_cast<path_target&> (t));
- // Assign the path. While normally we shouldn't do this in match(),
- // no other rule should ever be ambiguous with the fallback one.
+ // First check the timestamp. This allows for the special "trust me,
+ // this file exists" situations (used, for example, for installed
+ // stuff where we know it's there, just not exactly where).
//
- if (pt.path ().empty ())
- pt.derive_path ();
-
- // We cannot just call pt.mtime() since we haven't matched yet.
- //
- timestamp ts (file_mtime (pt.path ()));
- pt.mtime (ts);
-
- if (ts != timestamp_nonexistent)
+ timestamp ts (pt.mtime ());
+
+ if (ts == timestamp_unknown)
+ {
+ // Assign the path. While normally we shouldn't do this in match(),
+ // no other rule should ever be ambiguous with the fallback one.
+ //
+ if (pt.path ().empty ())
+ {
+ pt.derive_path ();
+ ts = pt.mtime ();
+ }
+ }
+
+ if (ts != timestamp_unknown && ts != timestamp_nonexistent)
return t;
l4 ([&]{trace << "no existing file for target " << t;});