Make it possible to change the number of remote jobs
User can overwrite NINJA_REMOTE_NUM_JOBS for this purpose. The
number is passed to ninja instead of to kati so no we don't
need to regenerate a ninja file when a user changes this value.
Change-Id: I2ccfaaae4492d84a8b8045dff612cb5f6ebe2c79
diff --git a/core/goma.mk b/core/goma.mk
index 7fc6c46..a876a10 100644
--- a/core/goma.mk
+++ b/core/goma.mk
@@ -52,11 +52,6 @@
CC_WRAPPER := $(strip $(CC_WRAPPER) $(goma_cc))
CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(goma_cc))
- # Ninja file generated by kati uses this for remote jobs (i.e.,
- # commands which contain gomacc). Note the parallelism of all other
- # jobs will be limited the number of cores.
- KATI_REMOTE_NUM_JOBS_FLAG := --remote_num_jobs=500
-
# gomacc can start goma client's daemon process automatically, but
# it is safer and faster to start up it beforehand. We run this as a
# background process so this won't slow down the build.
diff --git a/core/ninja.mk b/core/ninja.mk
index c469e02..a800cc1 100644
--- a/core/ninja.mk
+++ b/core/ninja.mk
@@ -105,8 +105,13 @@
showcommands: droid
endif
-ifdef KATI_REMOTE_NUM_JOBS_FLAG
+ifdef USE_GOMA
KATI_MAKEPARALLEL := $(MAKEPARALLEL)
+# Ninja runs remote jobs (i.e., commands which contain gomacc) with
+# this parallelism. Note the parallelism of all other jobs is still
+# limited by the -j flag passed to GNU make.
+NINJA_REMOTE_NUM_JOBS ?= 500
+NINJA_ARGS += -j$(NINJA_REMOTE_NUM_JOBS)
else
NINJA_MAKEPARALLEL := $(MAKEPARALLEL) --ninja
endif
@@ -133,7 +138,7 @@
.INTERMEDIATE: kati.intermediate
kati.intermediate: $(KATI) $(MAKEPARALLEL)
@echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja...
- +$(hide) $(KATI_MAKEPARALLEL) $(KATI) --ninja --ninja_dir=$(PRODUCT_OUT) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo --use_find_emulator $(KATI_REMOTE_NUM_JOBS_FLAG) -f build/core/main.mk $(or $(KATI_TARGETS),--gen_all_phony_targets) USE_NINJA=false
+ +$(hide) $(KATI_MAKEPARALLEL) $(KATI) --ninja --ninja_dir=$(PRODUCT_OUT) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo --use_find_emulator -f build/core/main.mk $(or $(KATI_TARGETS),--gen_all_phony_targets) USE_NINJA=false
KATI_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS)
KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS)