aboutsummaryrefslogtreecommitdiff
path: root/build2/operation.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-03-14 11:37:14 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-03-14 11:37:14 +0200
commit233255f0e14f364841751755958375fe27380ba6 (patch)
tree1571f125ad89f729cbf0c3d7c0b09aba8fe0fc20 /build2/operation.cxx
parentf262632b20628136369889ebc67a65b252b233af (diff)
Implement implied buildfile support
In essence, if the buildfile is: ./: */ Then it can be omitted entirely (provided there is at least one subdirectory).
Diffstat (limited to 'build2/operation.cxx')
-rw-r--r--build2/operation.cxx19
1 files changed, 13 insertions, 6 deletions
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<dir> ())
+ t = dir::search_implied (bs, tk, trace);
+
+ if (t == nullptr)
fail (l) << "unknown target " << tk;
+
+ ts.push_back (t);
}
void