From fe5e6894d2b16b76347fdd115a4538cd35d559ec Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 28 Sep 2015 15:36:05 -0700 Subject: [PATCH] Set BUILDING_WITH_NINJA flag when parsing makefiles for ninja build Distinguish between parsing makefiles in make for a pre-ninja build, parsing makefiles in kati for a ninja build, and parsing makefiles in make for a non-ninja build by leaving USE_NINJA=true enabled for the kati pass but also setting BUILDING_WITH_NINJA. Change-Id: I63f1ce1efe08cd86fdf41f8051901f720b38cfaf --- core/main.mk | 13 ++++++++++--- core/ninja.mk | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/main.mk b/core/main.mk index 760a0545d..c2c234c47 100644 --- a/core/main.mk +++ b/core/main.mk @@ -95,12 +95,19 @@ include $(BUILD_SYSTEM)/help.mk # and host information. include $(BUILD_SYSTEM)/config.mk +relaunch_with_ninja := ifneq ($(USE_NINJA),false) +ifndef BUILDING_WITH_NINJA +relaunch_with_ninja := true +endif +endif + +ifeq ($(relaunch_with_ninja),true) # Mark this is a ninja build. $(shell mkdir -p $(OUT_DIR) && touch $(OUT_DIR)/ninja_build) include build/core/ninja.mk -else # !USE_NINJA -ifeq ($(MAKELEVEL),0) +else # !relaunch_with_ninja +ifndef BUILDING_WITH_NINJA # Remove ninja build mark if it exists. $(shell rm -f $(OUT_DIR)/ninja_build) endif @@ -1066,4 +1073,4 @@ showcommands: .PHONY: nothing nothing: @echo Successfully read the makefiles. -endif # !USE_NINJA +endif # !relaunch_with_ninja diff --git a/core/ninja.mk b/core/ninja.mk index 2d0af3461..b59062704 100644 --- a/core/ninja.mk +++ b/core/ninja.mk @@ -136,7 +136,7 @@ $(KATI_OUTPUTS): kati.intermediate $(KATI_FORCE) .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 -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) BUILDING_WITH_NINJA=true KATI_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS) KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS)