summaryrefslogtreecommitdiffstats
path: root/src/ninja.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-05-01 02:50:49 (GMT)
committerEvan Martin <martine@danga.com>2011-05-01 02:52:02 (GMT)
commit4629f032b1580c67ede3ef879e72293e56f0010c (patch)
tree8236e4f881755a0df3f3b2585366e314bfdcba44 /src/ninja.cc
parent5c7ac5c72d986570766db0ce9b9a9714ff8a4032 (diff)
downloadNinja-4629f032b1580c67ede3ef879e72293e56f0010c.zip
Ninja-4629f032b1580c67ede3ef879e72293e56f0010c.tar.gz
Ninja-4629f032b1580c67ede3ef879e72293e56f0010c.tar.bz2
use refactored function to support implicit "all" target
Diffstat (limited to 'src/ninja.cc')
-rw-r--r--src/ninja.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/ninja.cc b/src/ninja.cc
index 96530f6..43b19ea 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -374,11 +374,6 @@ int main(int argc, char** argv) {
return 1;
}
}
- if (optind >= argc && tool.empty()) {
- Error("expected target to build");
- usage(config);
- return 1;
- }
argv += optind;
argc -= optind;
@@ -440,14 +435,15 @@ int main(int argc, char** argv) {
return 1;
}
- Builder builder(&state, config);
- for (int i = 0; i < argc; ++i) {
- string path = argv[i];
- string err;
- if (!CanonicalizePath(&path, &err))
- Fatal("can't canonicalize '%s': %s", path.c_str(), err.c_str());
+ vector<Node*> targets;
+ if (!CollectTargetsFromArgs(&state, argc, argv, &targets, &err)) {
+ Error("%s", err.c_str());
+ return 1;
+ }
- if (!builder.AddTarget(path, &err)) {
+ Builder builder(&state, config);
+ for (size_t i = 0; i < targets.size(); ++i) {
+ if (!builder.AddTarget(targets[i], &err)) {
if (!err.empty()) {
Error("%s", err.c_str());
return 1;