diff options
-rw-r--r-- | exec.cc | 2 | ||||
-rw-r--r-- | flags.cc | 2 | ||||
-rw-r--r-- | flags.h | 2 | ||||
-rw-r--r-- | main.cc | 8 |
4 files changed, 10 insertions, 4 deletions
@@ -161,7 +161,7 @@ class Executor { printf("%s\n", runner->cmd->c_str()); fflush(stdout); } - if (!g_is_syntax_check_only) { + if (!g_is_dry_run) { int result = system(runner->cmd->c_str()); if (result != 0) { if (runner->ignore_error) { @@ -16,4 +16,4 @@ #include "flags.h" -bool g_is_syntax_check_only; +bool g_is_dry_run; @@ -15,6 +15,6 @@ #ifndef FLAGS_H_ #define FLAGS_H_ -extern bool g_is_syntax_check_only; +extern bool g_is_dry_run; #endif // FLAGS_H_ @@ -36,6 +36,7 @@ #include "var.h" static const char* g_makefile; +static bool g_is_syntax_check_only; static void ParseCommandLine(int argc, char* argv[], vector<StringPiece>* targets, @@ -46,6 +47,8 @@ static void ParseCommandLine(int argc, char* argv[], g_makefile = argv[++i]; } else if (!strcmp(arg, "-c")) { g_is_syntax_check_only = true; + } else if (!strcmp(arg, "-i")) { + g_is_dry_run = true; } else if (arg[0] == '-') { ERROR("Unknown flag: %s", arg); } else { @@ -179,6 +182,9 @@ static int Run(const vector<StringPiece>& targets, } } + if (g_is_syntax_check_only) + return 0; + Exec(nodes, ev); for (AST* ast : bootstrap_asts) @@ -187,7 +193,7 @@ static int Run(const vector<StringPiece>& targets, delete vars; delete cache_mgr; - return mk == 0; + return 0; } int main(int argc, char* argv[]) { |