Merge "Update pathmap.mk for renderscript support library migration"
diff --git a/core/Makefile b/core/Makefile
index de56176..358360b 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -386,7 +386,15 @@
endif
# -----------------------------------------------------------------
+# build system stats
+BUILD_SYSTEM_STATS := $(PRODUCT_OUT)/build_system_stats.txt
+$(BUILD_SYSTEM_STATS):
+ @rm -f $@
+ @$(foreach s,$(STATS.MODULE_TYPE),echo "modules_type_make,$(s),$(words $(STATS.MODULE_TYPE.$(s)))" >>$@;)
+ @$(foreach s,$(STATS.SOONG_MODULE_TYPE),echo "modules_type_soong,$(s),$(STATS.SOONG_MODULE_TYPE.$(s))" >>$@;)
+$(call dist-for-goals,droidcore,$(BUILD_SYSTEM_STATS))
+# -----------------------------------------------------------------
# The dev key is used to sign this package, and as the key required
# for future OTA packages installed by this system. Actual product
# deliverables will be re-signed by hand. We expect this file to
diff --git a/core/aux_config.mk b/core/aux_config.mk
new file mode 100644
index 0000000..decff34
--- /dev/null
+++ b/core/aux_config.mk
@@ -0,0 +1,183 @@
+variant_list := $(filter AUX-%,$(MAKECMDGOALS))
+
+ifdef variant_list
+AUX_OS_VARIANT_LIST := $(patsubst AUX-%,%,$(variant_list))
+else
+AUX_OS_VARIANT_LIST := $(TARGET_AUX_OS_VARIANT_LIST)
+endif
+
+# exclude AUX targets from build
+ifeq ($(AUX_OS_VARIANT_LIST),none)
+AUX_OS_VARIANT_LIST :=
+endif
+
+# temporary workaround to support external toolchain
+ifeq ($(NANOHUB_TOOLCHAIN),)
+AUX_OS_VARIANT_LIST :=
+endif
+
+# setup toolchain paths for various CPU architectures
+# this one will come from android prebuilts eventually
+AUX_TOOLCHAIN_cortexm4 := $(NANOHUB_TOOLCHAIN)
+ifeq ($(wildcard $(AUX_TOOLCHAIN_cortexm4)gcc),)
+AUX_TOOLCHAIN_cortexm4:=
+endif
+
+# there is no MAKE var that defines path to HOST toolchain
+# all the interesting paths are hardcoded in soong, and are not available from here
+# There is no other way but to hardcode them again, as we may need host x86 toolcain for AUX
+ifeq ($(HOST_OS),linux)
+AUX_TOOLCHAIN_x86 := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/bin/x86_64-linux-
+endif
+
+# setup AUX globals
+AUX_SHLIB_SUFFIX := .so
+AUX_GLOBAL_ARFLAGS := crsPD
+AUX_STATIC_LIB_SUFFIX := .a
+
+# Load ever-lasting "indexed" version of AUX variant environment; it is treated as READ-ONLY from this
+# moment on.
+#
+# $(1) - variant
+# no return value
+define aux-variant-setup-paths
+$(eval AUX_OUT_ROOT_$(1) := $(PRODUCT_OUT)/aux/$(1)) \
+$(eval AUX_COMMON_OUT_ROOT_$(1) := $(AUX_OUT_ROOT_$(1))/common) \
+$(eval AUX_OUT_$(1) := $(AUX_OUT_ROOT_$(1))/$(AUX_OS_$(1))-$(AUX_ARCH_$(1))-$(AUX_CPU_$(1))) \
+$(eval AUX_OUT_INTERMEDIATES_$(1) := $(AUX_OUT_$(1))/obj) \
+$(eval AUX_OUT_COMMON_INTERMEDIATES_$(1) := $(AUX_COMMON_OUT_ROOT_$(1))/obj) \
+$(eval AUX_OUT_HEADERS_$(1) := $(AUX_OUT_INTERMEDIATES_$(1))/include) \
+$(eval AUX_OUT_INTERMEDIATE_LIBRARIES_$(1) := $(AUX_OUT_INTERMEDIATES_$(1))/lib) \
+$(eval AUX_OUT_NOTICE_FILES_$(1) := $(AUX_OUT_INTERMEDIATES_$(1))/NOTICE_FILES) \
+$(eval AUX_OUT_FAKE_$(1) := $(AUX_OUT_$(1))/fake_packages) \
+$(eval AUX_OUT_GEN_$(1) := $(AUX_OUT_$(1))/gen) \
+$(eval AUX_OUT_COMMON_GEN_$(1) := $(AUX_COMMON_OUT_ROOT_$(1))/gen) \
+$(eval AUX_OUT_EXECUTABLES_$(1) := $(AUX_OUT_$(1))/bin) \
+$(eval AUX_OUT_UNSTRIPPED_$(1) := $(AUX_OUT_$(1))/symbols)
+endef
+
+# Copy "indexed" AUX environment for given VARIANT into
+# volatile not-indexed set of variables for simplicity of access.
+# Injection of index support throughout the build system is suboptimal
+# hence volatile environment is constructed
+# Unlike HOST*, TARGET* variables, AUX* variables are NOT read-only, but their
+# indexed versions are.
+#
+# $(1) - variant
+# no return value
+define aux-variant-load-env
+$(eval AUX_OS_VARIANT:=$(1)) \
+$(eval AUX_OS:=$(AUX_OS_$(1))) \
+$(eval AUX_ARCH:=$(AUX_ARCH_$(1))) \
+$(eval AUX_SUBARCH:=$(AUX_SUBARCH_$(1))) \
+$(eval AUX_CPU:=$(AUX_CPU_$(1))) \
+$(eval AUX_OS_PATH:=$(AUX_OS_PATH_$(1))) \
+$(eval AUX_OUT_ROOT := $(AUX_OUT_ROOT_$(1))) \
+$(eval AUX_COMMON_OUT_ROOT := $(AUX_COMMON_OUT_ROOT_$(1))) \
+$(eval AUX_OUT := $(AUX_OUT_$(1))) \
+$(eval AUX_OUT_INTERMEDIATES := $(AUX_OUT_INTERMEDIATES_$(1))) \
+$(eval AUX_OUT_COMMON_INTERMEDIATES := $(AUX_OUT_COMMON_INTERMEDIATES_$(1))) \
+$(eval AUX_OUT_HEADERS := $(AUX_OUT_HEADERS_$(1))) \
+$(eval AUX_OUT_INTERMEDIATE_LIBRARIES := $(AUX_OUT_INTERMEDIATE_LIBRARIES_$(1))) \
+$(eval AUX_OUT_NOTICE_FILES := $(AUX_OUT_NOTICE_FILES_$(1))) \
+$(eval AUX_OUT_FAKE := $(AUX_OUT_FAKE_$(1))) \
+$(eval AUX_OUT_GEN := $(AUX_OUT_GEN_$(1))) \
+$(eval AUX_OUT_COMMON_GEN := $(AUX_OUT_COMMON_GEN_$(1))) \
+$(eval AUX_OUT_EXECUTABLES := $(AUX_OUT_EXECUTABLES_$(1))) \
+$(eval AUX_OUT_UNSTRIPPED := $(AUX_OUT_UNSTRIPPED_$(1)))
+endef
+
+# given a variant:path pair, load the variant conviguration with aux-variant-setup-paths from file
+# this is a build system extension mechainsm, since configuration typically resides in non-build
+# project space
+#
+# $(1) - variant:path pair
+# $(2) - file suffix
+# no return value
+define aux-variant-import-from-pair
+$(eval _pair := $(subst :, ,$(1))) \
+$(eval _name:=$(word 1,$(_pair))) \
+$(eval _path:=$(word 2,$(_pair))) \
+$(eval include $(_path)/$(_name)$(2)) \
+$(eval AUX_OS_VARIANT_LIST_$(AUX_OS_$(1)):=) \
+$(call aux-variant-setup-paths,$(_name)) \
+$(eval AUX_ALL_VARIANTS += $(_name)) \
+$(eval AUX_ALL_OSES := $(filterout $(AUX_OS_$(_name)),$(AUX_ALL_OSES)) $(AUX_OS_$(_name))) \
+$(eval AUX_ALL_CPUS := $(filterout $(AUX_CPU_$(_name)),$(AUX_ALL_CPUS)) $(AUX_CPU_$(_name))) \
+$(eval AUX_ALL_ARCHS := $(filterout $(AUX_ARCH_$(_name)),$(AUX_ALL_ARCHS)) $(AUX_ARCH_$(_name))) \
+$(eval AUX_ALL_SUBARCHS := $(filterout $(AUX_SUBARCH_$(_name)),$(AUX_ALL_SUBARCHS)) $(AUX_SUBARCH_$(_name)))
+endef
+
+# Load system configuration referenced by AUX variant config;
+# this is a build extension mechanism; typically system config
+# resides in a non-build projects;
+# system config may define new rules and globally visible BUILD*
+# includes to support project-specific build steps and toolchains
+# MAintains list of valiants that reference this os config in OS "indexed" var
+# this facilitates multivariant build of the OS (or whataver it is the name of common component these variants share)
+#
+# $(1) - variant
+# no return value
+define aux-import-os-config
+$(eval _aioc_os := $(AUX_OS_$(1))) \
+$(eval AUX_OS_PATH_$(1) := $(patsubst $(_aioc_os):%,%,$(filter $(_aioc_os):%,$(AUX_ALL_OS_PATHS)))) \
+$(eval _aioc_os_cfg := $(AUX_OS_PATH_$(1))/$(_aioc_os)$(os_sfx)) \
+$(if $(wildcard $(_aioc_os_cfg)),,$(error AUX '$(_aioc_os)' OS config file [$(notdir $(_aioc_os_cfg))] required by AUX variant '$(1)' does not exist)) \
+$(if $(filter $(_aioc_os),$(_os_list)),,$(eval include $(_aioc_os_cfg))) \
+$(eval AUX_OS_VARIANT_LIST_$(_aioc_os) += $(1)) \
+$(eval _os_list += $(_aioc_os))
+endef
+
+# make sure that AUX config variables are minimally sane;
+# as a bare minimum they must contain the vars described by aux_env
+# Generate error if requirement is not met.
+#
+#$(1) - variant
+# no return value
+define aux-variant-validate
+$(eval _all:=) \
+$(eval _req:=$(addsuffix _$(1),$(aux_env))) \
+$(foreach var,$(_req),$(eval _all += $(var))) \
+$(eval _missing := $(filterout $(_all),$(_req))) \
+$(if $(_missing),$(error AUX variant $(1) must define vars: $(_missing)))
+endef
+
+AUX_ALL_VARIANTS :=
+AUX_ALL_OSES :=
+AUX_ALL_CPUS :=
+AUX_ALL_ARCHS :=
+AUX_ALL_SUBARCHS :=
+
+variant_sfx :=_aux_variant_config.mk
+os_sfx :=_aux_os_config.mk
+
+all_configs := $(shell find device vendor -maxdepth 4 -name '*$(variant_sfx)' -o -name '*$(os_sfx)' | sort)
+all_os_configs := $(filter %$(os_sfx),$(all_configs))
+all_variant_configs := $(filter %$(variant_sfx),$(all_configs))
+
+AUX_ALL_OS_PATHS := $(foreach f,$(all_os_configs),$(patsubst %$(os_sfx),%,$(notdir $(f))):$(patsubst %/,%,$(dir $(f))))
+AUX_ALL_OS_VARIANT_PATHS := $(foreach f,$(all_variant_configs),$(patsubst %$(variant_sfx),%,$(notdir $(f))):$(patsubst %/,%,$(dir $(f))))
+
+my_variant_pairs := $(foreach v,$(AUX_OS_VARIANT_LIST),$(filter $(v):%,$(AUX_ALL_OS_VARIANT_PATHS)))
+my_missing_variants := $(foreach v,$(AUX_OS_VARIANT_LIST),$(if $(filter $(v):%,$(AUX_ALL_OS_VARIANT_PATHS)),,$(v)))
+
+ifneq ($(strip $(my_missing_variants)),)
+$(error Don't know how to build variant(s): $(my_missing_variants))
+endif
+
+# mandatory variables
+aux_env := AUX_OS AUX_ARCH AUX_SUBARCH AUX_CPU
+
+$(foreach v,$(my_variant_pairs),$(if $(filter $(v),$(AUX_ALL_VARIANTS)),,$(call aux-variant-import-from-pair,$(v),$(variant_sfx))))
+
+ifdef AUX_ALL_VARIANTS
+_os_list :=
+$(foreach v,$(AUX_ALL_VARIANTS),\
+ $(call aux-import-os-config,$(v)) \
+ $(call aux-variant-validate,$(v)) \
+)
+endif
+
+INSTALLED_AUX_TARGETS :=
+
+droidcore: auxiliary
diff --git a/core/aux_executable.mk b/core/aux_executable.mk
new file mode 100644
index 0000000..daf30e7
--- /dev/null
+++ b/core/aux_executable.mk
@@ -0,0 +1,96 @@
+# caller might have included aux_toolchain, e.g. if custom build steps are defined
+ifeq ($(LOCAL_IS_AUX_MODULE),)
+include $(BUILD_SYSTEM)/aux_toolchain.mk
+endif
+
+ifeq ($(AUX_BUILD_NOT_COMPATIBLE),)
+
+###########################################################
+## Standard rules for building an executable file.
+##
+## Additional inputs from base_rules.make:
+## None.
+###########################################################
+
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
+LOCAL_MODULE_CLASS := EXECUTABLES
+endif
+
+$(call $(aux-executable-hook))
+
+###########################################################
+## Standard rules for building any target-side binaries
+## with dynamic linkage (dynamic libraries or executables
+## that link with dynamic libraries)
+##
+## Files including this file must define a rule to build
+## the target $(linked_module).
+###########################################################
+
+# The name of the target file, without any path prepended.
+# This duplicates logic from base_rules.mk because we need to
+# know its results before base_rules.mk is included.
+include $(BUILD_SYSTEM)/configure_module_stem.mk
+
+intermediates := $(call local-intermediates-dir)
+
+# Define the target that is the unmodified output of the linker.
+# The basename of this target must be the same as the final output
+# binary name, because it's used to set the "soname" in the binary.
+# The includer of this file will define a rule to build this target.
+linked_module := $(intermediates)/LINKED/$(my_built_module_stem)
+
+ALL_ORIGINAL_DYNAMIC_BINARIES += $(linked_module)
+
+# Because AUX_SYMBOL_FILTER_FILE depends on ALL_ORIGINAL_DYNAMIC_BINARIES,
+# the linked_module rules won't necessarily inherit the PRIVATE_
+# variables from LOCAL_BUILT_MODULE. This tells binary.make to explicitly
+# define the PRIVATE_ variables for linked_module as well as for
+# LOCAL_BUILT_MODULE.
+LOCAL_INTERMEDIATE_TARGETS += $(linked_module)
+
+###################################
+include $(BUILD_SYSTEM)/binary.mk
+###################################
+
+aux_output := $(linked_module)
+
+ifneq ($(LOCAL_CUSTOM_BUILD_STEP_INPUT),)
+ifneq ($(LOCAL_CUSTOM_BUILD_STEP_OUTPUT),)
+
+# injecting custom build steps
+$(LOCAL_CUSTOM_BUILD_STEP_INPUT): $(aux_output)
+ @echo "$(AUX_DISPLAY) custom copy: $(PRIVATE_MODULE) ($@)"
+ @mkdir -p $(dir $@)
+ $(hide) $(copy-file-to-target)
+
+aux_output := $(LOCAL_CUSTOM_BUILD_STEP_OUTPUT)
+
+endif
+endif
+
+$(LOCAL_BUILT_MODULE): $(aux_output)
+ @echo "$(AUX_DISPLAY) final copy: $(PRIVATE_MODULE) ($@)"
+ @mkdir -p $(dir $@)
+ $(hide) $(copy-file-to-target)
+
+INSTALLED_AUX_TARGETS += $(LOCAL_INSTALLED_MODULE)
+
+$(cleantarget): PRIVATE_CLEAN_FILES += \
+ $(linked_module) \
+
+# Define PRIVATE_ variables from global vars
+$(linked_module): PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES := $(AUX_OUT_INTERMEDIATE_LIBRARIES)
+$(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD)
+
+ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
+$(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ $(transform-o-to-aux-static-executable)
+ $(PRIVATE_POST_LINK_CMD)
+else
+$(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ $(transform-o-to-aux-executable)
+ $(PRIVATE_POST_LINK_CMD)
+endif
+
+endif # AUX_BUILD_NOT_COMPATIBLE
diff --git a/core/aux_static_library.mk b/core/aux_static_library.mk
new file mode 100644
index 0000000..d88478d
--- /dev/null
+++ b/core/aux_static_library.mk
@@ -0,0 +1,27 @@
+ifeq ($(LOCAL_IS_AUX_MODULE),)
+include $(BUILD_SYSTEM)/aux_toolchain.mk
+endif
+
+ifeq ($(AUX_BUILD_NOT_COMPATIBLE),)
+
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+endif
+ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
+LOCAL_MODULE_SUFFIX := .a
+endif
+
+LOCAL_UNINSTALLABLE_MODULE := true
+
+ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
+$(error $(LOCAL_PATH): Cannot set module stem for a library)
+endif
+
+include $(BUILD_SYSTEM)/binary.mk
+
+$(LOCAL_BUILT_MODULE) : PRIVATE_AR := $(AUX_AR)
+$(LOCAL_BUILT_MODULE) : $(built_whole_libraries)
+$(LOCAL_BUILT_MODULE) : $(all_objects)
+ $(transform-o-to-aux-static-lib)
+
+endif # AUX_BUILD_NOT_COMPATIBLE
diff --git a/core/aux_toolchain.mk b/core/aux_toolchain.mk
new file mode 100644
index 0000000..de0b139
--- /dev/null
+++ b/core/aux_toolchain.mk
@@ -0,0 +1,53 @@
+###########################################################
+# takes form LOCAL_AUX_TOOLCHAIN_$(LOCAL_AUX_CPU)
+###########################################################
+
+###############################
+# setup AUX environment
+###############################
+
+# shortcuts for targets with a single instance of OS, ARCH, VARIANT, CPU
+AUX_TOOLCHAIN := $(if $(LOCAL_AUX_TOOLCHAIN),$(LOCAL_AUX_TOOLCHAIN),$(AUX_TOOLCHAIN_$(AUX_CPU)))
+AUX_BUILD_NOT_COMPATIBLE:=
+ifeq ($(strip $(AUX_TOOLCHAIN)),)
+ ifeq ($(strip $(AUX_CPU)),)
+ $(warning $(LOCAL_PATH): $(LOCAL_MODULE): Undefined CPU for AUX toolchain)
+ AUX_BUILD_NOT_COMPATIBLE += TOOLCHAIN
+ else
+ $(warning $(LOCAL_PATH): $(LOCAL_MODULE): Undefined AUX toolchain for CPU=$(AUX_CPU))
+ AUX_BUILD_NOT_COMPATIBLE += TOOLCHAIN
+ endif
+endif
+
+AUX_BUILD_NOT_COMPATIBLE += $(foreach var,OS ARCH SUBARCH CPU OS_VARIANT,$(if $(LOCAL_AUX_$(var)),$(if \
+ $(filter $(LOCAL_AUX_$(var)),$(AUX_$(var))),,$(var))))
+
+AUX_BUILD_NOT_COMPATIBLE := $(strip $(AUX_BUILD_NOT_COMPATIBLE))
+
+ifneq ($(AUX_BUILD_NOT_COMPATIBLE),)
+$(info $(LOCAL_PATH): $(LOCAL_MODULE): not compatible: "$(AUX_BUILD_NOT_COMPATIBLE)" with)
+$(info ====> OS=$(AUX_OS) CPU=$(AUX_CPU) ARCH=$(AUX_ARCH) SUBARCH=$(AUX_SUBARCH) OS_VARIANT=$(AUX_OS_VARIANT))
+$(info ====> TOOLCHAIN=$(AUX_TOOLCHAIN))
+endif
+
+AUX_AR := $(AUX_TOOLCHAIN)ar
+AUX_AS := $(AUX_TOOLCHAIN)gcc
+AUX_CC := $(AUX_TOOLCHAIN)gcc
+AUX_CXX := $(AUX_TOOLCHAIN)g++
+AUX_LINKER := $(AUX_TOOLCHAIN)ld
+AUX_OBJCOPY := $(AUX_TOOLCHAIN)objcopy
+AUX_OBJDUMP := $(AUX_TOOLCHAIN)objdump
+
+###############################
+# setup Android environment
+###############################
+
+LOCAL_IS_AUX_MODULE := true
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+LOCAL_CC := $(AUX_CC)
+LOCAL_CXX := $(AUX_CXX)
+LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
+LOCAL_SYSTEM_SHARED_LIBRARIES :=
+LOCAL_CXX_STL := none
+LOCAL_NO_PIC := true
+LOCAL_NO_LIBCOMPILER_RT := true
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 8a7030f..cdffcc1 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -14,6 +14,9 @@
# limitations under the License.
#
+# Catch users that directly include base_rules.mk
+$(call record-module-type,base_rules)
+
# Users can define base-rules-hook in their buildspec.mk to perform
# arbitrary operations as each module is included.
ifdef base-rules-hook
@@ -30,6 +33,7 @@
endif
LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
+LOCAL_IS_AUX_MODULE := $(strip $(LOCAL_IS_AUX_MODULE))
ifdef LOCAL_IS_HOST_MODULE
ifneq ($(LOCAL_IS_HOST_MODULE),true)
$(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)")
@@ -40,8 +44,18 @@
my_prefix := $(LOCAL_HOST_PREFIX)
endif
my_host := host-
+ my_kind := HOST
else
- my_prefix := TARGET_
+ ifdef LOCAL_IS_AUX_MODULE
+ ifneq ($(LOCAL_IS_AUX_MODULE),true)
+ $(error $(LOCAL_PATH): LOCAL_IS_AUX_MODULE must be "true" or empty, not "$(LOCAL_IS_AUX_MODULE)")
+ endif
+ my_prefix := AUX_
+ my_kind := AUX
+ else
+ my_prefix := TARGET_
+ my_kind :=
+ endif
my_host :=
endif
@@ -192,9 +206,13 @@
my_register_name := $(my_register_name)$($(my_prefix)2ND_ARCH_MODULE_SUFFIX)
endif
endif
+
+# variant is enough to make nano class unique; it serves as a key to lookup (OS,ARCH) tuple
+aux_class := $($(my_prefix)OS_VARIANT)
# Make sure that this IS_HOST/CLASS/MODULE combination is unique.
module_id := MODULE.$(if \
- $(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name)
+ $(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),$(if \
+ $(LOCAL_IS_AUX_MODULE),$(aux_class),TARGET)).$(LOCAL_MODULE_CLASS).$(my_register_name)
ifdef $(module_id)
$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
endif
@@ -289,6 +307,7 @@
###########################################################
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
+$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_AUX_MODULE := $(LOCAL_IS_AUX_MODULE)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PREFIX := $(my_prefix)
@@ -333,21 +352,22 @@
$(copy-file-to-new-target)
$(PRIVATE_POST_INSTALL_CMD)
+ifndef LOCAL_IS_HOST_MODULE
# Rule to install the module's companion init.rc.
-my_init_rc := $(LOCAL_INIT_RC_$(my_32_64_bit_suffix))
-ifneq ($(my_init_rc),)
-my_init_rc_pairs += $(LOCAL_PATH)/$(my_init_rc):$(TARGET_OUT$(partition_tag)_ETC)/init/$(notdir $(my_init_rc))
-endif
-ifneq ($(LOCAL_INIT_RC),)
-my_init_rc_pairs += $(LOCAL_PATH)/$(LOCAL_INIT_RC):$(TARGET_OUT$(partition_tag)_ETC)/init/$(notdir $(LOCAL_INIT_RC))
-# Make sure we don't define the rule twice in multilib module.
-LOCAL_INIT_RC :=
-endif
-ifneq ($(my_init_rc_pairs),)
-my_init_rc_installed := $(call copy-many-files,$(my_init_rc_pairs))
+my_init_rc := $(LOCAL_INIT_RC_$(my_32_64_bit_suffix)) $(LOCAL_INIT_RC)
+ifneq ($(strip $(my_init_rc)),)
+my_init_rc_pairs := $(foreach rc,$(my_init_rc),$(LOCAL_PATH)/$(rc):$(TARGET_OUT$(partition_tag)_ETC)/init/$(notdir $(rc)))
+my_init_rc_installed := $(foreach rc,$(my_init_rc_pairs),$(call word-colon,2,$(rc)))
+
+# Make sure we only set up the copy rules once, even if another arch variant
+# shares a common LOCAL_INIT_RC.
+my_init_rc_new_pairs := $(filter-out $(ALL_INIT_RC_INSTALLED_PAIRS),$(my_init_rc_pairs))
+my_init_rc_new_installed := $(call copy-many-files,$(my_init_rc_new_pairs))
+ALL_INIT_RC_INSTALLED_PAIRS += $(my_init_rc_new_pairs)
$(my_register_name) : $(my_init_rc_installed)
-endif # my_init_rc_pairs
+endif # my_init_rc
+endif # !LOCAL_IS_HOST_MODULE
# Rule to install the module's companion symlinks
my_installed_symlinks := $(addprefix $(my_module_path)/,$(LOCAL_MODULE_SYMLINKS) $(LOCAL_MODULE_SYMLINKS_$(my_32_64_bit_suffix)))
diff --git a/core/binary.mk b/core/binary.mk
index 90a2156..4c48d26 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -70,6 +70,9 @@
$(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
endif
+ # Make sure we've built the NDK.
+ my_additional_dependencies += $(SOONG_OUT_DIR)/ndk.timestamp
+
# mips32r6 is not supported by the NDK. No released NDK contains these
# libraries, but the r10 in prebuilts/ndk had a local hack to add them :(
#
@@ -81,9 +84,31 @@
endif
endif
- my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources
- my_ndk_sysroot := $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
- my_ndk_sysroot_include := $(my_ndk_sysroot)/usr/include
+ my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
+ ifneq (,$(filter arm64 mips64 x86_64,$(my_arch)))
+ my_min_sdk_version := 21
+ else
+ my_min_sdk_version := 9
+ endif
+
+ # Historically we've just set up a bunch of symlinks in prebuilts/ndk to map
+ # missing API levels to existing ones where necessary, but we're not doing
+ # that for the generated libraries. Clip the API level to the minimum where
+ # appropriate.
+ my_ndk_api := \
+ $(shell if [ $(LOCAL_SDK_VERSION) -lt $(my_min_sdk_version) ]; then \
+ echo $(my_min_sdk_version); else echo $(LOCAL_SDK_VERSION); fi)
+
+ my_ndk_source_root := \
+ $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources
+ my_ndk_sysroot := \
+ $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/platforms/android-$(my_ndk_api)/arch-$(my_arch)
+ my_built_ndk := $(SOONG_OUT_DIR)/ndk
+ my_ndk_triple := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_TRIPLE)
+ my_ndk_sysroot_include := \
+ $(my_built_ndk)/sysroot/usr/include \
+ $(my_built_ndk)/sysroot/usr/include/$(my_ndk_triple) \
+ $(my_ndk_sysroot)/usr/include \
# x86_64 and and mips64 are both multilib toolchains, so their libraries are
# installed in /usr/lib64. Aarch64, on the other hand, is not a multilib
@@ -92,14 +117,19 @@
# Mips32r6 is yet another variation, with libraries installed in libr6.
#
# For the rest, the libraries are installed simply to /usr/lib.
- ifneq (,$(filter x86_64 mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
- my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib64
+ ifneq (,$(filter x86_64 mips64,$(my_arch)))
+ my_ndk_libdir_name := lib64
else ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
- my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/libr6
+ my_ndk_libdir_name := libr6
else
- my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib
+ my_ndk_libdir_name := lib
endif
+ my_ndk_platform_dir := \
+ $(my_built_ndk)/platforms/android-$(my_ndk_api)/arch-$(my_arch)
+ my_built_ndk_libs := $(my_ndk_platform_dir)/usr/$(my_ndk_libdir_name)
+ my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/$(my_ndk_libdir_name)
+
# The bionic linker now has support for packed relocations and gnu style
# hashes (which are much faster!), but shipping to older devices requires
# the old style hash. Fortunately, we can build with both and it'll work
@@ -180,11 +210,17 @@
endif
endif
endif
+
+ my_generated_ndk_shared_libraries := \
+ $(filter $(NDK_MIGRATED_LIBS),$(my_system_shared_libraries))
+ my_system_shared_libraries := \
+ $(filter-out $(NDK_MIGRATED_LIBS),$(my_system_shared_libraries))
endif
# MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
# all code is position independent, and then those warnings get promoted to
# errors.
+ifneq ($(LOCAL_NO_PIC),true)
ifneq ($($(my_prefix)OS),windows)
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
my_cflags += -fpie
@@ -192,6 +228,7 @@
my_cflags += -fPIC
endif
endif
+endif
ifdef LOCAL_IS_HOST_MODULE
my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)OS)) $(LOCAL_SRC_FILES_$($(my_prefix)OS)_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
@@ -231,6 +268,20 @@
my_clang := $(strip $(LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
endif
+# if custom toolchain is in use, default is not to use clang, if not explicitly required
+ifneq ($(my_cc)$(my_cxx),)
+ ifeq ($(my_clang),)
+ my_clang := false
+ endif
+endif
+# Issue warning if LOCAL_CLANG* is set to false and the local makefile is not found
+# in the exception project list.
+ifeq ($(my_clang),false)
+ ifeq ($(call find_in_local_clang_exception_projects,$(LOCAL_MODULE_MAKEFILE)),)
+ $(warning $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): warning: LOCAL_CLANG is set to false)
+ endif
+endif
+
# clang is enabled by default for host builds
# enable it unless we've specifically disabled clang above
ifdef LOCAL_IS_HOST_MODULE
@@ -296,15 +347,17 @@
ifneq ($(strip $(CUSTOM_$(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)LINKER)),)
my_linker := $(CUSTOM_$(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)LINKER)
else
- my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LINKER)
+ my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LINKER)
endif
include $(BUILD_SYSTEM)/config_sanitizers.mk
+ifneq ($(LOCAL_NO_LIBCOMPILER_RT),true)
# Add in libcompiler_rt for all regular device builds
ifeq (,$(LOCAL_SDK_VERSION)$(WITHOUT_LIBCOMPILER_RT))
my_static_libraries += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
endif
+endif
####################################################
## Add FDO flags if FDO is turned on and supported
@@ -344,24 +397,24 @@
my_target_global_cppflags := $(my_ndk_stl_cppflags)
else
my_target_global_c_includes := $(SRC_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_C_INCLUDES)
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES) \
- $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_C_SYSTEM_INCLUDES)
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
my_target_global_cppflags :=
endif # LOCAL_SDK_VERSION
ifeq ($(my_clang),true)
-my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CFLAGS)
-my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CONLYFLAGS)
-my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CPPFLAGS)
-my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_LDFLAGS)
+my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
+my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS)
+my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS)
+my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
else
-my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS)
-my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CONLYFLAGS)
-my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS)
-my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
+my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CFLAGS)
+my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CONLYFLAGS)
+my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CPPFLAGS)
+my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_LDFLAGS)
endif # my_clang
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_target_global_c_includes)
@@ -420,9 +473,9 @@
endif
ifeq ($(my_clang),true)
- my_coverage_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBPROFILE_RT)
+ my_coverage_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT)
else
- my_coverage_lib := $(call intermediates-dir-for,STATIC_LIBRARIES,libgcov,,,$(LOCAL_2ND_ARCH_VAR_PREFIX))/libgcov.a
+ my_coverage_lib := $(call intermediates-dir-for,STATIC_LIBRARIES,libgcov,$(filter AUX,$(my_kind)),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/libgcov.a
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_COVERAGE_LIB := $(my_coverage_lib)
@@ -450,7 +503,7 @@
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
my_syntax_arch := host
else
- my_syntax_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
+ my_syntax_arch := $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
endif
ifeq ($(strip $(my_cc)),)
@@ -862,6 +915,39 @@
endif # $(vts_src) non-empty
###########################################################
+## Compile the .hal files to .cpp and then to .o
+###########################################################
+
+hidl_src := $(strip $(filter %.hal,$(my_src_files)))
+hidl_gen_cpp :=
+ifneq ($(hidl_src),)
+
+# Use the intermediates directory to avoid writing our own .cpp -> .o rules.
+hidl_gen_cpp_root := $(intermediates)/hidl-generated/src
+hidl_gen_include_root := $(intermediates)/hidl-generated/include
+
+# Multi-architecture builds have distinct intermediates directories.
+# Thus we'll actually generate source for each architecture.
+$(foreach s,$(hidl_src),\
+ $(eval $(call define-hidl-cpp-rule,$(s),$(hidl_gen_cpp_root),hidl_gen_cpp)))
+$(foreach cpp,$(hidl_gen_cpp), \
+ $(call include-depfile,$(addsuffix .hal.P,$(basename $(cpp))),$(cpp)))
+$(call track-src-file-gen,$(hidl_src),$(hidl_gen_cpp))
+
+$(hidl_gen_cpp) : PRIVATE_MODULE := $(LOCAL_MODULE)
+$(hidl_gen_cpp) : PRIVATE_HEADER_OUTPUT_DIR := $(hidl_gen_include_root)
+$(hidl_gen_cpp) : PRIVATE_SRC_OUTPUT_DIR := $(hidl_gen_cpp_root)
+$(hidl_gen_cpp) : PRIVATE_HIDL_FLAGS := $(addprefix -I,$(LOCAL_HIDL_INCLUDES))
+
+# Add generated headers to include paths.
+my_c_includes += $(hidl_gen_include_root)
+my_export_c_include_dirs += $(hidl_gen_include_root)
+# Pick up the generated C++ files later for transformation to .o files.
+my_generated_sources += $(hidl_gen_cpp)
+
+endif # $(hidl_src) non-empty
+
+###########################################################
## YACC: Compile .y/.yy files to .c/.cpp and then to .o.
###########################################################
@@ -1237,9 +1323,9 @@
import_includes := $(intermediates)/import_includes
import_includes_deps := $(strip \
$(foreach l, $(installed_shared_library_module_names), \
- $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
+ $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
$(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
- $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
+ $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
$(import_includes): PRIVATE_IMPORT_EXPORT_INCLUDES := $(import_includes_deps)
$(import_includes) : $(import_includes_deps)
@echo Import includes file: $@
@@ -1252,7 +1338,6 @@
$(hide) touch $@
endif
-
####################################################
## Verify that NDK-built libraries only link against
## other NDK-built libraries
@@ -1268,11 +1353,11 @@
endif
my_link_type_deps := $(strip \
$(foreach l,$(my_whole_static_libraries) $(my_static_libraries), \
- $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/link_type))
+ $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/link_type))
ifneq ($(LOCAL_MODULE_CLASS),STATIC_LIBRARIES)
my_link_type_deps += $(strip \
$(foreach l,$(my_shared_libraries), \
- $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/link_type))
+ $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/link_type))
endif
$(my_link_type): PRIVATE_DEPS := $(my_link_type_deps)
$(my_link_type): PRIVATE_MODULE := $(LOCAL_MODULE)
@@ -1399,7 +1484,14 @@
$(addprefix $(my_ndk_sysroot_lib)/, \
$(addsuffix $(so_suffix), $(my_system_shared_libraries)))
-built_shared_libraries += $(my_system_shared_libraries_fullpath)
+my_built_ndk_shared_libraries_fullpath := \
+ $(addprefix $(my_built_ndk_libs)/,\
+ $(addsuffix $(so_suffix),$(my_generated_ndk_shared_libraries)))
+
+built_shared_libraries += \
+ $(my_built_ndk_shared_libraries_fullpath) \
+ $(my_system_shared_libraries_fullpath) \
+
else
built_shared_libraries := \
$(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
@@ -1418,7 +1510,7 @@
built_static_libraries := \
$(foreach lib,$(my_static_libraries), \
$(call intermediates-dir-for, \
- STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix))
+ STATIC_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix))
ifdef LOCAL_SDK_VERSION
built_static_libraries += $(my_ndk_stl_static_lib)
@@ -1427,7 +1519,7 @@
built_whole_libraries := \
$(foreach lib,$(my_whole_static_libraries), \
$(call intermediates-dir-for, \
- STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix))
+ STATIC_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix))
# We don't care about installed static libraries, since the
# libraries have already been linked into the module at that point.
@@ -1606,15 +1698,15 @@
# Headers exported by whole static libraries are also exported by this library.
export_include_deps := $(strip \
$(foreach l,$(my_whole_static_libraries), \
- $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
+ $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
# Re-export requested headers from shared libraries.
export_include_deps += $(strip \
$(foreach l,$(LOCAL_EXPORT_SHARED_LIBRARY_HEADERS), \
- $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
+ $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
# Re-export requested headers from static libraries.
export_include_deps += $(strip \
$(foreach l,$(LOCAL_EXPORT_STATIC_LIBRARY_HEADERS), \
- $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
+ $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
$(export_includes): PRIVATE_REEXPORTED_INCLUDES := $(export_include_deps)
# By adding $(my_generated_sources) it makes sure the headers get generated
# before any dependent source files get compiled.
diff --git a/core/clang/config.mk b/core/clang/config.mk
index 4685514..e47c36a 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -143,4 +143,21 @@
FORCE_BUILD_LLVM_COMPONENTS := true
endif
+# A list of projects that are allowed to set LOCAL_CLANG to false.
+LOCAL_CLANG_EXCEPTION_PROJECTS := \
+ device/huawei/angler/ \
+ device/lge/bullhead/ \
+ external/valgrind/ \
+ hardware/qcom/ \
+ $(INTERNAL_LOCAL_CLANG_EXCEPTION_PROJECTS)
+
+# Find $1 in the exception project list.
+define find_in_local_clang_exception_projects
+$(subst $(space),, \
+ $(foreach project,$(LOCAL_CLANG_EXCEPTION_PROJECTS), \
+ $(if $(filter $(project)%,$(1)),$(project)) \
+ ) \
+)
+endef
+
include $(BUILD_SYSTEM)/clang/tidy.mk
diff --git a/core/clang/tidy.mk b/core/clang/tidy.mk
index 35871f0..d50b43d 100644
--- a/core/clang/tidy.mk
+++ b/core/clang/tidy.mk
@@ -15,10 +15,12 @@
#
# Most Android source files are not clang-tidy clean yet.
-# Global tidy checks include only google* and misc-macro-parentheses,
-# but not google-readability* or google-runtime-references.
+# Global tidy checks include only google*, performance*,
+# and misc-macro-parentheses, but not google-readability*
+# or google-runtime-references.
DEFAULT_GLOBAL_TIDY_CHECKS := \
- -*,google*,-google-readability*,-google-runtime-references,misc-macro-parentheses
+ -*,google*,performance*,misc-macro-parentheses \
+ ,-google-readability*,-google-runtime-references
# Disable style rules usually not followed by external projects.
# Every word in DEFAULT_LOCAL_TIDY_CHECKS list has the following format:
diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk
index 2ae87c7..633790c 100644
--- a/core/cleanbuild.mk
+++ b/core/cleanbuild.mk
@@ -152,16 +152,12 @@
previous_build_config_file := $(PRODUCT_OUT)/previous_build_config.mk
-# A change in the list of aapt configs warrants an installclean, too.
-aapt_config_list := $(strip $(PRODUCT_AAPT_CONFIG) $(PRODUCT_AAPT_PREF_CONFIG))
-
current_build_config := \
- $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)-{$(aapt_config_list)}
+ $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
current_sanitize_target := $(strip $(SANITIZE_TARGET))
ifeq (,$(current_sanitize_target))
current_sanitize_target := false
endif
-aapt_config_list :=
force_installclean := false
force_objclean := false
@@ -236,7 +232,6 @@
$(PRODUCT_OUT)/kernel \
$(PRODUCT_OUT)/data \
$(PRODUCT_OUT)/skin \
- $(PRODUCT_OUT)/obj/APPS \
$(PRODUCT_OUT)/obj/NOTICE_FILES \
$(PRODUCT_OUT)/obj/PACKAGING \
$(PRODUCT_OUT)/recovery \
@@ -245,8 +240,6 @@
$(PRODUCT_OUT)/system_other \
$(PRODUCT_OUT)/vendor \
$(PRODUCT_OUT)/oem \
- $(PRODUCT_OUT)/dex_bootjars \
- $(PRODUCT_OUT)/obj/JAVA_LIBRARIES \
$(PRODUCT_OUT)/obj/FAKE
# The files/dirs to delete during a dataclean, which removes any files
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index e271dd2..bd13ef1 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -107,6 +107,7 @@
LOCAL_MANIFEST_INSTRUMENTATION_FOR:=
LOCAL_AIDL_INCLUDES:=
LOCAL_VTS_INCLUDES:=
+LOCAL_HIDL_INCLUDES:=
LOCAL_JARJAR_RULES:=
LOCAL_ADDITIONAL_JAVA_DIR:=
LOCAL_ALLOW_UNDEFINED_SYMBOLS:=
@@ -144,8 +145,11 @@
LOCAL_PROTOC_FLAGS:=
LOCAL_PROTO_JAVA_OUTPUT_PARAMS:=
LOCAL_VTSC_FLAGS:=
+LOCAL_HIDL_FLAGS:=
LOCAL_NO_CRT:=
+LOCAL_NO_LIBCOMPILER_RT:=
LOCAL_NO_LIBGCC:=
+LOCAL_NO_PIC:=
LOCAL_PROPRIETARY_MODULE:=
LOCAL_OEM_MODULE:=
LOCAL_ODM_MODULE:=
@@ -209,9 +213,11 @@
# to avoid installing the presigned apks with classes.dex unstripped.
LOCAL_REPLACE_PREBUILT_APK_INSTALLED:=
LOCAL_NDK_VERSION:=current
+LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES:=
LOCAL_LOGTAGS_FILES:=
LOCAL_EXTRACT_APK:=
LOCAL_EXTRACT_DPI_APK:=
+LOCAL_RECORDED_MODULE_TYPE:=
# arch specific variables
LOCAL_SRC_FILES_$(TARGET_ARCH):=
@@ -373,6 +379,16 @@
LOCAL_JAVA_LANGUAGE_VERSION:=
LOCAL_CTS_GTEST_LIST_EXECUTABLE:=
+LOCAL_IS_AUX_MODULE :=
+LOCAL_AUX_TOOLCHAIN :=
+LOCAL_AUX_OS :=
+LOCAL_AUX_ARCH :=
+LOCAL_AUX_SUBARCH :=
+LOCAL_AUX_CPU :=
+LOCAL_AUX_OS_VARIANT :=
+LOCAL_CUSTOM_BUILD_STEP_INPUT:=
+LOCAL_CUSTOM_BUILD_STEP_OUTPUT:=
+
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
# iterate over thousands of entries every time.
# Leave the current makefile to make sure we don't break anything
diff --git a/core/config.mk b/core/config.mk
index 0250516..05914b0 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -76,6 +76,8 @@
BUILD_HOST_STATIC_LIBRARY:= $(BUILD_SYSTEM)/host_static_library.mk
BUILD_HOST_SHARED_LIBRARY:= $(BUILD_SYSTEM)/host_shared_library.mk
BUILD_STATIC_LIBRARY:= $(BUILD_SYSTEM)/static_library.mk
+BUILD_AUX_STATIC_LIBRARY:= $(BUILD_SYSTEM)/aux_static_library.mk
+BUILD_AUX_EXECUTABLE:= $(BUILD_SYSTEM)/aux_executable.mk
BUILD_SHARED_LIBRARY:= $(BUILD_SYSTEM)/shared_library.mk
BUILD_EXECUTABLE:= $(BUILD_SYSTEM)/executable.mk
BUILD_HOST_EXECUTABLE:= $(BUILD_SYSTEM)/host_executable.mk
@@ -541,6 +543,7 @@
external/nanopb-c/generator/google/*.py \
external/nanopb-c/generator/proto/*.py)
VTSC := $(HOST_OUT_EXECUTABLES)/vtsc$(HOST_EXECUTABLE_SUFFIX)
+HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
DBUS_GENERATOR := $(HOST_OUT_EXECUTABLES)/dbus-binding-generator
MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
diff --git a/core/copy_headers.mk b/core/copy_headers.mk
index 7d5a5d9..417a76c 100644
--- a/core/copy_headers.mk
+++ b/core/copy_headers.mk
@@ -1,6 +1,7 @@
###########################################################
## Copy headers to the install tree
###########################################################
+$(call record-module-type,COPY_HEADERS)
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
my_prefix := HOST_
else
diff --git a/core/definitions.mk b/core/definitions.mk
index 1ef73e9..48aaf1b 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -92,9 +92,13 @@
# Display names for various build targets
TARGET_DISPLAY := target
+AUX_DISPLAY := aux
HOST_DISPLAY := host
HOST_CROSS_DISPLAY := host cross
+# All installed initrc files
+ALL_INIT_RC_INSTALLED_PAIRS :=
+
###########################################################
## Debugging; prints a variable list to stdout
###########################################################
@@ -316,6 +320,24 @@
endef
###########################################################
+## Find all files named "*.hal" under the named directories,
+## which must be relative to $(LOCAL_PATH). The returned list
+## is relative to $(LOCAL_PATH).
+###########################################################
+
+define all-hidl-files-under
+$(call all-named-files-under,*.hal,$(1))
+endef
+
+###########################################################
+## Find all of the "*.hal" files under $(LOCAL_PATH).
+###########################################################
+
+define all-subdir-hidl-files
+$(call all-hidl-files-under,.)
+endef
+
+###########################################################
## Find all of the logtags files under the named directories.
## Meant to be used like:
## SRC_FILES := $(call all-logtags-files-under,src)
@@ -471,6 +493,28 @@
$(if $(1),$(call reverse-list,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1))
endef
+define def-host-aux-target
+$(eval _idf_val_:=$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST,$(if $(strip $(LOCAL_IS_AUX_MODULE)),AUX,))) \
+$(_idf_val_)
+endef
+
+###########################################################
+## Returns correct _idfPrefix from the list:
+## { HOST, HOST_CROSS, AUX, TARGET }
+###########################################################
+# the following rules checked in order:
+# ($1 is in {AUX, HOST_CROSS} => $1;
+# ($1 is empty) => TARGET;
+# ($2 is not empty) => HOST_CROSS;
+# => HOST;
+define find-idf-prefix
+$(strip \
+ $(eval _idf_pfx_:=$(strip $(filter AUX HOST_CROSS,$(1)))) \
+ $(eval _idf_pfx_:=$(if $(strip $(1)),$(if $(_idf_pfx_),$(_idf_pfx_),$(if $(strip $(2)),HOST_CROSS,HOST)),TARGET)) \
+ $(_idf_pfx_)
+)
+endef
+
###########################################################
## The intermediates directory. Where object files go for
## a given target. We could technically get away without
@@ -481,7 +525,7 @@
# $(1): target class, like "APPS"
# $(2): target name, like "NotePad"
-# $(3): if non-empty, this is a HOST target.
+# $(3): { HOST, HOST_CROSS, AUX, <empty (TARGET)>, <other non-empty (HOST)> }
# $(4): if non-empty, force the intermediates to be COMMON
# $(5): if non-empty, force the intermediates to be for the 2nd arch
# $(6): if non-empty, force the intermediates to be for the host cross os
@@ -493,7 +537,7 @@
$(eval _idfName := $(strip $(2))) \
$(if $(_idfName),, \
$(error $(LOCAL_PATH): Name not defined in call to intermediates-dir-for)) \
- $(eval _idfPrefix := $(if $(strip $(3)),$(if $(strip $(6)),HOST_CROSS,HOST),TARGET)) \
+ $(eval _idfPrefix := $(call find-idf-prefix,$(3),$(6))) \
$(eval _idf2ndArchPrefix := $(if $(strip $(5)),$(TARGET_2ND_ARCH_VAR_PREFIX))) \
$(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
$(eval _idfIntBase := $($(_idfPrefix)_OUT_COMMON_INTERMEDIATES)) \
@@ -518,7 +562,7 @@
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-intermediates-dir)) \
$(if $(strip $(LOCAL_MODULE)),, \
$(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-intermediates-dir)) \
- $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(LOCAL_IS_HOST_MODULE),$(1),$(2),$(3)) \
+ $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(call def-host-aux-target),$(1),$(2),$(3)) \
)
endef
@@ -533,7 +577,7 @@
# $(1): target class, like "APPS"
# $(2): target name, like "NotePad"
-# $(3): if non-empty, this is a HOST target.
+# $(3): { HOST, HOST_CROSS, AUX, <empty (TARGET)>, <other non-empty (HOST)> }
# $(4): if non-empty, force the generated sources to be COMMON
define generated-sources-dir-for
$(strip \
@@ -543,7 +587,7 @@
$(eval _idfName := $(strip $(2))) \
$(if $(_idfName),, \
$(error $(LOCAL_PATH): Name not defined in call to generated-sources-dir-for)) \
- $(eval _idfPrefix := $(if $(strip $(3)),HOST,TARGET)) \
+ $(eval _idfPrefix := $(call find-idf-prefix,$(3),)) \
$(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
$(eval _idfIntBase := $($(_idfPrefix)_OUT_COMMON_GEN)) \
, \
@@ -563,7 +607,7 @@
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-generated-sources-dir)) \
$(if $(strip $(LOCAL_MODULE)),, \
$(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-generated-sources-dir)) \
- $(call generated-sources-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(LOCAL_IS_HOST_MODULE),$(1)) \
+ $(call generated-sources-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(call def-host-aux-target),$(1)) \
)
endef
@@ -1123,6 +1167,33 @@
endef
###########################################################
+## Commands for running hidl-gen
+###########################################################
+
+define transform-hidl-to-cpp
+@mkdir -p $(dir $@)
+@mkdir -p $(PRIVATE_HEADER_OUTPUT_DIR)
+@mkdir -p $(PRIVATE_SRC_OUTPUT_DIR)
+@echo "Generating C++ from HIDL: $(PRIVATE_MODULE) <= $<"
+$(hide) $(HIDL) -d$(basename $@).hal.P $(PRIVATE_HIDL_FLAGS) \
+ all_cpps $< $(PRIVATE_HEADER_OUTPUT_DIR) $@
+endef
+
+## Given a .hal file path generate the rule to compile it to .cpp and .h files.
+# $(1): a .hal source file
+# $(2): a directory to place the generated .cpp and .h files in
+# $(3): name of a variable to add the path to the generated source files to
+#
+# You must call this with $(eval).
+define define-hidl-cpp-rule
+my_tracked_source_files += $@
+define-hidl-cpp-rule-src := $(patsubst %.hal,%$(LOCAL_CPP_EXTENSION),$(subst ../,dotdot/,$(addprefix $(2)/,$(1))))
+$$(define-hidl-cpp-rule-src) : $(LOCAL_PATH)/$(1) $(HIDL)
+ $$(transform-hidl-to-cpp)
+$(3) += $$(define-hidl-cpp-rule-src)
+endef
+
+###########################################################
## Commands for running java-event-log-tags.py
###########################################################
@@ -1236,12 +1307,12 @@
ifneq (,$(filter 1 true,$(WITH_TIDY_ONLY)))
define transform-cpp-to-o
$(if $(PRIVATE_TIDY_CHECKS),
- @echo "target tidy $(PRIVATE_ARM_MODE) C++: $<"
+ @echo "$($(PRIVATE_PREFIX)DISPLAY) tidy $(PRIVATE_ARM_MODE) C++: $<"
$(clang-tidy-cpp))
endef
else
define transform-cpp-to-o
-@echo "target $(PRIVATE_ARM_MODE) C++: $(PRIVATE_MODULE) <= $<"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) $(PRIVATE_ARM_MODE) C++: $(PRIVATE_MODULE) <= $<"
@mkdir -p $(dir $@)
$(if $(PRIVATE_TIDY_CHECKS),$(clang-tidy-cpp))
$(hide) $(RELATIVE_PWD) $(PRIVATE_CXX) \
@@ -1285,12 +1356,12 @@
ifneq (,$(filter 1 true,$(WITH_TIDY_ONLY)))
define transform-c-to-o
$(if $(PRIVATE_TIDY_CHECKS),
- @echo "target tidy $(PRIVATE_ARM_MODE) C: $<"
+ @echo "$($(PRIVATE_PREFIX)DISPLAY) tidy $(PRIVATE_ARM_MODE) C: $<"
$(clang-tidy-c))
endef
else
define transform-c-to-o
-@echo "target $(PRIVATE_ARM_MODE) C: $(PRIVATE_MODULE) <= $<"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) $(PRIVATE_ARM_MODE) C: $(PRIVATE_MODULE) <= $<"
@mkdir -p $(dir $@)
$(if $(PRIVATE_TIDY_CHECKS),$(clang-tidy-c))
$(hide) $(RELATIVE_PWD) $(PRIVATE_CC) \
@@ -1301,7 +1372,7 @@
endif
define transform-s-to-o-no-deps
-@echo "target asm: $(PRIVATE_MODULE) <= $<"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) asm: $(PRIVATE_MODULE) <= $<"
@mkdir -p $(dir $@)
$(RELATIVE_PWD) $(PRIVATE_CC) \
$(call transform-c-or-s-to-o-compiler-args, $(PRIVATE_ASFLAGS)) \
@@ -1330,7 +1401,7 @@
###########################################################
define transform-m-to-o-no-deps
-@echo "target ObjC: $(PRIVATE_MODULE) <= $<"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) ObjC: $(PRIVATE_MODULE) <= $<"
$(call transform-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_DEBUG_CFLAGS))
endef
@@ -1589,7 +1660,7 @@
# Explicitly delete the archive first so that ar doesn't
# try to add to an existing archive.
define transform-o-to-static-lib
-@echo "target StaticLib: $(PRIVATE_MODULE) ($@)"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) StaticLib: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
@rm -f $@
$(extract-and-include-target-whole-static-libs)
@@ -1598,6 +1669,89 @@
$(PRIVATE_ARFLAGS) $@,$(PRIVATE_ALL_OBJECTS))
endef
+# $(1): the full path of the source static library.
+define _extract-and-include-single-aux-whole-static-lib
+$(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\
+ rm -rf $$ldir; \
+ mkdir -p $$ldir; \
+ cp $(1) $$ldir; \
+ lib_to_include=$$ldir/$(notdir $(1)); \
+ filelist=; \
+ subdir=0; \
+ for f in `$(PRIVATE_AR) t $(1)`; do \
+ if [ -e $$ldir/$$f ]; then \
+ mkdir $$ldir/$$subdir; \
+ ext=$$subdir/; \
+ subdir=$$((subdir+1)); \
+ $(PRIVATE_AR) m $$lib_to_include $$f; \
+ else \
+ ext=; \
+ fi; \
+ $(PRIVATE_AR) p $$lib_to_include $$f > $$ldir/$$ext$$f; \
+ filelist="$$filelist $$ldir/$$ext$$f"; \
+ done ; \
+ $(PRIVATE_AR) $(AUX_GLOBAL_ARFLAGS) \
+ $(PRIVATE_ARFLAGS) $@ $$filelist
+
+endef
+
+define extract-and-include-aux-whole-static-libs
+$(call extract-and-include-whole-static-libs-first, $(firstword $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)))
+$(foreach lib,$(wordlist 2,999,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)), \
+ $(call _extract-and-include-single-aux-whole-static-lib, $(lib)))
+endef
+
+# Explicitly delete the archive first so that ar doesn't
+# try to add to an existing archive.
+define transform-o-to-aux-static-lib
+@echo "$($(PRIVATE_PREFIX)DISPLAY) StaticLib: $(PRIVATE_MODULE) ($@)"
+@mkdir -p $(dir $@)
+@rm -f $@
+$(extract-and-include-aux-whole-static-libs)
+$(call split-long-arguments,$(PRIVATE_AR) \
+ $(AUX_GLOBAL_ARFLAGS) \
+ $(PRIVATE_ARFLAGS) $@,$(PRIVATE_ALL_OBJECTS))
+endef
+
+define transform-o-to-aux-executable-inner
+$(hide) $(PRIVATE_CXX) -pie \
+ -Bdynamic \
+ -Wl,--gc-sections \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ -Wl,--no-whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(PRIVATE_LDFLAGS) \
+ -o $@
+endef
+
+define transform-o-to-aux-executable
+@echo "$(AUX_DISPLAY) Executable: $(PRIVATE_MODULE) ($@)"
+@mkdir -p $(dir $@)
+$(transform-o-to-aux-executable-inner)
+endef
+
+define transform-o-to-aux-static-executable-inner
+$(hide) $(PRIVATE_CXX) \
+ -Bstatic \
+ -Wl,--gc-sections \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ -Wl,--no-whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(PRIVATE_LDFLAGS) \
+ -Wl,-Map=$(@).map \
+ -o $@
+endef
+
+define transform-o-to-aux-static-executable
+@echo "$(AUX_DISPLAY) StaticExecutable: $(PRIVATE_MODULE) ($@)"
+@mkdir -p $(dir $@)
+$(transform-o-to-aux-static-executable-inner)
+endef
+
###########################################################
## Commands for running host ar
###########################################################
@@ -1735,14 +1889,14 @@
$(PRIVATE_TARGET_LIBGCC) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ $(PRIVATE_ALL_SHARED_LIBRARIES) \
-o $@ \
$(PRIVATE_TARGET_CRTEND_SO_O) \
$(PRIVATE_LDLIBS)
endef
define transform-o-to-shared-lib
-@echo "target SharedLib: $(PRIVATE_MODULE) ($@)"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) SharedLib: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
$(transform-o-to-shared-lib-inner)
endef
@@ -1757,14 +1911,14 @@
endif
define transform-to-stripped
-@echo "target Strip: $(PRIVATE_MODULE) ($@)"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Strip: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
$(hide) $(PRIVATE_STRIP) --strip-all $< -o $@ \
$(if $(PRIVATE_NO_DEBUGLINK),,$(TARGET_STRIP_EXTRA))
endef
define transform-to-stripped-keep-mini-debug-info
-@echo "target Strip (mini debug info): $(PRIVATE_MODULE) ($@)"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Strip (mini debug info): $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
$(hide) $(PRIVATE_NM) -D $< --format=posix --defined-only | awk '{ print $$1 }' | sort >$@.dynsyms
$(hide) $(PRIVATE_NM) $< --format=posix --defined-only | awk '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort >$@.funcsyms
@@ -1781,7 +1935,7 @@
endef
define transform-to-stripped-keep-symbols
-@echo "target Strip (keep symbols): $(PRIVATE_MODULE) ($@)"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Strip (keep symbols): $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
$(hide) $(PRIVATE_OBJCOPY) \
`$(PRIVATE_READELF) -S $< | awk '/.debug_/ {print "-R " $$2}' | xargs` \
@@ -1793,7 +1947,7 @@
###########################################################
define pack-elf-relocations
-@echo "target Pack Relocations: $(PRIVATE_MODULE) ($@)"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Pack Relocations: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
$(hide) $(RELOCATION_PACKER) $@
endef
@@ -1823,14 +1977,14 @@
$(PRIVATE_TARGET_LIBGCC) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ $(PRIVATE_ALL_SHARED_LIBRARIES) \
-o $@ \
$(PRIVATE_TARGET_CRTEND_O) \
$(PRIVATE_LDLIBS)
endef
define transform-o-to-executable
-@echo "target Executable: $(PRIVATE_MODULE) ($@)"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Executable: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
$(transform-o-to-executable-inner)
endef
@@ -1873,7 +2027,7 @@
endef
define transform-o-to-static-executable
-@echo "target StaticExecutable: $(PRIVATE_MODULE) ($@)"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) StaticExecutable: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
$(transform-o-to-static-executable-inner)
endef
@@ -2180,7 +2334,7 @@
endef
define transform-java-to-classes.jar
-@echo "target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
endef
@@ -2705,19 +2859,19 @@
# Copy a prebuilt file to a target location.
define transform-prebuilt-to-target
-@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) Prebuilt: $(PRIVATE_MODULE) ($@)"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Prebuilt: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
endef
# Copy a prebuilt file to a target location, using zipalign on it.
define transform-prebuilt-to-target-with-zipalign
-@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) Prebuilt APK: $(PRIVATE_MODULE) ($@)"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Prebuilt APK: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target-with-zipalign)
endef
# Copy a prebuilt file to a target location, stripping "# comment" comments.
define transform-prebuilt-to-target-strip-comments
-@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) Prebuilt: $(PRIVATE_MODULE) ($@)"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Prebuilt: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target-strip-comments)
endef
@@ -2764,7 +2918,7 @@
###########################################################
define transform-generated-source
-@echo "target Generated: $(PRIVATE_MODULE) <= $<"
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Generated: $(PRIVATE_MODULE) <= $<"
@mkdir -p $(dir $@)
$(hide) $(PRIVATE_CUSTOM_TOOL)
endef
@@ -2977,6 +3131,48 @@
$(if $(filter $(TARGET_2ND_ARCH),$(1)),$(TARGET_2ND_ARCH),$(if $(1),none))))
endef
+# ###############################################################
+# Set up statistics gathering
+# ###############################################################
+STATS.MODULE_TYPE := \
+ HOST_STATIC_LIBRARY \
+ HOST_SHARED_LIBRARY \
+ STATIC_LIBRARY \
+ SHARED_LIBRARY \
+ EXECUTABLE \
+ HOST_EXECUTABLE \
+ PACKAGE \
+ PHONY_PACKAGE \
+ HOST_PREBUILT \
+ PREBUILT \
+ MULTI_PREBUILT \
+ JAVA_LIBRARY \
+ STATIC_JAVA_LIBRARY \
+ HOST_JAVA_LIBRARY \
+ DROIDDOC \
+ COPY_HEADERS \
+ NATIVE_TEST \
+ NATIVE_BENCHMARK \
+ HOST_NATIVE_TEST \
+ FUZZ_TEST \
+ HOST_FUZZ_TEST \
+ STATIC_TEST_LIBRARY \
+ HOST_STATIC_TEST_LIBRARY \
+ NOTICE_FILE \
+ HOST_DALVIK_JAVA_LIBRARY \
+ HOST_DALVIK_STATIC_JAVA_LIBRARY \
+ base_rules
+
+$(foreach $(s),$(STATS.MODULE_TYPE),$(eval STATS.MODULE_TYPE.$(s) :=))
+define record-module-type
+$(strip $(if $(LOCAL_RECORDED_MODULE_TYPE),,
+ $(if $(filter-out $(SOONG_ANDROID_MK),$(LOCAL_MODULE_MAKEFILE)),
+ $(if $(filter $(1),$(STATS.MODULE_TYPE)),
+ $(eval LOCAL_RECORDED_MODULE_TYPE := true)
+ $(eval STATS.MODULE_TYPE.$(1) += 1),
+ $(error Invalid module type: $(1))))))
+endef
+
###########################################################
## Other includes
###########################################################
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index f98df12..a70ab03 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -14,6 +14,7 @@
# limitations under the License.
#
+$(call record-module-type,DROIDDOC)
##
##
## Common to both droiddoc and javadoc
diff --git a/core/dumpvar.mk b/core/dumpvar.mk
index 4b3486a..74ea3ff 100644
--- a/core/dumpvar.mk
+++ b/core/dumpvar.mk
@@ -22,7 +22,8 @@
HOST_CROSS_2ND_ARCH \
HOST_BUILD_TYPE \
BUILD_ID \
- OUT_DIR
+ OUT_DIR \
+ AUX_OS_VARIANT_LIST
ifeq ($(TARGET_BUILD_PDK),true)
print_build_config_vars += \
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 124bb25..d521039 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -164,6 +164,11 @@
$(error Use `MALLOC_SVELTE := true` to configure jemalloc for low-memory)
endif
TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
+ifneq ($(ENABLE_TREBLE),true)
+ifneq ($(BOARD_WRAPS_CONVENTIONAL_HALS),)
+$(error BOARD_WRAPS_CONVENTIONAL_HALS cannot be defined when ENABLE_TREBLE is not set to true)
+endif
+endif
board_config_mk :=
###########################################
@@ -274,6 +279,9 @@
HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
HOST_OUT_FAKE := $(HOST_OUT)/fake_packages
+# Nano environment config
+include $(BUILD_SYSTEM)/aux_config.mk
+
HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj
HOST_CROSS_OUT_HEADERS := $(HOST_CROSS_OUT_INTERMEDIATES)/include
HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES := $(HOST_CROSS_OUT_INTERMEDIATES)/lib
diff --git a/core/executable.mk b/core/executable.mk
index 8652077..f1b2462 100644
--- a/core/executable.mk
+++ b/core/executable.mk
@@ -16,6 +16,7 @@
endif
ifneq (true,$(my_skip_this_target))
+$(call record-module-type,EXECUTABLE)
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
# If a native test explicity specifies to build only for the translation arch,
diff --git a/core/fuzz_test.mk b/core/fuzz_test.mk
index fc582b3..c31e2e7 100644
--- a/core/fuzz_test.mk
+++ b/core/fuzz_test.mk
@@ -2,6 +2,7 @@
## A thin wrapper around BUILD_EXECUTABLE
## Common flags for fuzz tests are added.
###########################################
+$(call record-module-type,FUZZ_TEST)
ifdef LOCAL_SDK_VERSION
$(error $(LOCAL_PATH): $(LOCAL_MODULE): NDK fuzz tests are not supported.)
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 7fdf249..cee3cc4 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+$(call record-module-type,HOST_DALVIK_JAVA_LIBRARY)
#
# Rules for building a host dalvik java library. These libraries
diff --git a/core/host_dalvik_static_java_library.mk b/core/host_dalvik_static_java_library.mk
index b79c0ea..78faf73 100644
--- a/core/host_dalvik_static_java_library.mk
+++ b/core/host_dalvik_static_java_library.mk
@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+$(call record-module-type,HOST_DALVIK_STATIC_JAVA_LIBRARY)
#
# Rules for building a host dalvik static java library.
diff --git a/core/host_executable.mk b/core/host_executable.mk
index 0060c3e..78223eb 100644
--- a/core/host_executable.mk
+++ b/core/host_executable.mk
@@ -1,3 +1,4 @@
+$(call record-module-type,HOST_EXECUTABLE)
LOCAL_IS_HOST_MODULE := true
my_prefix := HOST_
LOCAL_HOST_PREFIX :=
diff --git a/core/host_fuzz_test.mk b/core/host_fuzz_test.mk
index cc7baad..1c9eed2 100644
--- a/core/host_fuzz_test.mk
+++ b/core/host_fuzz_test.mk
@@ -2,6 +2,7 @@
## A thin wrapper around BUILD_HOST_EXECUTABLE
## Common flags for host fuzz tests are added.
################################################
+$(call record-module-type,HOST_FUZZ_TEST)
LOCAL_CFLAGS += -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp
LOCAL_STATIC_LIBRARIES += libLLVMFuzzer
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index 9aa2a7c..0a7dd8a 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -14,6 +14,8 @@
# limitations under the License.
#
+$(call record-module-type,HOST_JAVA_LIBRARY)
+
#
# Standard rules for building a host java library.
#
diff --git a/core/host_native_test.mk b/core/host_native_test.mk
index 2a6097d..aa05bb3 100644
--- a/core/host_native_test.mk
+++ b/core/host_native_test.mk
@@ -2,6 +2,7 @@
## A thin wrapper around BUILD_HOST_EXECUTABLE
## Common flags for host native tests are added.
################################################
+$(call record-module-type,HOST_NATIVE_TEST)
ifdef LOCAL_MODULE_CLASS
ifneq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS)
diff --git a/core/host_prebuilt.mk b/core/host_prebuilt.mk
index 7baab69..79f3ffa 100644
--- a/core/host_prebuilt.mk
+++ b/core/host_prebuilt.mk
@@ -14,5 +14,6 @@
# limitations under the License.
#
+$(call record-module-type,HOST_PREBUILT)
LOCAL_IS_HOST_MODULE := true
include $(BUILD_MULTI_PREBUILT)
diff --git a/core/host_shared_library.mk b/core/host_shared_library.mk
index 2e0c9f1c..df24b63 100644
--- a/core/host_shared_library.mk
+++ b/core/host_shared_library.mk
@@ -1,3 +1,4 @@
+$(call record-module-type,HOST_SHARED_LIBRARY)
LOCAL_IS_HOST_MODULE := true
my_prefix := HOST_
LOCAL_HOST_PREFIX :=
diff --git a/core/host_static_library.mk b/core/host_static_library.mk
index 068c702..61f5569 100644
--- a/core/host_static_library.mk
+++ b/core/host_static_library.mk
@@ -1,3 +1,4 @@
+$(call record-module-type,HOST_STATIC_LIBRARY)
LOCAL_IS_HOST_MODULE := true
my_prefix := HOST_
LOCAL_HOST_PREFIX :=
diff --git a/core/host_static_test_lib.mk b/core/host_static_test_lib.mk
index 5423dc6..a24cd62 100644
--- a/core/host_static_test_lib.mk
+++ b/core/host_static_test_lib.mk
@@ -2,6 +2,7 @@
## A thin wrapper around BUILD_HOST_STATIC_LIBRARY
## Common flags for host native tests are added.
##################################################
+$(call record-module-type,HOST_STATIC_TEST_LIBRARY)
include $(BUILD_SYSTEM)/host_test_internal.mk
diff --git a/core/java_library.mk b/core/java_library.mk
index 283e9ad..b132fa6 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -2,6 +2,7 @@
## Standard rules for building a java library.
##
###########################################################
+$(call record-module-type,JAVA_LIBRARY)
ifdef LOCAL_IS_HOST_MODULE
$(error $(LOCAL_PATH): Host java libraries must use BUILD_HOST_JAVA_LIBRARY)
diff --git a/core/main.mk b/core/main.mk
index a1179c9..47280af 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -453,6 +453,9 @@
$(error The 'sdk' target may not be specified with any other targets)
endif
+# AUX dependencies are already added by now; remove triggers from the MAKECMDGOALS
+MAKECMDGOALS := $(strip $(filter-out AUX-%,$(MAKECMDGOALS)))
+
# TODO: this should be eng I think. Since the sdk is built from the eng
# variant.
tags_to_install := debug eng
@@ -933,6 +936,8 @@
all_modules: $(my_all_modules)
endif
+.PHONY: auxiliary
+auxiliary: $(INSTALLED_AUX_TARGETS)
# Build files and then package it into the rom formats
.PHONY: droidcore
@@ -1127,4 +1132,7 @@
tidy_only:
@echo Successfully make tidy_only.
+ndk: $(SOONG_OUT_DIR)/ndk.timestamp
+.PHONY: ndk
+
endif # KATI
diff --git a/core/multi_prebuilt.mk b/core/multi_prebuilt.mk
index ed2fed6..77c57ab 100644
--- a/core/multi_prebuilt.mk
+++ b/core/multi_prebuilt.mk
@@ -14,6 +14,7 @@
# limitations under the License.
#
+$(call record-module-type,MULTI_PREBUILT)
ifneq ($(LOCAL_MODULE)$(LOCAL_MODULE_CLASS),)
$(error $(LOCAL_PATH): LOCAL_MODULE or LOCAL_MODULE_CLASS not needed by \
BUILD_MULTI_PREBUILT, use BUILD_PREBUILT instead!)
diff --git a/core/native_benchmark.mk b/core/native_benchmark.mk
index ac37701..e73bcad 100644
--- a/core/native_benchmark.mk
+++ b/core/native_benchmark.mk
@@ -2,6 +2,7 @@
## A thin wrapper around BUILD_EXECUTABLE
## Common flags for native benchmarks are added.
###########################################
+$(call record-module-type,NATIVE_BENCHMARK)
LOCAL_STATIC_LIBRARIES += libgoogle-benchmark
diff --git a/core/native_test.mk b/core/native_test.mk
index bb93eb0..8b49fbd 100644
--- a/core/native_test.mk
+++ b/core/native_test.mk
@@ -2,6 +2,7 @@
## A thin wrapper around BUILD_EXECUTABLE
## Common flags for native tests are added.
###########################################
+$(call record-module-type,NATIVE_TEST)
ifdef LOCAL_MODULE_CLASS
ifneq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS)
diff --git a/core/ninja.mk b/core/ninja.mk
index 6b2a75b..100a993 100644
--- a/core/ninja.mk
+++ b/core/ninja.mk
@@ -17,6 +17,7 @@
DUMP_% \
ECLIPSE-% \
PRODUCT-% \
+ AUX-% \
boottarball-nodeps \
brillo_tests \
btnod \
diff --git a/core/notice_files.mk b/core/notice_files.mk
index e7f8974..f0013c2 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -1,6 +1,7 @@
###########################################################
## Track NOTICE files
###########################################################
+$(call record-module-type,NOTICE_FILE)
ifneq ($(LOCAL_NOTICE_FILE),)
notice_file:=$(strip $(LOCAL_NOTICE_FILE))
diff --git a/core/package.mk b/core/package.mk
index 8c2c435..4fe058d 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -2,6 +2,8 @@
# TARGET_ARCH and TARGET_2ND_ARCH.
# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_MULTILIB := 32".
+$(call record-module-type,PACKAGE)
+
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
LOCAL_MULTILIB := first
endif
diff --git a/core/phony_package.mk b/core/phony_package.mk
index b534335..578d629 100644
--- a/core/phony_package.mk
+++ b/core/phony_package.mk
@@ -1,3 +1,4 @@
+$(call record-module-type,PHONY_PACKAGE)
ifneq ($(strip $(LOCAL_SRC_FILES)),)
$(error LOCAL_SRC_FILES are not allowed for phony packages)
endif
diff --git a/core/prebuilt.mk b/core/prebuilt.mk
index cbe2079..5831e24 100644
--- a/core/prebuilt.mk
+++ b/core/prebuilt.mk
@@ -5,6 +5,7 @@
## None.
##
###########################################################
+$(call record-module-type,PREBUILT)
ifdef LOCAL_IS_HOST_MODULE
my_prefix := HOST_
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 4e7d1cd..f02879b 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -46,9 +46,18 @@
$(LOCAL_PACK_MODULE_RELOCATIONS))
ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS))
- # Put the built targets of all shared libraries in a common directory
- # to simplify the link line.
- OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
+ # LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES indicates that this prebuilt should be
+ # installed to the common directory of libraries. This is needed for the NDK
+ # shared libraries built by soong, as we build many different versions of each
+ # library (one for each API level). Since they all have the same basename,
+ # they'd clobber each other (as well as any platform libraries by the same
+ # name).
+ ifneq ($(LOCAL_COPY_TO_INTERMEDIATE_LIBRARIES),false)
+ # Put the built targets of all shared libraries in a common directory
+ # to simplify the link line.
+ OVERRIDE_BUILT_MODULE_PATH := \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
+ endif
ifeq ($(LOCAL_IS_HOST_MODULE)$(my_strip_module),)
# Strip but not try to add debuglink
my_strip_module := no_debuglink
diff --git a/core/product_config.mk b/core/product_config.mk
index 0d4ced3..6438d51 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -74,7 +74,7 @@
###########################################################
define find-copy-subdir-files
-$(shell find $(2) -name "$(1)" | $(SED_EXTENDED) "s:($(2)/?(.*)):\\1\\:$(3)/\\2:" | sed "s://:/:g")
+$(sort $(shell find $(2) -name "$(1)" -type f | $(SED_EXTENDED) "s:($(2)/?(.*)):\\1\\:$(3)/\\2:" | sed "s://:/:g"))
endef
# ---------------------------------------------------------------
diff --git a/core/shared_library.mk b/core/shared_library.mk
index 2f48341..a15b1a6 100644
--- a/core/shared_library.mk
+++ b/core/shared_library.mk
@@ -1,3 +1,4 @@
+$(call record-module-type,SHARED_LIBRARY)
my_prefix := TARGET_
include $(BUILD_SYSTEM)/multilib.mk
diff --git a/core/soong.mk b/core/soong.mk
index c96ca2f..cb0a0d0 100644
--- a/core/soong.mk
+++ b/core/soong.mk
@@ -25,6 +25,13 @@
$(hide) mkdir -p $(dir $@)
$(hide) BUILDDIR=$(SOONG_OUT_DIR) ./bootstrap.bash
+BINDER32BIT :=
+ifneq ($(TARGET_USES_64_BIT_BINDER),true)
+ifneq ($(TARGET_IS_64_BIT),true)
+BINDER32BIT := true
+endif
+endif
+
# Create soong.variables with copies of makefile settings. Runs every build,
# but only updates soong.variables if it changes
SOONG_VARIABLES_TMP := $(SOONG_VARIABLES).$$$$
@@ -44,6 +51,7 @@
echo ' "HostStaticBinaries": $(if $(strip $(BUILD_HOST_static)),true,false),'; \
echo ' "Cpusets": $(if $(strip $(ENABLE_CPUSETS)),true,false),'; \
echo ' "Schedboost": $(if $(strip $(ENABLE_SCHEDBOOST)),true,false),'; \
+ echo ' "Binder32bit": $(if $(BINDER32BIT),true,false),'; \
echo ''; \
echo ' "DeviceName": "$(TARGET_DEVICE)",'; \
echo ' "DeviceArch": "$(TARGET_ARCH)",'; \
diff --git a/core/static_java_library.mk b/core/static_java_library.mk
index 3295c06..258c5f8 100644
--- a/core/static_java_library.mk
+++ b/core/static_java_library.mk
@@ -19,6 +19,7 @@
# classpaths. They can, however, be included wholesale in
# other java modules.
+$(call record-module-type,STATIC_JAVA_LIBRARY)
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_IS_STATIC_JAVA_LIBRARY := true
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
diff --git a/core/static_library.mk b/core/static_library.mk
index a8ae399..25e5279 100644
--- a/core/static_library.mk
+++ b/core/static_library.mk
@@ -1,3 +1,4 @@
+$(call record-module-type,STATIC_LIBRARY)
my_prefix := TARGET_
include $(BUILD_SYSTEM)/multilib.mk
diff --git a/core/static_test_lib.mk b/core/static_test_lib.mk
index 9d0bcc8..a0e2970 100644
--- a/core/static_test_lib.mk
+++ b/core/static_test_lib.mk
@@ -2,6 +2,7 @@
## A thin wrapper around BUILD_STATIC_LIBRARY
## Common flags for native tests are added.
#############################################
+$(call record-module-type,STATIC_TEST_LIBRARY)
include $(BUILD_SYSTEM)/target_test_internal.mk
diff --git a/core/tasks/check_boot_jars/package_whitelist.txt b/core/tasks/check_boot_jars/package_whitelist.txt
index daf13fe..601017b 100644
--- a/core/tasks/check_boot_jars/package_whitelist.txt
+++ b/core/tasks/check_boot_jars/package_whitelist.txt
@@ -67,6 +67,8 @@
org\.w3c\.dom\.ls
org\.w3c\.dom\.traversal
# OpenJdk internal implementation.
+sun\.invoke\.util
+sun\.invoke\.empty
sun\.misc
sun\.util.*
sun\.text.*
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 13a04b3..3f0f424 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -25,7 +25,7 @@
# BUILD_ID
# BUILD_NUMBER
# BUILD_DATETIME
-# SECURITY_PATCH
+# PLATFORM_SECURITY_PATCH
#
# Look for an optional file containing overrides of the defaults,
@@ -113,7 +113,7 @@
# Must be of the form "YYYY-MM-DD" on production devices.
#
# If there is no $PLATFORM_SECURITY_PATCH set, keep it empty.
- PLATFORM_SECURITY_PATCH := 2016-09-01
+ PLATFORM_SECURITY_PATCH := 2016-09-05
endif
ifeq "" "$(PLATFORM_BASE_OS)"
diff --git a/envsetup.sh b/envsetup.sh
index 94970e7..b22b3ab 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1162,7 +1162,7 @@
Darwin)
function sgrep()
{
- find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|S|java|xml|sh|mk|aidl|vts)' \
+ find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|S|java|xml|sh|mk|aidl|vts|hal)' \
-exec grep --color -n "$@" {} +
}
@@ -1170,7 +1170,7 @@
*)
function sgrep()
{
- find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cc\|cpp\|S\|java\|xml\|sh\|mk\|aidl\|vts\)' \
+ find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cc\|cpp\|S\|java\|xml\|sh\|mk\|aidl\|vts\|hal\)' \
-exec grep --color -n "$@" {} +
}
;;
diff --git a/tools/atree/atree.cpp b/tools/atree/atree.cpp
index b134e01..7deca7e 100644
--- a/tools/atree/atree.cpp
+++ b/tools/atree/atree.cpp
@@ -92,7 +92,7 @@
// Escape the filename so that it can be added to the makefile properly.
static string
-escape_filename(const string name)
+escape_filename(const string& name)
{
ostringstream new_name;
for (string::const_iterator iter = name.begin(); iter != name.end(); ++iter)
diff --git a/tools/droiddoc/templates-sdk-dev/head_tag.cs b/tools/droiddoc/templates-sdk-dev/head_tag.cs
index abe6a4a..1d2974e 100644
--- a/tools/droiddoc/templates-sdk-dev/head_tag.cs
+++ b/tools/droiddoc/templates-sdk-dev/head_tag.cs
@@ -6,7 +6,7 @@
<meta name="top_category" value="<?cs
if:ndk ?>ndk<?cs
elif:(guide||develop||training||reference||tools||sdk||google||reference.gms||reference.gcm||samples) ?>develop<?cs
- elif:(topic||libraries||instantapps||perf) ?>develop<?cs
+ elif:(topic||libraries||instantapps||perf||arc) ?>develop<?cs
elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories||analyze) ?>distribute<?cs
elif:(design||vision||material||patterns||devices||designdownloads) ?>design<?cs
elif:(about||versions||wear||tv||auto) ?>about<?cs
@@ -35,10 +35,11 @@
if:(samplesDocPage&&!samplesProjectIndex) ?> samples-docpage<?cs /if ?><?cs
else ?>none<?cs set:dac_subcategory_set = #0 ?><?cs /if ?><?cs
elif:(google||reference.gms||reference.gcm) ?>google<?cs
- elif:(topic||libraries||perf) ?><?cs
+ elif:(topic||libraries||perf||arc) ?><?cs
if:libraries ?>libraries<?cs
elif:instantapps ?>instantapps<?cs
elif:perf ?>perf<?cs
+ elif:arc ?>arc<?cs
else ?>none<?cs set:dac_subcategory_set = #0 ?><?cs /if ?><?cs
elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories||analyze) ?><?cs
if:googleplay ?>googleplay<?cs
@@ -78,7 +79,8 @@
elif:(topic||libraries||perf) ?>/topic<?cs
if:libraries ?>/libraries<?cs
elif:instantapps ?>/instant-apps<?cs
- elif:perf ?>/performance<?cs /if ?><?cs
+ elif:perf ?>/performance<?cs
+ elif:arc ?>/arc<?cs /if ?><?cs
elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories||analyze) ?>/distribute<?cs
if:googleplay ?>/googleplay<?cs
elif:essentials ?>/essentials<?cs
diff --git a/tools/releasetools/check_target_files_signatures.py b/tools/releasetools/check_target_files_signatures.py
index 5c541ab..3048488 100755
--- a/tools/releasetools/check_target_files_signatures.py
+++ b/tools/releasetools/check_target_files_signatures.py
@@ -245,7 +245,7 @@
fullname = os.path.join(dirpath, fn)
displayname = fullname[len(d)+1:]
apk = APK(fullname, displayname)
- self.apks[apk.package] = apk
+ self.apks[apk.filename] = apk
self.apks_by_basename[os.path.basename(apk.filename)] = apk
self.max_pkg_len = max(self.max_pkg_len, len(apk.package))
@@ -316,8 +316,7 @@
self.max_pkg_len, apk.package,
apk.shared_uid)
else:
- print " %-*s %-*s" % (self.max_fn_len, apk.filename,
- self.max_pkg_len, apk.package)
+ print " %-*s %s" % (self.max_fn_len, apk.filename, apk.package)
print
def CompareWith(self, other):
diff --git a/tools/warn.py b/tools/warn.py
index 51349af..f118263 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -10,6 +10,10 @@
help='Generate a CSV file with number of various warnings',
action="store_true",
default=False)
+parser.add_argument('--byproject',
+ help='Separate warnings in HTML output by project names',
+ action="store_true",
+ default=False)
parser.add_argument('--url',
help='Root URL of an Android source code tree prefixed '
'before files in warnings')
@@ -70,6 +74,9 @@
'description':'make: overriding commands/ignoring old commands',
'patterns':[r".*: warning: overriding commands for target .+",
r".*: warning: ignoring old commands for target .+"] },
+ { 'category':'make', 'severity':severity.HIGH, 'members':[], 'option':'',
+ 'description':'make: LOCAL_CLANG is false',
+ 'patterns':[r".*: warning: LOCAL_CLANG is set to false"] },
{ 'category':'C/C++', 'severity':severity.HIGH, 'members':[], 'option':'-Wimplicit-function-declaration',
'description':'Implicit function declaration',
'patterns':[r".*: warning: implicit declaration of function .+",
@@ -1660,6 +1667,7 @@
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
'description':'Undefined result',
'patterns':[r".*: warning: The result of .+ is undefined",
+ r".*: warning: passing an object that .+ has undefined behavior \[-Wvarargs\]",
r".*: warning: 'this' pointer cannot be null in well-defined C\+\+ code;",
r".*: warning: shifting a negative signed value is undefined"] },
{ 'category':'C/C++', 'severity':severity.MEDIUM, 'members':[], 'option':'',
@@ -1774,6 +1782,21 @@
'description':'clang-tidy misc',
'patterns':[r".*: .+\[misc-.+\]$"] },
{ 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy performance-faster-string-find',
+ 'patterns':[r".*: .+\[performance-faster-string-find\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy performance-for-range-copy',
+ 'patterns':[r".*: .+\[performance-for-range-copy\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy performance-implicit-cast-in-loop',
+ 'patterns':[r".*: .+\[performance-implicit-cast-in-loop\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy performance-unnecessary-copy-initialization',
+ 'patterns':[r".*: .+\[performance-unnecessary-copy-initialization\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
+ 'description':'clang-tidy performance-unnecessary-value-param',
+ 'patterns':[r".*: .+\[performance-unnecessary-value-param\]$"] },
+ { 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
'description':'clang-tidy CERT',
'patterns':[r".*: .+\[cert-.+\]$"] },
{ 'category':'C/C++', 'severity':severity.TIDY, 'members':[], 'option':'',
@@ -1796,43 +1819,52 @@
# A list of [project_name, file_path_pattern].
# project_name should not contain comma, to be used in CSV output.
projectlist = [
- ['art', r"(^|.*/)art/.*: warning:"],
- ['bionic', r"(^|.*/)bionic/.*: warning:"],
- ['bootable', r"(^|.*/)bootable/.*: warning:"],
- ['build', r"(^|.*/)build/.*: warning:"],
- ['cts', r"(^|.*/)cts/.*: warning:"],
- ['dalvik', r"(^|.*/)dalvik/.*: warning:"],
- ['developers', r"(^|.*/)developers/.*: warning:"],
- ['development', r"(^|.*/)development/.*: warning:"],
- ['device', r"(^|.*/)device/.*: warning:"],
- ['doc', r"(^|.*/)doc/.*: warning:"],
- ['external', r"(^|.*/)external/.*: warning:"],
- ['frameworks', r"(^|.*/)frameworks/.*: warning:"],
- ['hardware', r"(^|.*/)hardware/.*: warning:"],
- ['kernel', r"(^|.*/)kernel/.*: warning:"],
- ['libcore', r"(^|.*/)libcore/.*: warning:"],
- ['libnativehelper', r"(^|.*/)libnativehelper/.*: warning:"],
- ['ndk', r"(^|.*/)ndk/.*: warning:"],
- ['packages', r"(^|.*/)packages/.*: warning:"],
- ['pdk', r"(^|.*/)pdk/.*: warning:"],
- ['prebuilts', r"(^|.*/)prebuilts/.*: warning:"],
- ['system', r"(^|.*/)system/.*: warning:"],
- ['toolchain', r"(^|.*/)toolchain/.*: warning:"],
- ['test', r"(^|.*/)test/.*: warning:"],
- ['tools', r"(^|.*/)tools/.*: warning:"],
- ['vendor', r"(^|.*/)vendor/.*: warning:"],
- ['out/obj', r".*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|STATIC_LIBRARIES)/.*: warning:"],
- ['other', r".*: warning:"],
+ ['art', r"(^|.*/)art/.*: warning:"],
+ ['bionic', r"(^|.*/)bionic/.*: warning:"],
+ ['bootable', r"(^|.*/)bootable/.*: warning:"],
+ ['build', r"(^|.*/)build/.*: warning:"],
+ ['cts', r"(^|.*/)cts/.*: warning:"],
+ ['dalvik', r"(^|.*/)dalvik/.*: warning:"],
+ ['developers', r"(^|.*/)developers/.*: warning:"],
+ ['development', r"(^|.*/)development/.*: warning:"],
+ ['device', r"(^|.*/)device/.*: warning:"],
+ ['doc', r"(^|.*/)doc/.*: warning:"],
+ # match external/google* before external/
+ ['external/google', r"(^|.*/)external/google.*: warning:"],
+ ['external/non-google', r"(^|.*/)external/.*: warning:"],
+ ['frameworks', r"(^|.*/)frameworks/.*: warning:"],
+ ['hardware', r"(^|.*/)hardware/.*: warning:"],
+ ['kernel', r"(^|.*/)kernel/.*: warning:"],
+ ['libcore', r"(^|.*/)libcore/.*: warning:"],
+ ['libnativehelper', r"(^|.*/)libnativehelper/.*: warning:"],
+ ['ndk', r"(^|.*/)ndk/.*: warning:"],
+ ['packages', r"(^|.*/)packages/.*: warning:"],
+ ['pdk', r"(^|.*/)pdk/.*: warning:"],
+ ['prebuilts', r"(^|.*/)prebuilts/.*: warning:"],
+ ['system', r"(^|.*/)system/.*: warning:"],
+ ['toolchain', r"(^|.*/)toolchain/.*: warning:"],
+ ['test', r"(^|.*/)test/.*: warning:"],
+ ['tools', r"(^|.*/)tools/.*: warning:"],
+ # match vendor/google* before vendor/
+ ['vendor/google', r"(^|.*/)vendor/google.*: warning:"],
+ ['vendor/non-google', r"(^|.*/)vendor/.*: warning:"],
+ # keep out/obj and other patterns at the end.
+ ['out/obj', r".*/(gen|obj[^/]*)/(include|EXECUTABLES|SHARED_LIBRARIES|STATIC_LIBRARIES)/.*: warning:"],
+ ['other', r".*: warning:"],
]
projectpatterns = []
for p in projectlist:
projectpatterns.append({'description':p[0], 'members':[], 'pattern':re.compile(p[1])})
-# Each warning pattern has a dictionary that maps
-# a project name to number of warnings in that project.
+# Each warning pattern has 3 dictionaries:
+# (1) 'projects' maps a project name to number of warnings in that project.
+# (2) 'projectanchor' maps a project name to its anchor number for HTML.
+# (3) 'projectwarning' maps a project name to a list of warning of that project.
for w in warnpatterns:
w['projects'] = {}
+ w['projectanchor'] = {}
+ w['projectwarning'] = {}
platformversion = 'unknown'
targetproduct = 'unknown'
@@ -1937,17 +1969,12 @@
output('<blockquote>\n')
for i in warnpatterns:
if i['severity'] == sev and len(i['members']) > 0:
- output('\n<table frame="box">\n')
anchor += 1
i['anchor'] = str(anchor)
- mark = str(anchor) + '_mark'
- output('<tr bgcolor="' + colorforseverity(sev) + '">' +
- '<td><button class="bt" id="' + mark +
- '" onclick="expand(\'' + str(anchor) + '\');">' +
- '⊕</button> ' + descriptionfor(i) +
- ' (' + str(len(i['members'])) + ')</td></tr>\n')
- output('</table>\n')
- dumpcategory(i)
+ if args.byproject:
+ dumpcategorybyproject(sev, i)
+ else:
+ dumpcategory(sev, i)
output('</blockquote>\n')
def allpatterns(cat):
@@ -2002,19 +2029,35 @@
else:
return '<a href="' + args.url + '/' + filepath + '">' + filepath + '</a>:' + linenumber + ':' + warning
-# dump a category, provided it is not marked as 'SKIP' and has more than 0 occurrences
-def dumpcategory(cat):
- if cat['severity'] != severity.SKIP and len(cat['members']) != 0:
- header = [descriptionfor(cat),str(len(cat['members'])) + ' occurences:']
- if cat['option'] != '':
- header[1:1] = [' (related option: ' + cat['option'] +')']
+def dumpgroup(sev, anchor, description, warnings):
+ mark = anchor + '_mark'
+ output('\n<table frame="box">\n')
+ output('<tr bgcolor="' + colorforseverity(sev) + '">' +
+ '<td><button class="bt" id="' + mark +
+ '" onclick="expand(\'' + anchor + '\');">' +
+ '⊕</button> ' + description + '</td></tr>\n')
+ output('</table>\n')
+ output('<div id="' + anchor + '" style="display:none;">')
+ output('<table>\n')
+ for i in warnings:
+ tablerow(warningwithurl(i))
+ output('</table></div>\n')
- output('<div id="' + cat['anchor'] + '" style="display:none;">')
- output('<table>\n')
- for i in cat['members']:
- tablerow(warningwithurl(i))
- output('</table></div>\n')
+# dump warnings in a category
+def dumpcategory(sev, cat):
+ description = descriptionfor(cat) + ' (' + str(len(cat['members'])) + ')'
+ dumpgroup(sev, cat['anchor'], description, cat['members'])
+# similar to dumpcategory but output one table per project.
+def dumpcategorybyproject(sev, cat):
+ warning = descriptionfor(cat)
+ projects = cat['projectwarning'].keys()
+ projects.sort()
+ for p in projects:
+ anchor = cat['projectanchor'][p]
+ projectwarnings = cat['projectwarning'][p]
+ description = '{}, in {} ({})'.format(warning, p, len(projectwarnings))
+ dumpgroup(sev, anchor, description, projectwarnings)
def findproject(line):
for p in projectpatterns:
@@ -2023,15 +2066,26 @@
return '???'
def classifywarning(line):
+ global anchor
for i in warnpatterns:
for cpat in i['compiledpatterns']:
if cpat.match(line):
i['members'].append(line)
pname = findproject(line)
+ # Count warnings by project.
if pname in i['projects']:
- i['projects'][pname] += 1
+ i['projects'][pname] += 1
else:
- i['projects'][pname] = 1
+ i['projects'][pname] = 1
+ # Collect warnings by project.
+ if args.byproject:
+ if pname in i['projectwarning']:
+ i['projectwarning'][pname].append(line)
+ else:
+ i['projectwarning'][pname] = [line]
+ if pname not in i['projectanchor']:
+ anchor += 1
+ i['projectanchor'][pname] = str(anchor)
return
else:
# If we end up here, there was a problem parsing the log