aboutsummaryrefslogtreecommitdiff
path: root/build2/cxx/compile.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/cxx/compile.cxx')
-rw-r--r--build2/cxx/compile.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx
index b15944c..10d80db 100644
--- a/build2/cxx/compile.cxx
+++ b/build2/cxx/compile.cxx
@@ -651,15 +651,6 @@ namespace build2
l6 ([&]{trace << "injecting " << f;});
- // Verify/add it to the dependency database.
- //
- if (!cache)
- {
- string* dl (dd.read ());
- if (dl == nullptr || *dl != f.string ())
- dd.write (f);
- }
-
// Split the name into its directory part, the name part, and
// extension. Here we can assume the name part is a valid filesystem
// name.
@@ -719,6 +710,13 @@ namespace build2
//
bool restart (update (pt, cache ? dd.mtime () : timestamp_unknown));
+ // Verify/add it to the dependency database. We do it after update in
+ // order not to add bogus files (non-existent and without a way to
+ // update).
+ //
+ if (!cache)
+ dd.expect (pt.path ());
+
// Add to our prerequisite target list.
//
t.prerequisite_targets.push_back (&pt);