This patch is courtesy of BLFS. --- ninja-1.9.0.old/src/ninja.cc +++ ninja-1.9.0/src/ninja.cc @@ -221,6 +221,11 @@ /// Choose a default value for the -j (parallelism) flag. int GuessParallelism() { + int j = 0; + char *jobs = getenv ("NINJAJOBS"); + if (jobs != NULL) j = atoi (jobs); + if (j > 0) return j; + switch (int processors = GetProcessorCount()) { case 0: case 1: