From 306ab0a69a6ea105f5820eb9a7113757f5e47655 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 6 Aug 2017 12:21:27 +0200 Subject: Create output directory for module sidebuilds The fsdir{} injection doesn't do it if out == src. --- build2/cc/compile.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'build2') diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index 5f48492..dad53ff 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -3570,13 +3570,22 @@ namespace build2 // if (const target* bt = targets.find ( *tt, - move (md), + md, dir_path (), // Always in the out tree. - move (mf), + mf, nullopt, // Use default extension. trace)) return *bt; + // Make sure the output directory exists. This is not strictly necessary + // if out != src since inject_fsdir() will take case of it. For out == + // src we initially tried to add an explicit fsdir{} preprequisite but + // that didn't work out since this is a nested directory. So now we keep + // it simple and just create it. The proper way to handle this as well + // as cleanup is probably at the cxx module level, which is @@ TODO. + // + mkdir_p (md, 3); + prerequisites ps; ps.push_back (prerequisite (mt)); @@ -3609,8 +3618,8 @@ namespace build2 trace)); const target& bt (p.first); - // Note that this racy and someone might have created this target - // while we were preparing the prerequisite list. + // Note that this racy and someone might have created this target while + // we were preparing the prerequisite list. // if (p.second.owns_lock ()) bt.prerequisites (move (ps)); -- cgit v1.1