diff options
author | Martell Malone <martellmalone@gmail.com> | 2018-11-14 12:46:53 (GMT) |
---|---|---|
committer | Jan Niklas Hasse <jhasse@bixense.com> | 2018-11-14 12:46:53 (GMT) |
commit | 378486ba6e5f15ebd86c76c330231319c2a6df59 (patch) | |
tree | 0baeded5399656f77893a840e1f1948944cb3971 /src/ninja.cc | |
parent | a65f0d42dc8820cc4d80561ddcd4b693c0adc892 (diff) | |
download | Ninja-378486ba6e5f15ebd86c76c330231319c2a6df59.zip Ninja-378486ba6e5f15ebd86c76c330231319c2a6df59.tar.gz Ninja-378486ba6e5f15ebd86c76c330231319c2a6df59.tar.bz2 |
Make -j 0 run unlimited parallel builds, fix #1309
Diffstat (limited to 'src/ninja.cc')
-rw-r--r-- | src/ninja.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ninja.cc b/src/ninja.cc index b919950..a6790e1 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -206,7 +206,7 @@ void Usage(const BuildConfig& config) { " -C DIR change to DIR before doing anything else\n" " -f FILE specify input build file [default=build.ninja]\n" "\n" -" -j N run N jobs in parallel [default=%d, derived from CPUs available]\n" +" -j N run N jobs in parallel (0 means infinity) [default=%d, derived from CPUs available]\n" " -k N keep going until N jobs fail (0 means infinity) [default=1]\n" " -l N do not start new jobs if the load average is greater than N\n" " -n dry run (don't run commands but act like they succeeded)\n" @@ -1121,9 +1121,12 @@ int ReadFlags(int* argc, char*** argv, case 'j': { char* end; int value = strtol(optarg, &end, 10); - if (*end != 0 || value <= 0) + if (*end != 0 || value < 0) Fatal("invalid -j parameter"); - config->parallelism = value; + + // We want to run N jobs in parallel. For N = 0, INT_MAX + // is close enough to infinite for most sane builds. + config->parallelism = value > 0 ? value : INT_MAX; break; } case 'k': { |