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
This commit is contained in:
Colin Cross 2015-09-28 15:36:05 -07:00
parent aa0aca69cf
commit fe5e6894d2
2 changed files with 11 additions and 4 deletions

View File

@ -95,12 +95,19 @@ include $(BUILD_SYSTEM)/help.mk
# and host information. # and host information.
include $(BUILD_SYSTEM)/config.mk include $(BUILD_SYSTEM)/config.mk
relaunch_with_ninja :=
ifneq ($(USE_NINJA),false) 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. # Mark this is a ninja build.
$(shell mkdir -p $(OUT_DIR) && touch $(OUT_DIR)/ninja_build) $(shell mkdir -p $(OUT_DIR) && touch $(OUT_DIR)/ninja_build)
include build/core/ninja.mk include build/core/ninja.mk
else # !USE_NINJA else # !relaunch_with_ninja
ifeq ($(MAKELEVEL),0) ifndef BUILDING_WITH_NINJA
# Remove ninja build mark if it exists. # Remove ninja build mark if it exists.
$(shell rm -f $(OUT_DIR)/ninja_build) $(shell rm -f $(OUT_DIR)/ninja_build)
endif endif
@ -1066,4 +1073,4 @@ showcommands:
.PHONY: nothing .PHONY: nothing
nothing: nothing:
@echo Successfully read the makefiles. @echo Successfully read the makefiles.
endif # !USE_NINJA endif # !relaunch_with_ninja

View File

@ -136,7 +136,7 @@ $(KATI_OUTPUTS): kati.intermediate $(KATI_FORCE)
.INTERMEDIATE: kati.intermediate .INTERMEDIATE: kati.intermediate
kati.intermediate: $(KATI) $(MAKEPARALLEL) kati.intermediate: $(KATI) $(MAKEPARALLEL)
@echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja... @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_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS)
KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS) KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS)