summaryrefslogtreecommitdiffstats
path: root/src/ninja.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2010-12-13 16:36:57 (GMT)
committerEvan Martin <martine@danga.com>2010-12-13 16:37:05 (GMT)
commit07171dd9d7aaa28580827b40203364862c2c0968 (patch)
tree6e2b42fd9dc55a3d521e347c574c34a4136370bc /src/ninja.cc
parent76327856c43414940c210325858b35b5fea09360 (diff)
downloadNinja-07171dd9d7aaa28580827b40203364862c2c0968.zip
Ninja-07171dd9d7aaa28580827b40203364862c2c0968.tar.gz
Ninja-07171dd9d7aaa28580827b40203364862c2c0968.tar.bz2
dry run flag
Diffstat (limited to 'src/ninja.cc')
-rw-r--r--src/ninja.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ninja.cc b/src/ninja.cc
index fab3f3a..0b2af68 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -20,6 +20,7 @@ void usage() {
"options:\n"
" -g output graphviz dot file for targets and exit\n"
" -i FILE specify input build file [default=build.ninja]\n"
+" -n dry run (don't run commands but pretend they succeeded)\n"
" -v show all command lines\n"
);
}
@@ -34,8 +35,8 @@ int main(int argc, char** argv) {
const char* input_file = "build.ninja";
int opt;
- bool graph = false, verbose = false;
- while ((opt = getopt_long(argc, argv, "ghi:v", options, NULL)) != -1) {
+ bool dry_run = false, graph = false, verbose = false;
+ while ((opt = getopt_long(argc, argv, "ghi:nv", options, NULL)) != -1) {
switch (opt) {
case 'g':
graph = true;
@@ -43,6 +44,9 @@ int main(int argc, char** argv) {
case 'i':
input_file = optarg;
break;
+ case 'n':
+ dry_run = true;
+ break;
case 'v':
verbose = true;
break;
@@ -87,6 +91,7 @@ int main(int argc, char** argv) {
Builder builder(&state);
builder.SetVerbose(verbose);
+ builder.SetDryRun(dry_run);
for (int i = 0; i < argc; ++i) {
if (!builder.AddTarget(argv[i], &err)) {
if (!err.empty()) {