diff --git a/core/ninja.mk b/core/ninja.mk index 667cfa15a..3013a5fd9 100644 --- a/core/ninja.mk +++ b/core/ninja.mk @@ -1,8 +1,6 @@ NINJA ?= prebuilts/ninja/$(HOST_PREBUILT_TAG)/ninja -ifeq ($(USE_SOONG),true) include $(BUILD_SYSTEM)/soong.mk -endif KATI_OUTPUT_PATTERNS := $(OUT_DIR)/build%.ninja $(OUT_DIR)/ninja%.sh @@ -128,7 +126,7 @@ endif ifeq ($(USE_SOONG),true) COMBINED_BUILD_NINJA := $(OUT_DIR)/combined$(KATI_NINJA_SUFFIX).ninja -$(COMBINED_BUILD_NINJA): $(KATI_BUILD_NINJA) $(SOONG_ANDROID_MK) +$(COMBINED_BUILD_NINJA): $(KATI_BUILD_NINJA) $(hide) echo "builddir = $(OUT_DIR)" > $(COMBINED_BUILD_NINJA) $(hide) echo "subninja $(SOONG_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA) $(hide) echo "subninja $(KATI_BUILD_NINJA)" >> $(COMBINED_BUILD_NINJA) @@ -148,7 +146,7 @@ KATI_FIND_EMULATOR := --use_find_emulator ifeq ($(KATI_EMULATE_FIND),false) KATI_FIND_EMULATOR := endif -$(KATI_BUILD_NINJA): $(CKATI) $(MAKEPARALLEL) $(SOONG_ANDROID_MK) FORCE +$(KATI_BUILD_NINJA): $(CKATI) $(MAKEPARALLEL) run_soong FORCE @echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja... +$(hide) $(KATI_MAKEPARALLEL) $(CKATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --no_ignore_dirty=$(SOONG_ANDROID_MK) --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo $(KATI_FIND_EMULATOR) -f build/core/main.mk $(KATI_GOALS) --gen_all_targets BUILDING_WITH_NINJA=true SOONG_ANDROID_MK=$(SOONG_ANDROID_MK) diff --git a/core/soong.mk b/core/soong.mk index 13f85d367..4893add9a 100644 --- a/core/soong.mk +++ b/core/soong.mk @@ -16,10 +16,15 @@ endif SOONG := $(SOONG_OUT_DIR)/soong SOONG_BUILD_NINJA := $(SOONG_OUT_DIR)/build.ninja -SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android.mk SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.variables SOONG_IN_MAKE := $(SOONG_OUT_DIR)/.soong.in_make +# Only include the Soong-generated Android.mk if we're merging the +# Soong-defined binaries with Kati-defined binaries. +ifeq ($(USE_SOONG),true) +SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android.mk +endif + # Bootstrap soong. Run only the first time for clean builds $(SOONG): $(hide) mkdir -p $(dir $@) @@ -68,6 +73,8 @@ $(SOONG_IN_MAKE): $(hide) mkdir -p $(dir $@) $(hide) touch $@ -# Build an Android.mk listing all soong outputs as prebuilts -$(SOONG_ANDROID_MK): $(SOONG) $(SOONG_VARIABLES) $(SOONG_IN_MAKE) FORCE +# Run Soong, this implicitly create an Android.mk listing all soong outputs as +# prebuilts. +.PHONY: run_soong +run_soong: $(SOONG) $(SOONG_VARIABLES) $(SOONG_IN_MAKE) FORCE $(hide) $(SOONG) $(SOONG_BUILD_NINJA) $(NINJA_ARGS)