Merge "Revert "Only put PARSE_TIME_MAKE_GOALS into KATI_TARGETS""
diff --git a/core/Makefile b/core/Makefile
index dfacf28..0f200f9 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1292,6 +1292,30 @@
# -----------------------------------------------------------------
# host tools needed to build dist and OTA packages
+build_ota_package := true
+ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
+build_ota_package := false
+endif
+ifeq ($(BUILD_OS),darwin)
+build_ota_package := false
+endif
+ifneq ($(strip $(SANITIZE_TARGET)),)
+build_ota_package := false
+endif
+ifeq ($(TARGET_PRODUCT),sdk)
+build_ota_package := false
+endif
+ifneq ($(filter generic%,$(TARGET_DEVICE)),)
+build_ota_package := false
+endif
+ifeq ($(TARGET_NO_KERNEL),true)
+build_ota_package := false
+endif
+ifeq ($(recovery_fstab),)
+build_ota_package := false
+endif
+
+ifeq ($(build_ota_package),true)
OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
$(HOST_OUT_EXECUTABLES)/aapt \
$(HOST_OUT_EXECUTABLES)/mkbootfs \
@@ -1350,6 +1374,7 @@
.PHONY: otatools-package
otatools-package: $(BUILT_OTATOOLS_PACKAGE)
+endif # build_ota_package
# -----------------------------------------------------------------
# A zip of the directories that map to the target filesystem.
@@ -1561,26 +1586,6 @@
$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
endif
-build_ota_package := true
-ifeq ($(BUILD_OS),darwin)
-build_ota_package := false
-endif
-ifneq ($(strip $(SANITIZE_TARGET)),)
-build_ota_package := false
-endif
-ifeq ($(TARGET_PRODUCT),sdk)
-build_ota_package := false
-endif
-ifneq ($(filter generic%,$(TARGET_DEVICE)),)
-build_ota_package := false
-endif
-ifeq ($(TARGET_NO_KERNEL),true)
-build_ota_package := false
-endif
-ifeq ($(recovery_fstab),)
-build_ota_package := false
-endif
-
ifeq ($(build_ota_package),true)
# -----------------------------------------------------------------
# OTA update package
diff --git a/core/binary.mk b/core/binary.mk
index 093cc38..38fcacc 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -412,6 +412,19 @@
endif
endif
+# Target modules shouldn't re-export libgcc.a because we don't want other
+# binaries importing them when they should be getting their own copy of the
+# builtins.
+#
+# Unfortunately --exclude-libs always overrides all other attempts to make a
+# symbol visible, and libc needs to make sure some of these symbols are
+# available for binary compatibility, so libc needs a way to disable this.
+ifndef LOCAL_IS_HOST_MODULE
+ ifneq ($(strip $(LOCAL_NO_EXCLUDE_LIBS)),true)
+ my_ldflags += -Wl,--exclude-libs,libgcc.a
+ endif
+endif
+
ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES))
$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true
else
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index d0d4ff9..649fbe5 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -190,6 +190,7 @@
LOCAL_DBUS_PROXY_PREFIX:=
LOCAL_INIT_RC:=
LOCAL_MODULE_HOST_OS:=
+LOCAL_NO_EXCLUDE_LIBS:=
# arch specific variables
LOCAL_SRC_FILES_$(TARGET_ARCH):=
diff --git a/core/config.mk b/core/config.mk
index e7a1d20..dd0dfc2 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -23,6 +23,10 @@
endef
+# The pound character "#"
+define pound
+#
+endef
# Unfortunately you can't simply define backslash as \ or \\.
backslash := \a
backslash := $(patsubst %a,%,$(backslash))
diff --git a/core/ninja.mk b/core/ninja.mk
index 56b4ac5..2aa0b28 100644
--- a/core/ninja.mk
+++ b/core/ninja.mk
@@ -73,8 +73,26 @@
KATI_NINJA_SUFFIX := $(KATI_NINJA_SUFFIX)-mmma-$(call replace_space_and_slash,$(BUILD_MODULES_IN_PATHS))
endif
+my_checksum_suffix :=
+ifneq ($(KATI_NINJA_SUFFIX),)
+my_ninja_suffix_too_long := $(filter 1, $(shell v='$(KATI_NINJA_SUFFIX)' && echo $$(($${$(pound)v} > 64))))
+ifneq ($(my_ninja_suffix_too_long),)
+# Replace the suffix with a checksum if it gets too long.
+my_checksum_suffix := $(KATI_NINJA_SUFFIX)
+KATI_NINJA_SUFFIX := -$(word 1, $(shell echo $(my_checksum_suffix) | $(MD5SUM)))
+endif
+endif
+
KATI_BUILD_NINJA := $(PRODUCT_OUT)/build$(KATI_NINJA_SUFFIX).ninja
KATI_NINJA_SH := $(PRODUCT_OUT)/ninja$(KATI_NINJA_SUFFIX).sh
+
+# Write out a file mapping checksum to the real suffix.
+ifneq ($(my_checksum_suffix),)
+my_ninja_suffix_file := $(basename $(KATI_BUILD_NINJA)).suf
+$(shell mkdir -p $(dir $(my_ninja_suffix_file)) && \
+ echo $(my_checksum_suffix) > $(my_ninja_suffix_file))
+endif
+
KATI_OUTPUTS := $(KATI_BUILD_NINJA) $(KATI_NINJA_SH)
ifeq (,$(NINJA_STATUS))
@@ -115,7 +133,6 @@
.INTERMEDIATE: kati.intermediate
kati.intermediate: $(KATI) $(MAKEPARALLEL)
@echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja...
- @#TODO: use separate ninja file for mm or single target build
+$(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 $(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)
diff --git a/target/product/core_tiny.mk b/target/product/core_tiny.mk
index 39789d9..4abe386 100644
--- a/target/product/core_tiny.mk
+++ b/target/product/core_tiny.mk
@@ -56,6 +56,7 @@
iptables \
keystore \
keystore.default \
+ ld.mc \
libOpenMAXAL \
libOpenSLES \
libdownmix \