From 17287b34a8090d381278c02b7bc6676669968099 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 3 Mar 2015 11:43:03 +0200 Subject: Implement new default target logic, canonical directory name (empty value) The logic is as follows: if we have an explicit current directory target, then that's the default target. Otherwise, we take the first target and use it as a prerequisite to create an implicit current directory target, effectively making it the default target via an alias. If there are no targets in this buildfile, then we don't do anything. --- build/b.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'build/b.cxx') diff --git a/build/b.cxx b/build/b.cxx index 659eb40..edefbe9 100644 --- a/build/b.cxx +++ b/build/b.cxx @@ -205,20 +205,21 @@ main (int argc, char* argv[]) // Build. // - if (default_target == nullptr) - fail << "no default target"; + auto i (targets.find (dir::static_type.id, out_base, "", nullptr, trace)); + if (i == targets.end ()) + fail << "no targets in " << bf; - target& d (*default_target); + target& t (**i); - match (d); + match (t); dump (); - switch (update (d)) + switch (update (t)) { case target_state::uptodate: { - info << "target " << d << " is up to date"; + info << "target " << t << " is up to date"; break; } case target_state::updated: -- cgit v1.1