diff options
author | Dan Willemsen <dwillemsen@google.com> | 2018-09-26 14:10:40 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2018-09-26 14:50:56 -0700 |
commit | 64c31bddf88d45711b746e6b954e61609f2cf3c4 (patch) | |
tree | 4d1d30af3a32a0fdade07de28c1240ad0a4de9e4 | |
parent | 7660073645413f4e887d0822c3d401097b51eca6 (diff) | |
download | kati-64c31bddf88d45711b746e6b954e61609f2cf3c4.tar.gz |
Add --no_ninja_prelude
This argument will remove the common bits at the beginning of the ninja
file -- build_dir, local_pool, and _kati_always_build_. It's most useful
so that Kati can be run twice, with the output ninja files combined into
a single ninja execution.
It also lets us change the local_pool size without having to re-read all
the makefiles.
Change-Id: I38fef043ac2a9550d094550f5fb7f1789bc729dd
-rw-r--r-- | flags.cc | 2 | ||||
-rw-r--r-- | flags.h | 1 | ||||
-rw-r--r-- | ninja.cc | 14 |
3 files changed, 11 insertions, 6 deletions
@@ -102,6 +102,8 @@ void Flags::Parse(int argc, char** argv) { color_warnings = true; } else if (!strcmp(arg, "--no_builtin_rules")) { no_builtin_rules = true; + } else if (!strcmp(arg, "--no_ninja_prelude")) { + no_ninja_prelude = true; } else if (!strcmp(arg, "--werror_find_emulator")) { werror_find_emulator = true; } else if (!strcmp(arg, "--werror_overriding_commands")) { @@ -41,6 +41,7 @@ struct Flags { bool use_find_emulator; bool color_warnings; bool no_builtin_rules; + bool no_ninja_prelude; bool werror_find_emulator; bool werror_overriding_commands; bool warn_implicit_rules; @@ -600,14 +600,16 @@ class NinjaGenerator { fprintf(fp_, "\n"); } - if (g_flags.ninja_dir) { - fprintf(fp_, "builddir = %s\n\n", g_flags.ninja_dir); - } + if (!g_flags.no_ninja_prelude) { + if (g_flags.ninja_dir) { + fprintf(fp_, "builddir = %s\n\n", g_flags.ninja_dir); + } - fprintf(fp_, "pool local_pool\n"); - fprintf(fp_, " depth = %d\n\n", g_flags.num_jobs); + fprintf(fp_, "pool local_pool\n"); + fprintf(fp_, " depth = %d\n\n", g_flags.num_jobs); - fprintf(fp_, "build _kati_always_build_: phony\n\n"); + fprintf(fp_, "build _kati_always_build_: phony\n\n"); + } unique_ptr<ThreadPool> tp(NewThreadPool(g_flags.num_jobs)); CHECK(g_flags.num_jobs); |