From 51267fc81abdbf0ca7f1098fccd7f3e0d7da5306 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 9 Mar 2016 11:06:26 +0200 Subject: Force creation of output directory before opening depdb --- build2/cxx/compile.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'build2/cxx/compile.cxx') 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 ( 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. -- cgit v1.1