KATI_OUTPUT_PATTERNS := $(PRODUCT_OUT)/build%.ninja $(PRODUCT_OUT)/ninja%.sh
NINJA_GOALS := fastincremental generateonly droid showcommands
+# A list of goals which affect parsing of make.
+PARSE_TIME_MAKE_GOALS := \
+ $(PARSE_TIME_MAKE_GOALS) \
+ $(dont_bother_goals) \
+ %tests \
+ APP-% \
+ DUMP_% \
+ ECLIPSE-% \
+ PRODUCT-% \
+ boottarball-nodeps \
+ btnod \
+ build-art% \
+ build_kernel-nodeps \
+ checkbuild \
+ clean-oat% \
+ continuous_instrumentation_tests \
+ continuous_native_tests \
+ cts \
+ custom_images \
+ deps-license \
+ dicttool_aosp \
+ dist \
+ dump-products \
+ dumpvar-% \
+ eng \
+ fusion \
+ oem_image \
+ online-system-api-sdk-docs \
+ pdk \
+ platform \
+ platform-java \
+ product-graph \
+ samplecode \
+ sdk \
+ sdk_addon \
+ sdk_repo \
+ snod \
+ stnod \
+ systemimage-nodeps \
+ systemtarball-nodeps \
+ target-files-package \
+ test-art% \
+ user \
+ userdataimage \
+ userdebug \
+ valgrind-test-art% \
+ win_sdk \
+ winsdk-tools
+
+-include vendor/google/build/ninja_config.mk
ANDROID_TARGETS := $(filter-out $(KATI_OUTPUT_PATTERNS) $(NINJA_GOALS),$(ORIGINAL_MAKECMDGOALS))
+KATI_TARGETS := $(if $(filter $(PARSE_TIME_MAKE_GOALS),$(ANDROID_TARGETS)),$(ANDROID_TARGETS),)
define replace_space_and_slash
$(subst /,_,$(subst $(space),_,$(sort $1)))
endef
KATI_NINJA_SUFFIX :=
-ifneq ($(ANDROID_TARGETS),)
-KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-$(call replace_space_and_slash,$(ANDROID_TARGETS))
+ifneq ($(KATI_TARGETS),)
+KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-$(call replace_space_and_slash,$(KATI_TARGETS))
endif
ifneq ($(ONE_SHOT_MAKEFILE),)
KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-mmm-$(call replace_space_and_slash,$(ONE_SHOT_MAKEFILE))
kati.intermediate: $(KATI)
@echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja...
@#TODO: use separate ninja file for mm or single target build
- $(hide) $(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 $(ANDROID_TARGETS) USE_NINJA=false
+ $(hide) $(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
KATI_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CPPFLAGS)
KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS)