2015-07-17 02:27:52 +02:00
|
|
|
KATI ?= $(HOST_OUT_EXECUTABLES)/ckati
|
|
|
|
|
2015-09-01 07:24:18 +02:00
|
|
|
KATI_OUTPUT_PATTERNS := $(PRODUCT_OUT)/build%.ninja $(PRODUCT_OUT)/ninja%.sh
|
2015-07-17 02:27:52 +02:00
|
|
|
NINJA_GOALS := fastincremental generateonly droid showcommands
|
2015-09-04 07:38:37 +02:00
|
|
|
# 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
|
2015-07-17 02:27:52 +02:00
|
|
|
|
2015-09-01 07:24:18 +02:00
|
|
|
ANDROID_TARGETS := $(filter-out $(KATI_OUTPUT_PATTERNS) $(NINJA_GOALS),$(ORIGINAL_MAKECMDGOALS))
|
2015-09-04 07:38:37 +02:00
|
|
|
KATI_TARGETS := $(if $(filter $(PARSE_TIME_MAKE_GOALS),$(ANDROID_TARGETS)),$(ANDROID_TARGETS),)
|
2015-09-01 07:24:18 +02:00
|
|
|
|
2015-09-04 04:41:33 +02:00
|
|
|
define replace_space_and_slash
|
|
|
|
$(subst /,_,$(subst $(space),_,$(sort $1)))
|
|
|
|
endef
|
|
|
|
|
2015-09-01 07:24:18 +02:00
|
|
|
KATI_NINJA_SUFFIX :=
|
2015-09-04 07:38:37 +02:00
|
|
|
ifneq ($(KATI_TARGETS),)
|
|
|
|
KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-$(call replace_space_and_slash,$(KATI_TARGETS))
|
2015-09-01 07:24:18 +02:00
|
|
|
endif
|
|
|
|
ifneq ($(ONE_SHOT_MAKEFILE),)
|
2015-09-04 04:41:33 +02:00
|
|
|
KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-mmm-$(call replace_space_and_slash,$(ONE_SHOT_MAKEFILE))
|
|
|
|
endif
|
|
|
|
ifneq ($(BUILD_MODULES_IN_PATHS),)
|
|
|
|
KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-mmma-$(call replace_space_and_slash,$(BUILD_MODULES_IN_PATHS))
|
2015-09-01 07:24:18 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
KATI_BUILD_NINJA := $(PRODUCT_OUT)/build$(KATI_NINJA_SUFFIX).ninja
|
|
|
|
KATI_NINJA_SH := $(PRODUCT_OUT)/ninja$(KATI_NINJA_SUFFIX).sh
|
|
|
|
KATI_OUTPUTS := $(KATI_BUILD_NINJA) $(KATI_NINJA_SH)
|
2015-07-17 02:27:52 +02:00
|
|
|
|
|
|
|
ifeq (,$(NINJA_STATUS))
|
|
|
|
NINJA_STATUS := [%p %s/%t]$(space)
|
|
|
|
endif
|
|
|
|
|
2015-07-29 02:57:45 +02:00
|
|
|
ifneq (,$(filter showcommands,$(ORIGINAL_MAKECMDGOALS)))
|
2015-07-17 02:27:52 +02:00
|
|
|
NINJA_ARGS += "-v"
|
|
|
|
PHONY: showcommands
|
|
|
|
showcommands: droid
|
|
|
|
endif
|
|
|
|
|
2015-07-29 02:57:45 +02:00
|
|
|
ifeq (,$(filter generateonly,$(ORIGINAL_MAKECMDGOALS)))
|
2015-07-17 02:27:52 +02:00
|
|
|
fastincremental droid $(ANDROID_TARGETS): ninja.intermediate
|
|
|
|
@#empty
|
|
|
|
|
|
|
|
.INTERMEDIATE: ninja.intermediate
|
|
|
|
ninja.intermediate: $(KATI_OUTPUTS)
|
|
|
|
@echo Starting build with ninja
|
2015-09-01 07:24:18 +02:00
|
|
|
$(hide) PATH=prebuilts/ninja/$(HOST_PREBUILT_TAG)/:$$PATH NINJA_STATUS="$(NINJA_STATUS)" $(KATI_NINJA_SH) -C $(TOP) $(NINJA_ARGS) $(ANDROID_TARGETS)
|
2015-07-17 02:27:52 +02:00
|
|
|
else
|
|
|
|
generateonly droid $(ANDROID_TARGETS): $(KATI_OUTPUTS)
|
|
|
|
@#empty
|
|
|
|
endif
|
|
|
|
|
2015-07-29 02:57:45 +02:00
|
|
|
ifeq (,$(filter fastincremental,$(ORIGINAL_MAKECMDGOALS)))
|
2015-07-17 02:27:52 +02:00
|
|
|
KATI_FORCE := FORCE
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(KATI_OUTPUTS): kati.intermediate $(KATI_FORCE)
|
|
|
|
|
|
|
|
.INTERMEDIATE: kati.intermediate
|
|
|
|
kati.intermediate: $(KATI)
|
2015-09-01 07:24:18 +02:00
|
|
|
@echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja...
|
2015-07-17 02:27:52 +02:00
|
|
|
@#TODO: use separate ninja file for mm or single target build
|
2015-09-04 07:38:37 +02:00
|
|
|
$(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
|
2015-07-17 02:27:52 +02:00
|
|
|
|
|
|
|
KATI_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CPPFLAGS)
|
|
|
|
KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS)
|
2015-08-04 03:15:43 +02:00
|
|
|
# Build static ckati. Unfortunately Mac OS X doesn't officially support static exectuables.
|
|
|
|
ifeq ($(BUILD_OS),linux)
|
|
|
|
KATI_LD += -static
|
|
|
|
endif
|
|
|
|
|
2015-07-17 02:27:52 +02:00
|
|
|
KATI_INTERMEDIATES_PATH := $(HOST_OUT_INTERMEDIATES)/EXECUTABLES/ckati_intermediates
|
|
|
|
KATI_BIN_PATH := $(HOST_OUT_EXECUTABLES)
|
|
|
|
include build/kati/Makefile.ckati
|
|
|
|
|
|
|
|
.PHONY: FORCE
|
|
|
|
FORCE:
|