aboutsummaryrefslogtreecommitdiff
path: root/build2/cxx/compile.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-03-09 11:06:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-03-09 11:06:26 +0200
commit51267fc81abdbf0ca7f1098fccd7f3e0d7da5306 (patch)
tree3dd4f7216a49064e2ba9a9eee5c0133749b35fe1 /build2/cxx/compile.cxx
parenta18191ff73781a92605762f3f409b9f6783d3ce8 (diff)
Force creation of output directory before opening depdb
Diffstat (limited to 'build2/cxx/compile.cxx')
-rw-r--r--build2/cxx/compile.cxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx
index 015d538..2d42cbc 100644
--- a/build2/cxx/compile.cxx
+++ b/build2/cxx/compile.cxx
@@ -77,7 +77,7 @@ namespace build2
// Inject dependency on the output directory.
//
- inject_parent_fsdir (a, t);
+ fsdir* dir (inject_parent_fsdir (a, t));
// Search and match all the existing prerequisites. The injection
// code (below) takes care of the ones it is adding.
@@ -143,6 +143,20 @@ namespace build2
dynamic_cast<cxx&> (
mr.target != nullptr ? *mr.target : *mr.prerequisite->target));
+ // Make sure the output directory exists.
+ //
+ // Is this the right thing to do? It does smell a bit, but then we do
+ // worse things in inject_prerequisites() below. There is also no way
+ // to postpone this until update since we need to extract and inject
+ // header dependencies now (we don't want to be calling search() and
+ // match() in update), which means we need to cache them now as well.
+ // So the only alternative, it seems, is to cache the updates to the
+ // database until later which will sure complicate (and slow down)
+ // things.
+ //
+ if (dir != nullptr)
+ execute_direct (a, *dir);
+
depdb dd (t.path () + ".d");
// First should come the rule name/version.