diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-03-25 14:48:36 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-03-25 14:48:36 +0200 |
commit | cd75e06a87aa74aa6968113107afa53d401d20bc (patch) | |
tree | 1e104829d10f375a783d6efbbf7eef3e2c6d2ef5 /build/cxx | |
parent | a94dcda7f00b10cb22b5f2138b1c29bcfbe7de37 (diff) |
Configure/disfigure src_root saving/removing support; fsdir{} injection
We can now build out-of-tree.
Diffstat (limited to 'build/cxx')
-rw-r--r-- | build/cxx/rule.cxx | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/build/cxx/rule.cxx b/build/cxx/rule.cxx index 649067e..f53dd3b 100644 --- a/build/cxx/rule.cxx +++ b/build/cxx/rule.cxx @@ -74,15 +74,20 @@ namespace build // switch (a.operation ()) { + case default_id: case update_id: search_and_match (a, t); break; case clean_id: search_and_match (a, t, t.dir); break; default: assert (false); } + // Inject dependency on the output directory. + // + inject_parent_fsdir (a, t); + // Inject additional prerequisites. For now we only do it for - // update. + // update and default. // - if (a.operation () == update_id) + if (a.operation () == update_id || a.operation () == default_id) { auto& sp (*static_cast<prerequisite*> (v)); auto& st (dynamic_cast<cxx&> (*sp.target)); @@ -95,7 +100,7 @@ namespace build { case perform_update_id: return &perform_update; case perform_clean_id: return &perform_clean_file; - default: return noop_recipe; + default: return default_recipe; // Forward to prerequisites. } } @@ -366,7 +371,7 @@ namespace build if (!seen_obj) seen_obj = true; } - else + else if (p.type.id != typeid (fsdir)) { level3 ([&]{trace << "unexpected prerequisite type " << p.type;}); return nullptr; @@ -547,11 +552,15 @@ namespace build pr = op; } + // Inject dependency on the output directory. + // + inject_parent_fsdir (a, t); + switch (a) { case perform_update_id: return &perform_update; case perform_clean_id: return &perform_clean_file; - default: return noop_recipe; + default: return default_recipe; // Forward to prerequisites. } } @@ -580,9 +589,11 @@ namespace build for (const prerequisite& p: t.prerequisites) { - const obj& o (dynamic_cast<const obj&> (*p.target)); - ro.push_back (relative_work (o.path ())); - args.push_back (ro.back ().string ().c_str ()); + if (const obj* o = dynamic_cast<const obj*> (p.target)) + { + ro.push_back (relative_work (o->path ())); + args.push_back (ro.back ().string ().c_str ()); + } } args.push_back (nullptr); |