From 233255f0e14f364841751755958375fe27380ba6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 14 Mar 2017 11:37:14 +0200 Subject: Implement implied buildfile support In essence, if the buildfile is: ./: */ Then it can be omitted entirely (provided there is at least one subdirectory). --- build2/operation.cxx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'build2/operation.cxx') diff --git a/build2/operation.cxx b/build2/operation.cxx index ff2051d..b821b1d 100644 --- a/build2/operation.cxx +++ b/build2/operation.cxx @@ -60,25 +60,32 @@ namespace build2 auto i (scopes.rw (root).insert (out_base, false)); scope& base (setup_base (i, out_base, src_base)); - // Load the buildfile unless it has already been loaded. + // Load the buildfile unless it is implied. // - source_once (root, base, bf, root); + if (!bf.empty ()) + source_once (root, base, bf, root); } void search (const scope&, + const scope& bs, const target_key& tk, const location& l, action_targets& ts) { tracer trace ("search"); - phase_lock pl (run_phase::match); // Never switched. + phase_lock pl (run_phase::match); - if (const target* t = targets.find (tk, trace)) - ts.push_back (t); - else + const target* t (targets.find (tk, trace)); + + if (t == nullptr && tk.is_a ()) + t = dir::search_implied (bs, tk, trace); + + if (t == nullptr) fail (l) << "unknown target " << tk; + + ts.push_back (t); } void -- cgit v1.1