Merge "Make it possible to change the number of remote jobs"
diff --git a/core/goma.mk b/core/goma.mk
index ff95d5a..e119829 100644
--- a/core/goma.mk
+++ b/core/goma.mk
@@ -53,11 +53,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 b9a0cec..ee72087 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)