am 22866695: am 2c2c0534: set a smaller line height for sidebox headers to avoid whitespace at the top
* commit '228666956ade81aa8f993eed70f361ec93073bad':
set a smaller line height for sidebox headers to avoid whitespace at the top
diff --git a/core/Makefile b/core/Makefile
index 27f22a9..25cce58 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -368,6 +368,22 @@
# #################################################################
# Targets for boot/OS images
# #################################################################
+ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
+ INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
+ ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
+ INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
+ else
+ INSTALLED_2NDBOOTLOADER_TARGET :=
+ endif
+else
+ INSTALLED_BOOTLOADER_MODULE :=
+ INSTALLED_2NDBOOTLOADER_TARGET :=
+endif # TARGET_NO_BOOTLOADER
+ifneq ($(strip $(TARGET_NO_KERNEL)),true)
+ INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
+else
+ INSTALLED_KERNEL_TARGET :=
+endif
# -----------------------------------------------------------------
# the ramdisk
@@ -1261,7 +1277,7 @@
ifdef PRODUCT_EXTRA_RECOVERY_KEYS
$(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
endif
- $(hide) echo "mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)" >> $(zip_root)/META/misc_info.txt
+ $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $(zip_root)/META/misc_info.txt
$(hide) echo "use_set_metadata=1" >> $(zip_root)/META/misc_info.txt
$(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt
$(hide) echo "update_rename_support=1" >> $(zip_root)/META/misc_info.txt
@@ -1298,7 +1314,8 @@
$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS)
@echo "Package OTA: $@"
- $(hide) ./build/tools/releasetools/ota_from_target_files -v \
+ $(hide) MKBOOTIMG=$(BOARD_CUSTOM_MKBOOTIMG) \
+ ./build/tools/releasetools/ota_from_target_files -v \
-p $(HOST_OUT) \
-k $(KEY_CERT_PAIR) \
$(BUILT_TARGET_FILES_PACKAGE) $@
@@ -1326,7 +1343,8 @@
$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS)
@echo "Package: $@"
- $(hide) ./build/tools/releasetools/img_from_target_files -v \
+ $(hide) MKBOOTIMG=$(BOARD_CUSTOM_MKBOOTIMG) \
+ ./build/tools/releasetools/img_from_target_files -v \
-s $(extensions) \
-p $(HOST_OUT) \
$(BUILT_TARGET_FILES_PACKAGE) $@
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 36f36c1..e87624a 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -41,6 +41,8 @@
my_host :=
endif
+my_module_tags := $(LOCAL_MODULE_TAGS)
+
###########################################################
## Validate and define fallbacks for input LOCAL_* variables.
###########################################################
@@ -50,17 +52,17 @@
#$(shell rm -f tag-list.csv)
#tag-list-first-time := false
#endif
-#$(shell echo $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST))),$(LOCAL_MODULE),$(strip $(LOCAL_MODULE_CLASS)),$(subst $(space),$(comma),$(sort $(LOCAL_MODULE_TAGS))) >> tag-list.csv)
+#$(shell echo $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST))),$(LOCAL_MODULE),$(strip $(LOCAL_MODULE_CLASS)),$(subst $(space),$(comma),$(sort $(my_module_tags))) >> tag-list.csv)
LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE))
-LOCAL_MODULE_TAGS := $(sort $(LOCAL_MODULE_TAGS))
-ifeq (,$(LOCAL_MODULE_TAGS))
- LOCAL_MODULE_TAGS := optional
+my_module_tags := $(sort $(my_module_tags))
+ifeq (,$(my_module_tags))
+ my_module_tags := optional
endif
# User tags are not allowed anymore. Fail early because it will not be installed
# like it used to be.
-ifneq ($(filter $(LOCAL_MODULE_TAGS),user),)
+ifneq ($(filter $(my_module_tags),user),)
$(warning *** Module name: $(LOCAL_MODULE))
$(warning *** Makefile location: $(LOCAL_MODULE_MAKEFILE))
$(warning * )
@@ -75,8 +77,8 @@
# Only the tags mentioned in this test are expected to be set by module
# makefiles. Anything else is either a typo or a source of unexpected
# behaviors.
-ifneq ($(filter-out debug eng tests optional samples shell_ash shell_mksh,$(LOCAL_MODULE_TAGS)),)
-$(warning unusual tags $(LOCAL_MODULE_TAGS) on $(LOCAL_MODULE) at $(LOCAL_PATH))
+ifneq ($(filter-out debug eng tests optional samples,$(my_module_tags)),)
+$(warning unusual tags $(my_module_tags) on $(LOCAL_MODULE) at $(LOCAL_PATH))
endif
# Add implicit tags.
@@ -88,7 +90,7 @@
#
gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL*)
ifneq ($(gpl_license_file),)
- LOCAL_MODULE_TAGS += gnu
+ my_module_tags += gnu
ALL_GPL_MODULE_LICENSE_FILES := $(sort $(ALL_GPL_MODULE_LICENSE_FILES) $(gpl_license_file))
endif
@@ -98,8 +100,9 @@
endif
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
-LOCAL_MODULE_PATH := $(strip $(LOCAL_MODULE_PATH))
-ifeq ($(LOCAL_MODULE_PATH),)
+my_module_path := $(strip $(LOCAL_MODULE_PATH))
+my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH))
+ifeq ($(my_module_path),)
ifdef LOCAL_IS_HOST_MODULE
partition_tag :=
else
@@ -108,35 +111,43 @@
else
# The definition of should-install-to-system will be different depending
# on which goal (e.g., sdk or just droid) is being built.
- partition_tag := $(if $(call should-install-to-system,$(LOCAL_MODULE_TAGS)),,_DATA)
+ partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA)
endif
endif
- install_path_var := $(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS)
+ install_path_var := $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS)
ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
install_path_var := $(install_path_var)_PRIVILEGED
endif
- LOCAL_MODULE_PATH := $($(install_path_var))
- ifeq ($(strip $(LOCAL_MODULE_PATH)),)
- $(error $(LOCAL_PATH): unhandled install path "$(install_path_var)")
+ my_module_path := $($(install_path_var))
+ ifeq ($(strip $(my_module_path)),)
+ $(error $(LOCAL_PATH): unhandled install path "$(install_path_var) for $(LOCAL_MODULE)")
endif
endif
+ifneq ($(my_module_relative_path),)
+ my_module_path := $(my_module_path)/$(my_module_relative_path)
+endif
endif # not LOCAL_UNINSTALLABLE_MODULE
ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),)
$(error $(LOCAL_PATH): LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE must not be defined by component makefiles)
endif
+my_register_name := $(LOCAL_MODULE)
+ifdef LOCAL_2ND_ARCH_VAR_PREFIX
+my_register_name := $(LOCAL_MODULE)$(TARGET_2ND_ARCH_MODULE_SUFFIX)
+endif
# Make sure that this IS_HOST/CLASS/MODULE combination is unique.
module_id := MODULE.$(if \
- $(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(LOCAL_MODULE)
+ $(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name)
ifdef $(module_id)
$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
endif
$(module_id) := $(LOCAL_PATH)
-intermediates := $(call local-intermediates-dir)
+intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX))
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
+generated_sources_dir := $(call local-generated-sources-dir)
###########################################################
# Pick a name for the intermediate and final targets
@@ -168,7 +179,7 @@
built_module_path :=
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
- LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_INSTALLED_MODULE_STEM)
+ LOCAL_INSTALLED_MODULE := $(my_module_path)/$(LOCAL_INSTALLED_MODULE_STEM)
endif
# Assemble the list of targets to create PRIVATE_ variables for.
@@ -393,8 +404,8 @@
# to guarantee that the files in full_java_libs will
# be up-to-date.
ifdef LOCAL_IS_HOST_MODULE
-ifeq ($(LOCAL_BUILD_HOST_DEX),true)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core-hostdex,$(LOCAL_IS_HOST_MODULE))
+ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-deps,core-hostdex,$(LOCAL_IS_HOST_MODULE))
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
@@ -459,8 +470,8 @@
###########################################################
## make clean- targets
###########################################################
-cleantarget := clean-$(LOCAL_MODULE)
-$(cleantarget) : PRIVATE_MODULE := $(LOCAL_MODULE)
+cleantarget := clean-$(my_register_name)
+$(cleantarget) : PRIVATE_MODULE := $(my_register_name)
$(cleantarget) : PRIVATE_CLEAN_FILES := \
$(LOCAL_BUILT_MODULE) \
$(LOCAL_INSTALLED_MODULE) \
@@ -502,13 +513,13 @@
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates)
# Tell the module and all of its sub-modules who it is.
-$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(LOCAL_MODULE)
+$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(my_register_name)
# Provide a short-hand for building this module.
# We name both BUILT and INSTALLED in case
# LOCAL_UNINSTALLABLE_MODULE is set.
-.PHONY: $(LOCAL_MODULE)
-$(LOCAL_MODULE): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE)
+.PHONY: $(my_register_name)
+$(my_register_name): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE)
###########################################################
## Module installation rule
@@ -535,15 +546,6 @@
$(copy-file-to-target-with-cp)
endif
-ifdef LOCAL_DEX_PREOPT
-installed_odex := $(basename $(LOCAL_INSTALLED_MODULE)).odex
-built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
-$(installed_odex) : $(built_odex) $(LOCAL_BUILT_MODULE) | $(ACP)
- @echo "Install: $@"
- $(copy-file-to-target)
-
-$(LOCAL_INSTALLED_MODULE) : $(installed_odex)
-endif
endif # !LOCAL_UNINSTALLABLE_MODULE
@@ -567,60 +569,64 @@
ifdef LOCAL_DONT_CHECK_MODULE
LOCAL_CHECKED_MODULE :=
endif
+# Don't check build the module defined for the 2nd arch
+ifdef LOCAL_2ND_ARCH_VAR_PREFIX
+ LOCAL_CHECKED_MODULE :=
+endif
###########################################################
## Register with ALL_MODULES
###########################################################
-ALL_MODULES += $(LOCAL_MODULE)
+ALL_MODULES += $(my_register_name)
# Don't use += on subvars, or else they'll end up being
# recursively expanded.
-ALL_MODULES.$(LOCAL_MODULE).CLASS := \
- $(ALL_MODULES.$(LOCAL_MODULE).CLASS) $(LOCAL_MODULE_CLASS)
-ALL_MODULES.$(LOCAL_MODULE).PATH := \
- $(ALL_MODULES.$(LOCAL_MODULE).PATH) $(LOCAL_PATH)
-ALL_MODULES.$(LOCAL_MODULE).TAGS := \
- $(ALL_MODULES.$(LOCAL_MODULE).TAGS) $(LOCAL_MODULE_TAGS)
-ALL_MODULES.$(LOCAL_MODULE).CHECKED := \
- $(ALL_MODULES.$(LOCAL_MODULE).CHECKED) $(LOCAL_CHECKED_MODULE)
-ALL_MODULES.$(LOCAL_MODULE).BUILT := \
- $(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(LOCAL_BUILT_MODULE)
-ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
- $(strip $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE))
-ALL_MODULES.$(LOCAL_MODULE).REQUIRED := \
- $(ALL_MODULES.$(LOCAL_MODULE).REQUIRED) $(LOCAL_REQUIRED_MODULES)
-ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS := \
- $(ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS) $(event_log_tags)
-ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR := \
- $(ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
-ALL_MODULES.$(LOCAL_MODULE).MAKEFILE := \
- $(ALL_MODULES.$(LOCAL_MODULE).MAKEFILE) $(LOCAL_MODULE_MAKEFILE)
+ALL_MODULES.$(my_register_name).CLASS := \
+ $(ALL_MODULES.$(my_register_name).CLASS) $(LOCAL_MODULE_CLASS)
+ALL_MODULES.$(my_register_name).PATH := \
+ $(ALL_MODULES.$(my_register_name).PATH) $(LOCAL_PATH)
+ALL_MODULES.$(my_register_name).TAGS := \
+ $(ALL_MODULES.$(my_register_name).TAGS) $(my_module_tags)
+ALL_MODULES.$(my_register_name).CHECKED := \
+ $(ALL_MODULES.$(my_register_name).CHECKED) $(LOCAL_CHECKED_MODULE)
+ALL_MODULES.$(my_register_name).BUILT := \
+ $(ALL_MODULES.$(my_register_name).BUILT) $(LOCAL_BUILT_MODULE)
+ALL_MODULES.$(my_register_name).INSTALLED := \
+ $(strip $(ALL_MODULES.$(my_register_name).INSTALLED) $(LOCAL_INSTALLED_MODULE))
+ALL_MODULES.$(my_register_name).REQUIRED := \
+ $(ALL_MODULES.$(my_register_name).REQUIRED) $(LOCAL_REQUIRED_MODULES)
+ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \
+ $(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags)
+ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \
+ $(ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
+ALL_MODULES.$(my_register_name).MAKEFILE := \
+ $(ALL_MODULES.$(my_register_name).MAKEFILE) $(LOCAL_MODULE_MAKEFILE)
ifdef LOCAL_MODULE_OWNER
-ALL_MODULES.$(LOCAL_MODULE).OWNER := \
- $(sort $(ALL_MODULES.$(LOCAL_MODULE).OWNER) $(LOCAL_MODULE_OWNER))
+ALL_MODULES.$(my_register_name).OWNER := \
+ $(sort $(ALL_MODULES.$(my_register_name).OWNER) $(LOCAL_MODULE_OWNER))
endif
-INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(LOCAL_MODULE)
+INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)
###########################################################
-## Take care of LOCAL_MODULE_TAGS
+## Take care of my_module_tags
###########################################################
# Keep track of all the tags we've seen.
-ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(LOCAL_MODULE_TAGS))
+ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(my_module_tags))
# Add this module to the tag list of each specified tag.
# Don't use "+=". If the variable hasn't been set with ":=",
# it will default to recursive expansion.
-$(foreach tag,$(LOCAL_MODULE_TAGS),\
+$(foreach tag,$(my_module_tags),\
$(eval ALL_MODULE_TAGS.$(tag) := \
$(ALL_MODULE_TAGS.$(tag)) \
$(LOCAL_INSTALLED_MODULE)))
# Add this module name to the tag list of each specified tag.
-$(foreach tag,$(LOCAL_MODULE_TAGS),\
- $(eval ALL_MODULE_NAME_TAGS.$(tag) += $(LOCAL_MODULE)))
+$(foreach tag,$(my_module_tags),\
+ $(eval ALL_MODULE_NAME_TAGS.$(tag) += $(my_register_name)))
###########################################################
## umbrella targets used to verify builds
@@ -641,7 +647,7 @@
ifdef j_or_n
$(j_or_n) $(h_or_t) $(j_or_n)-$(h_or_t) : $(LOCAL_CHECKED_MODULE)
-ifneq (,$(filter $(LOCAL_MODULE_TAGS),tests))
+ifneq (,$(filter $(my_module_tags),tests))
$(j_or_n)-$(h_or_t)-tests $(j_or_n)-tests $(h_or_t)-tests : $(LOCAL_CHECKED_MODULE)
endif
endif
diff --git a/core/binary.mk b/core/binary.mk
index 554b8c7..adc2f44 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -14,7 +14,7 @@
$(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
endif
my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources
- my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_ARCH)
+ my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
# Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location.
# See ndk/docs/CPLUSPLUS-SUPPORT.html
@@ -35,16 +35,16 @@
ifneq (,$(filter stlport_%, $(LOCAL_NDK_STL_VARIANT)))
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/stlport/stlport
ifeq (stlport_static,$(LOCAL_NDK_STL_VARIANT))
- my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_static.a
+ my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libstlport_static.a
else
- my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_shared.so
+ my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libstlport_shared.so
my_ndk_stl_shared_lib := -lstlport_shared
endif
else
# LOCAL_NDK_STL_VARIANT is gnustl_static
- my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/include \
+ my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/include \
$(my_ndk_source_root)/cxx-stl/gnu-libstdc++/include
- my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/libgnustl_static.a
+ my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libgnustl_static.a
endif
endif
endif
@@ -82,11 +82,29 @@
include $(BUILD_SYSTEM)/base_rules.mk
#######################################
+# The following LOCAL_ variables will be modified in this file.
+# Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch,
+# we can't modify them in place.
+my_src_files := $(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+my_static_libraries := $(LOCAL_STATIC_LIBRARIES)
+my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
+my_cflags := $(LOCAL_CFLAGS) $(LOCAL_CFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+my_cppflags := $(LOCAL_CPPFLAGS)
+my_ldflags := $(LOCAL_LDFLAGS) $(LOCAL_LDFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+my_asflags := $(LOCAL_ASFLAGS) $(LOCAL_ASFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+my_cc := $(LOCAL_CC)
+my_cxx := $(LOCAL_CXX)
+my_c_includes := $(LOCAL_C_INCLUDES) $(LOCAL_C_INCLUDES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+my_generated_sources := $(LOCAL_GENERATED_SOURCES)
+
+my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags))
+
# The real dependency will be added after all Android.mks are loaded and the install paths
# of the shared libraries are determined.
ifdef LOCAL_INSTALLED_MODULE
ifdef installed_shared_library_module_names
-$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
+$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
+ $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
endif
endif
@@ -94,17 +112,17 @@
ifdef LOCAL_HAL_STATIC_LIBRARIES
$(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \
$(eval b_lib := $(filter $(lib).%,$(BOARD_HAL_STATIC_LIBRARIES)))\
- $(if $(b_lib), $(eval LOCAL_STATIC_LIBRARIES += $(b_lib)),\
- $(eval LOCAL_STATIC_LIBRARIES += $(lib).default)))
+ $(if $(b_lib), $(eval my_static_libraries += $(b_lib)),\
+ $(eval my_static_libraries += $(lib).default)))
b_lib :=
endif
ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
LOCAL_CLANG := true
- LOCAL_CFLAGS += $(ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS)
- LOCAL_LDFLAGS += $(ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS)
- LOCAL_SHARED_LIBRARIES += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
- LOCAL_STATIC_LIBRARIES += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
+ my_cflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS)
+ my_ldflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS)
+ my_shared_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
+ my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
endif
ifeq ($(strip $(WITHOUT_CLANG)),true)
@@ -113,63 +131,79 @@
# Add in libcompiler_rt for all regular device builds
ifeq (,$(LOCAL_SDK_VERSION)$(LOCAL_IS_HOST_MODULE)$(WITHOUT_LIBCOMPILER_RT))
- LOCAL_STATIC_LIBRARIES += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
+ my_static_libraries += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
endif
my_compiler_dependencies :=
ifeq ($(strip $(LOCAL_CLANG)),true)
- LOCAL_CFLAGS += $(CLANG_CONFIG_EXTRA_CFLAGS)
- LOCAL_ASFLAGS += $(CLANG_CONFIG_EXTRA_ASFLAGS)
- LOCAL_LDFLAGS += $(CLANG_CONFIG_EXTRA_LDFLAGS)
my_compiler_dependencies := $(CLANG) $(CLANG_CXX)
endif
####################################################
## Add FDO flags if FDO is turned on and supported
####################################################
-ifeq ($(strip $(LOCAL_NO_FDO_SUPPORT)),)
- LOCAL_CFLAGS += $(TARGET_FDO_CFLAGS)
- LOCAL_CPPFLAGS += $(TARGET_FDO_CFLAGS)
- LOCAL_LDFLAGS += $(TARGET_FDO_CFLAGS)
-endif
-
-####################################################
-## Add profiling flags if aprof is turned on
-####################################################
-ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
- # -ffunction-sections and -fomit-frame-pointer are conflict with -pg
- LOCAL_CFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg
- LOCAL_CPPFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg
+ifneq ($(strip $(LOCAL_FDO_SUPPORT)),)
+ ifeq ($(strip $(LOCAL_IS_HOST_MODULE)),)
+ my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS)
+ my_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS)
+ my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS)
+ endif
endif
###########################################################
## Explicitly declare assembly-only __ASSEMBLY__ macro for
## assembly source
###########################################################
-LOCAL_ASFLAGS += -D__ASSEMBLY__
+my_asflags += -D__ASSEMBLY__
###########################################################
## Define PRIVATE_ variables from global vars
###########################################################
+ifndef LOCAL_IS_HOST_MODULE
ifdef LOCAL_SDK_VERSION
my_target_project_includes :=
my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include
else
-my_target_project_includes := $(TARGET_PROJECT_INCLUDES)
-my_target_c_includes := $(TARGET_C_INCLUDES)
+my_target_project_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES)
+my_target_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_C_INCLUDES)
endif # LOCAL_SDK_VERSION
ifeq ($(LOCAL_CLANG),true)
-my_target_global_cflags := $(TARGET_GLOBAL_CLANG_FLAGS)
+my_target_global_cflags := $(CLANG_TARGET_GLOBAL_CFLAGS)
+my_target_global_cppflags := $(CLANG_TARGET_GLOBAL_CPPFLAGS)
+my_target_global_ldflags := $(CLANG_TARGET_GLOBAL_LDFLAGS)
my_target_c_includes += $(CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES)
else
-my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS)
+my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS)
+my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS)
+my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
endif # LOCAL_CLANG
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(TARGET_GLOBAL_CPPFLAGS)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
+
+else # LOCAL_IS_HOST_MODULE
+
+ifeq ($(LOCAL_CLANG),true)
+my_host_global_cflags := $(CLANG_HOST_GLOBAL_CFLAGS)
+my_host_global_cppflags := $(CLANG_HOST_GLOBAL_CPPFLAGS)
+my_host_global_ldflags := $(CLANG_HOST_GLOBAL_LDFLAGS)
+my_host_c_includes := $(HOST_C_INCLUDES) $(CLANG_CONFIG_EXTRA_HOST_C_INCLUDES)
+else
+my_host_global_cflags := $(HOST_GLOBAL_CFLAGS)
+my_host_global_cppflags := $(HOST_GLOBAL_CPPFLAGS)
+my_host_global_ldflags := $(HOST_GLOBAL_LDFLAGS)
+my_host_c_includes := $(HOST_C_INCLUDES)
+endif # LOCAL_CLANG
+
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_C_INCLUDES := $(my_host_c_includes)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags)
+endif # LOCAL_IS_HOST_MODULE
###########################################################
## Define PRIVATE_ variables used by multiple module types
@@ -177,23 +211,51 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
$(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
-ifeq ($(strip $(LOCAL_CC)),)
- ifeq ($(strip $(LOCAL_CLANG)),true)
- LOCAL_CC := $(CLANG)
- else
- LOCAL_CC := $($(my_prefix)CC)
- endif
+ifeq ($(strip $(WITH_SYNTAX_CHECK)),)
+ LOCAL_NO_SYNTAX_CHECK := true
endif
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(LOCAL_CC)
-ifeq ($(strip $(LOCAL_CXX)),)
+ifeq ($(strip $(WITH_STATIC_ANALYZER)),)
+ LOCAL_NO_STATIC_ANALYZER := true
+endif
+
+ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
+ my_syntax_arch := host
+else
+ my_syntax_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
+endif
+
+ifeq ($(strip $(my_cc)),)
ifeq ($(strip $(LOCAL_CLANG)),true)
- LOCAL_CXX := $(CLANG_CXX)
+ my_cc := $(CLANG)
else
- LOCAL_CXX := $($(my_prefix)CXX)
+ my_cc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CC)
endif
endif
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(LOCAL_CXX)
+ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
+ my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer $(my_syntax_arch) "$(my_cc)"
+else
+ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
+ my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-syntax $(my_syntax_arch) "$(my_cc)"
+endif
+endif
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc)
+
+ifeq ($(strip $(my_cxx)),)
+ ifeq ($(strip $(LOCAL_CLANG)),true)
+ my_cxx := $(CLANG_CXX)
+ else
+ my_cxx := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CXX)
+ endif
+endif
+ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
+ my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-analyzer $(my_syntax_arch) "$(my_cxx)"
+else
+ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
+ my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-syntax $(my_syntax_arch) "$(my_cxx)"
+endif
+endif
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
# TODO: support a mix of standard extensions so that this isn't necessary
LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
@@ -206,7 +268,7 @@
# up if --no-undefined is passed to the linker.
ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),)
ifeq ($(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)),)
- LOCAL_LDFLAGS := $(LOCAL_LDFLAGS) $($(my_prefix)NO_UNDEFINED_LDFLAGS)
+ my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)NO_UNDEFINED_LDFLAGS)
endif
endif
@@ -220,19 +282,18 @@
## Define arm-vs-thumb-mode flags.
###########################################################
LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
-ifeq ($(TARGET_ARCH),arm)
+ifeq ($(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),arm)
arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm)
normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
# Read the values from something like TARGET_arm_CFLAGS or
# TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't
# actually used (although they are usually empty).
+arm_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(arm_objects_mode)_CFLAGS)
+normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS)
ifeq ($(strip $(LOCAL_CLANG)),true)
-arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_CLANG_CFLAGS)
-normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_CLANG_CFLAGS)
-else
-arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_CFLAGS)
-normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_CFLAGS)
+arm_objects_cflags := $(call convert-to-$(my_host)clang-flags,$(arm_objects_cflags))
+normal_objects_cflags := $(call convert-to-$(my_host)clang-flags,$(normal_objects_cflags))
endif
else
@@ -259,7 +320,7 @@
## Compile RenderScript with reflected C++
####################################################
-renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES))
+renderscript_sources := $(filter %.rs %.fs,$(my_src_files))
ifneq (,$(renderscript_sources))
@@ -276,16 +337,16 @@
renderscript_flags := -Wall -Werror
renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
-LOCAL_RENDERSCRIPT_INCLUDES := \
+renderscript_includes := \
$(TOPDIR)external/clang/lib/Headers \
$(TOPDIR)frameworks/rs/scriptc \
$(LOCAL_RENDERSCRIPT_INCLUDES)
ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
-LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
+renderscript_includes := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
endif
-$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
+$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(renderscript_includes)
$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
@@ -306,8 +367,8 @@
$(rs_generated_cpps) : $(RenderScript_file_stamp)
-LOCAL_C_INCLUDES += $(renderscript_intermediate)
-LOCAL_GENERATED_SOURCES += $(rs_generated_cpps)
+my_c_includes += $(renderscript_intermediate)
+my_generated_sources += $(rs_generated_cpps)
endif
@@ -315,15 +376,22 @@
###########################################################
## Stuff source generated from one-off tools
###########################################################
-$(LOCAL_GENERATED_SOURCES): PRIVATE_MODULE := $(LOCAL_MODULE)
+$(my_generated_sources): PRIVATE_MODULE := $(my_register_name)
-ALL_GENERATED_SOURCES += $(LOCAL_GENERATED_SOURCES)
+my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources)))
+$(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% | $(ACP)
+ @echo "Copy: $@"
+ $(copy-file-to-target)
+
+my_generated_sources := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(my_generated_sources))
+
+ALL_GENERATED_SOURCES += $(my_generated_sources)
###########################################################
## Compile the .proto files to .cc and then to .o
###########################################################
-proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
+proto_sources := $(filter %.proto,$(my_src_files))
proto_generated_objects :=
proto_generated_headers :=
ifneq ($(proto_sources),)
@@ -348,12 +416,12 @@
$(transform-$(PRIVATE_HOST)cpp-to-o)
-include $(proto_generated_objects:%.o=%.P)
-LOCAL_C_INCLUDES += external/protobuf/src $(proto_generated_cc_sources_dir)
-LOCAL_CFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI
+my_c_includes += external/protobuf/src $(proto_generated_cc_sources_dir)
+my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full)
-LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-2.3.0-full
+my_static_libraries += libprotobuf-cpp-2.3.0-full
else
-LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-2.3.0-lite
+my_static_libraries += libprotobuf-cpp-2.3.0-lite
endif
endif
@@ -362,7 +430,7 @@
## YACC: Compile .y files to .cpp and the to .o.
###########################################################
-yacc_sources := $(filter %.y,$(LOCAL_SRC_FILES))
+yacc_sources := $(filter %.y,$(my_src_files))
yacc_cpps := $(addprefix \
$(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
@@ -385,7 +453,7 @@
## LEX: Compile .l files to .cpp and then to .o.
###########################################################
-lex_sources := $(filter %.l,$(LOCAL_SRC_FILES))
+lex_sources := $(filter %.l,$(my_src_files))
lex_cpps := $(addprefix \
$(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
@@ -410,10 +478,10 @@
# we also do this on host modules, even though
# it's not really arm, because there are files that are shared.
-cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(LOCAL_SRC_FILES)))
+cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(my_src_files)))
cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o))
-cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_SRC_FILES))
+cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_src_files))
cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o))
$(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
@@ -437,7 +505,7 @@
## C++: Compile generated .cpp files to .o.
###########################################################
-gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_GENERATED_SOURCES))
+gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_generated_sources))
gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o)
ifneq ($(strip $(gen_cpp_objects)),)
@@ -458,7 +526,7 @@
## S: Compile generated .S and .s files to .o.
###########################################################
-gen_S_sources := $(filter %.S,$(LOCAL_GENERATED_SOURCES))
+gen_S_sources := $(filter %.S,$(my_generated_sources))
gen_S_objects := $(gen_S_sources:%.S=%.o)
ifneq ($(strip $(gen_S_sources)),)
@@ -469,7 +537,7 @@
-include $(gen_S_objects:%.o=%.P)
endif
-gen_s_sources := $(filter %.s,$(LOCAL_GENERATED_SOURCES))
+gen_s_sources := $(filter %.s,$(my_generated_sources))
gen_s_objects := $(gen_s_sources:%.s=%.o)
ifneq ($(strip $(gen_s_objects)),)
@@ -486,16 +554,16 @@
## o: Include generated .o files in output.
###########################################################
-gen_o_objects := $(filter %.o,$(LOCAL_GENERATED_SOURCES))
+gen_o_objects := $(filter %.o,$(my_generated_sources))
###########################################################
## C: Compile .c files to .o.
###########################################################
-c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(LOCAL_SRC_FILES)))
+c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(my_src_files)))
c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o))
-c_normal_sources := $(filter %.c,$(LOCAL_SRC_FILES))
+c_normal_sources := $(filter %.c,$(my_src_files))
c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o))
$(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
@@ -517,7 +585,7 @@
## C: Compile generated .c files to .o.
###########################################################
-gen_c_sources := $(filter %.c,$(LOCAL_GENERATED_SOURCES))
+gen_c_sources := $(filter %.c,$(my_generated_sources))
gen_c_objects := $(gen_c_sources:%.c=%.o)
ifneq ($(strip $(gen_c_objects)),)
@@ -536,7 +604,7 @@
## ObjC: Compile .m files to .o
###########################################################
-objc_sources := $(filter %.m,$(LOCAL_SRC_FILES))
+objc_sources := $(filter %.m,$(my_src_files))
objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o))
ifneq ($(strip $(objc_objects)),)
@@ -551,7 +619,7 @@
## AS: Compile .S files to .o.
###########################################################
-asm_sources_S := $(filter %.S,$(LOCAL_SRC_FILES))
+asm_sources_S := $(filter %.S,$(my_src_files))
asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
ifneq ($(strip $(asm_objects_S)),)
@@ -562,7 +630,7 @@
-include $(asm_objects_S:%.o=%.P)
endif
-asm_sources_s := $(filter %.s,$(LOCAL_SRC_FILES))
+asm_sources_s := $(filter %.s,$(my_src_files))
asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
ifneq ($(strip $(asm_objects_s)),)
@@ -582,9 +650,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))/export_includes) \
- $(foreach l, $(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
- $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes))
+ $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes) \
+ $(foreach l, $(my_static_libraries) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
+ $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes))
$(import_includes) : $(import_includes_deps)
@echo Import includes file: $@
$(hide) mkdir -p $(dir $@) && rm -f $@
@@ -617,24 +685,26 @@
all_objects := $(normal_objects) $(gen_o_objects)
-LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates)
+my_c_includes += $(TOPDIR)$(LOCAL_PATH) $(intermediates)
ifndef LOCAL_SDK_VERSION
- LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
+ my_c_includes += $(JNI_H_INCLUDE)
endif
# all_objects includes gen_o_objects which were part of LOCAL_GENERATED_SOURCES;
# use normal_objects here to avoid creating circular dependencies. This assumes
# that custom build rules which generate .o files don't consume other generated
# sources as input (or if they do they take care of that dependency themselves).
-$(normal_objects) : | $(LOCAL_GENERATED_SOURCES)
+$(normal_objects) : | $(my_generated_sources)
$(all_objects) : | $(import_includes)
ALL_C_CPP_ETC_OBJECTS += $(all_objects)
###########################################################
## Copy headers to the install tree
###########################################################
+ifndef LOCAL_2ND_ARCH_VAR_PREFIX
include $(BUILD_COPY_HEADERS)
+endif
###########################################################
# Standard library handling.
@@ -671,9 +741,9 @@
ifdef LOCAL_SDK_VERSION
built_shared_libraries := \
- $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
+ $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
$(addsuffix $(so_suffix), \
- $(LOCAL_SHARED_LIBRARIES)))
+ $(my_shared_libraries)))
my_system_shared_libraries_fullpath := \
$(my_ndk_stl_shared_lib_fullpath) \
@@ -681,19 +751,19 @@
$(addsuffix $(so_suffix), $(LOCAL_SYSTEM_SHARED_LIBRARIES)))
built_shared_libraries += $(my_system_shared_libraries_fullpath)
-LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
+my_shared_libraries += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
else
-LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
+my_shared_libraries += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
built_shared_libraries := \
- $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
+ $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
$(addsuffix $(so_suffix), \
- $(LOCAL_SHARED_LIBRARIES)))
+ $(my_shared_libraries)))
endif
built_static_libraries := \
- $(foreach lib,$(LOCAL_STATIC_LIBRARIES), \
+ $(foreach lib,$(my_static_libraries), \
$(call intermediates-dir-for, \
- STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
+ STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/$(lib)$(a_suffix))
ifdef LOCAL_SDK_VERSION
built_static_libraries += $(my_ndk_stl_static_lib)
@@ -702,7 +772,7 @@
built_whole_libraries := \
$(foreach lib,$(LOCAL_WHOLE_STATIC_LIBRARIES), \
$(call intermediates-dir-for, \
- STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
+ STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/$(lib)$(a_suffix))
# We don't care about installed static libraries, since the
# libraries have already been linked into the module at that point.
@@ -710,7 +780,7 @@
# libraries that we use. (see notice_files.mk)
installed_static_library_notice_file_targets := \
- $(foreach lib,$(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
+ $(foreach lib,$(my_static_libraries) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
# Default is -fno-rtti.
@@ -721,18 +791,26 @@
###########################################################
# Rule-specific variable definitions
###########################################################
+
+ifeq ($(LOCAL_CLANG),true)
+my_cflags := $(call convert-to-$(my_host)clang-flags,$(my_cflags))
+my_cppflags := $(call convert-to-$(my_host)clang-flags,$(my_cppflags))
+my_asflags := $(call convert-to-$(my_host)clang-flags,$(my_asflags))
+my_ldflags := $(call convert-to-$(my_host)clang-flags,$(my_ldflags))
+endif
+
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(LOCAL_ASFLAGS)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(LOCAL_CONLYFLAGS)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(LOCAL_CPPFLAGS)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(my_cflags)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(my_cppflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(LOCAL_C_INCLUDES)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(LOCAL_LDFLAGS)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(LOCAL_NO_CRT)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(strip $(LOCAL_NO_CRT) $(LOCAL_NO_CRT_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
# this is really the way to get the files onto the command line instead
# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work
diff --git a/core/build-system.html b/core/build-system.html
index 760589a..caade58 100644
--- a/core/build-system.html
+++ b/core/build-system.html
@@ -247,7 +247,6 @@
for <code>eng</code>.
<ul>
<li>Installs modules tagged with: <code>eng</code>, <code>debug</code>,
- <code>shell_</code>$(TARGET_SHELL),
<code>user</code>, and/or <code>development</code>.
<li>Installs non-APK modules that have no tags specified.
<li>Installs APKs according to the product definition files, in
@@ -267,7 +266,7 @@
<p>
This is the flavor intended to be the final release bits.
<ul>
- <li>Installs modules tagged with <code>shell_</code>$(TARGET_SHELL) and <code>user</code>.
+ <li>Installs modules tagged with <code>user</code>.
<li>Installs non-APK modules that have no tags specified.
<li>Installs APKs according to the product definition files; tags
are ignored for APK modules.
@@ -384,7 +383,7 @@
if you need them again later.</p>
<p>By default, on the target these are built into /system/bin, and on the
host, they're built into <combo>/host/bin. These can be overridden by setting
-<code>LOCAL_MODULE_PATH</code>. See
+<code>LOCAL_MODULE_PATH</code> or <code>LOCAL_MODULE_RELATIVE_PATH</code>. See
<a href="#moving-targets">Putting targets elsewhere</a>
for more.</p>
@@ -410,8 +409,8 @@
need to change.</p>
<p>You need to put this after you have declared <code>LOCAL_PATH</code> and
-<code>LOCAL_MODULE</code>, because the <code>$(local-intermediates-dir)</code>
-and <code>$(local-host-intermediates-dir)</code> macros use these variables
+<code>LOCAL_MODULE</code>, because the <code>$(local-generated-sources-dir)</code>
+and <code>$(local-host-generated-sources-dir)</code> macros use these variables
to determine where to put the files.
<h5>Example 1</h5>
@@ -420,7 +419,7 @@
built to $(HOST_OUT_EXECUTABLES)/dftables. Note on the second to last line
that a dependency is created on the tool.</p>
<pre>
-intermediates:= $(local-intermediates-dir)
+intermediates:= $(local-generated-sources-dir)
GEN := $(intermediates)/<font color=red>chartables.c</font>
$(GEN): PRIVATE_CUSTOM_TOOL = <font color=red>$(HOST_OUT_EXECUTABLES)/dftables $@</font>
$(GEN): <font color=red>$(HOST_OUT_EXECUTABLES)/dftables</font>
@@ -434,7 +433,7 @@
target-specific variable called PRIVATE_INPUT_FILE to store the name of the
input file.</p>
<pre>
-intermediates:= $(local-intermediates-dir)
+intermediates:= $(local-generated-sources-dir)
GEN := $(intermediates)/<font color=red>file.c</font>
$(GEN): PRIVATE_INPUT_FILE := $(LOCAL_PATH)/<font color=red>input.file</font>
$(GEN): PRIVATE_CUSTOM_TOOL = <font color=red>cat $(PRIVATE_INPUT_FILE) > $@</font>
@@ -448,7 +447,7 @@
name, and use the same tool, you can combine them. (here the *.lut.h files are
the generated ones, and the *.cpp files are the input files)</p>
<pre>
-intermediates:= $(local-intermediates-dir)
+intermediates:= $(local-generated-sources-dir)
GEN := $(addprefix $(intermediates)<font color=red>/kjs/, \
array_object.lut.h \
bool_object.lut.h \</font>
@@ -534,16 +533,27 @@
<h3><a name="moving-modules"/>Putting modules elsewhere</h3>
<p>If you have modules that normally go somewhere, and you need to have them
-build somewhere else, read this. One use of this is putting files on
-the root filesystem instead of where they normally go in /system. Add these
-lines to your Android.mk:</p>
+build somewhere else, read this.</p>
+<p>If you have modules that need to go in a subdirectory of their normal
+location, for example HAL modules that need to go in /system/lib/hw or
+/vendor/lib/hw, set LOCAL_MODULE_RELATIVE_PATH in your Android.mk, for
+example:</p>
+<pre>
+LOCAL_MODULE_RELATIVE_PATH := hw
+</pre>
+<p>If you have modules that need to go in an entirely different location, for
+example the root filesystem instead of in /system, add these lines to your
+Android.mk:</p>
<pre>
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
</pre>
-<p>For executables and libraries, you need to also specify a
-<code>LOCAL_UNSTRIPPED_PATH</code> location, because on target builds, we keep
-the unstripped executables so GDB can find the symbols.</code>
+<p>For executables and libraries, you need to specify a
+<code>LOCAL_UNSTRIPPED_PATH</code> location if you specified a
+<code>LOCAL_MODULE_PATH</code>, because on target builds, we keep
+the unstripped executables so GDB can find the symbols.
+<code>LOCAL_UNSTRIPPED_PATH</code> is not necessary if you only specified
+<code>LOCAL_MODULE_RELATIVE_PATH</code>.</p>
<p>Look in <code>config/envsetup.make</code> for all of the variables defining
places to build things.</p>
<p>FYI: If you're installing an executable to /sbin, you probably also want to
@@ -674,8 +684,7 @@
<h4>LOCAL_MODULE_TAGS</h4>
<p>Set <code>LOCAL_MODULE_TAGS</code> to any number of whitespace-separated
tags. If the tag list is empty or contains <code>droid</code>, the module
-will get installed as part of a <code>make droid</code>. Modules with the tag
-<code>shell_</code>$(TARGET_SHELL) will also be installed. Otherwise, it will
+will get installed as part of a <code>make droid</code>. Otherwise, it will
only get installed by running <code>make <your-module></code>
or with the <code>make all</code> pseudotarget.</p>
@@ -820,6 +829,13 @@
to.</p>
<p>See <a href="#moving-modules">Putting modules elsewhere</a> for more.</p>
+<h4>LOCAL_MODULE_RELATIVE_PATH</h4>
+<p>Instructs the build system to put the module in a subdirectory under the
+directory that is normal for its type. If you set this you do not need to
+set <code>LOCAL_UNSTRIPPED_PATH</code>, the unstripped binaries will also use
+the relative path.</p>
+<p>See <a href="#moving-modules">Putting modules elsewhere</a> for more.</p>
+
<h4>LOCAL_UNSTRIPPED_PATH</h4>
<p>Instructs the build system to put the unstripped version of the module
somewhere other than what's normal for its type. Usually, you override this
diff --git a/core/build_id.mk b/core/build_id.mk
index 64ad133..aaf4185 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -18,6 +18,6 @@
# (like "CRB01"). It must be a single word, and is
# capitalized by convention.
-BUILD_ID := KK
+BUILD_ID := OPENMASTER
DISPLAY_BUILD_NUMBER := true
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 9713b6e..2419260 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -4,6 +4,7 @@
LOCAL_MODULE:=
LOCAL_MODULE_PATH:=
+LOCAL_MODULE_RELATIVE_PATH :=
LOCAL_MODULE_STEM:=
LOCAL_DONT_CHECK_MODULE:=
LOCAL_CHECKED_MODULE:=
@@ -37,7 +38,7 @@
LOCAL_CXX:=
LOCAL_CPP_EXTENSION:=
LOCAL_NO_DEFAULT_COMPILER_FLAGS:=
-LOCAL_NO_FDO_SUPPORT :=
+LOCAL_FDO_SUPPORT:=
LOCAL_ARM_MODE:=
LOCAL_YACCFLAGS:=
LOCAL_ASFLAGS:=
@@ -83,8 +84,6 @@
LOCAL_COPY_HEADERS:=
LOCAL_FORCE_STATIC_EXECUTABLE:=
LOCAL_ADDITIONAL_DEPENDENCIES:=
-LOCAL_ENABLE_APROF:=
-LOCAL_ENABLE_APROF_JNI:=
LOCAL_COMPRESS_MODULE_SYMBOLS:=
LOCAL_STRIP_MODULE:=
LOCAL_JNI_SHARED_LIBRARIES:=
@@ -106,6 +105,7 @@
LOCAL_PROGUARD_ENABLED:= # '',full,custom,nosystem,disabled,obfuscation,optimization
LOCAL_PROGUARD_FLAGS:=
LOCAL_PROGUARD_FLAG_FILES:=
+LOCAL_TEST_MODULE_TO_PROGUARD_WITH:=
LOCAL_EMMA_COVERAGE_FILTER:=
LOCAL_WARNINGS_ENABLE:=
LOCAL_FULL_MANIFEST_FILE:=
@@ -119,6 +119,7 @@
LOCAL_RENDERSCRIPT_TARGET_API:=
LOCAL_BUILD_HOST_DEX:=
LOCAL_DEX_PREOPT:= # '',true,false,nostripping
+LOCAL_DEX_PREOPT_IMAGE:=
LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,full
LOCAL_PROTOC_FLAGS:=
LOCAL_PROTO_JAVA_OUTPUT_PARAMS:=
@@ -141,7 +142,26 @@
LOCAL_POST_INSTALL_CMD:=
LOCAL_DIST_BUNDLED_BINARIES:=
LOCAL_HAL_STATIC_LIBRARIES:=
-LOCAL_TEST_MODULE_TO_PROGUARD_WITH:=
+LOCAL_NO_SYNTAX_CHECK:=
+LOCAL_NO_STATIC_ANALYZER:=
+LOCAL_32BIT_ONLY:= # '',true
+LOCAL_NO_2ND_ARCH:= # '',true
+
+# arch specific variables
+LOCAL_SRC_FILES_$(TARGET_ARCH):=
+LOCAL_CFLAGS_$(TARGET_ARCH):=
+LOCAL_C_INCLUDES_$(TARGET_ARCH):=
+LOCAL_ASFLAGS_$(TARGET_ARCH):=
+LOCAL_NO_CRT_$(TARGET_ARCH):=
+LOCAL_LDFLAGS_$(TARGET_ARCH):=
+ifdef TARGET_2ND_ARCH
+LOCAL_SRC_FILES_$(TARGET_2ND_ARCH):=
+LOCAL_CFLAGS_$(TARGET_2ND_ARCH):=
+LOCAL_C_INCLUDES_$(TARGET_2ND_ARCH):=
+LOCAL_ASFLAGS_$(TARGET_2ND_ARCH):=
+LOCAL_NO_CRT_$(TARGET_2ND_ARCH):=
+LOCAL_LDFLAGS_$(TARGET_2ND_ARCH):=
+endif
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
# iterate over thousands of entries every time.
diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk
index c6a155a..578cd42 100644
--- a/core/combo/HOST_linux-x86.mk
+++ b/core/combo/HOST_linux-x86.mk
@@ -39,12 +39,12 @@
# more consistency between the host tools and the target.
# BUILD_HOST_64bit=1 overrides it for tool like emulator
# which can benefit from 64-bit host arch.
-HOST_GLOBAL_CFLAGS += -m64
-HOST_GLOBAL_LDFLAGS += -m64
+HOST_GLOBAL_CFLAGS += -m64 -Wa,--noexecstack
+HOST_GLOBAL_LDFLAGS += -m64 -Wl,-z,noexecstack
else
# We expect SSE3 floating point math.
-HOST_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse -m32
-HOST_GLOBAL_LDFLAGS += -m32
+HOST_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse -m32 -Wa,--noexecstack
+HOST_GLOBAL_LDFLAGS += -m32 -Wl,-z,noexecstack
endif # BUILD_HOST_64bit
ifneq ($(strip $(BUILD_HOST_static)),)
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 4d0d936..f6971c5 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -30,51 +30,51 @@
# include defines, and compiler settings for the given architecture
# version.
#
-ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
-TARGET_ARCH_VARIANT := armv5te
+ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)),)
+TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := armv5te
endif
ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
-TARGET_GCC_VERSION := 4.7
+$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := 4.8
else
-TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
+$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
endif
-TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT).mk
+TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT).mk
ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),)
-$(error Unknown ARM architecture version: $(TARGET_ARCH_VARIANT))
+$(error Unknown ARM architecture version: $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
endif
include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
-ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
-TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)
-TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/arm-linux-androideabi-
+ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)),)
+$(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$($(combo_2nd_arch_prefix)TARGET_GCC_VERSION)
+$(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX := $($(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/bin/arm-linux-androideabi-
endif
-TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
-TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
-TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
-TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
-TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
-TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_CC := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_CXX := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_AR := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_OBJCOPY := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_LD := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_STRIP := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
ifeq ($(TARGET_BUILD_VARIANT),user)
- TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@
+ $(combo_2nd_arch_prefix)TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@
else
- TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@ && \
- $(TARGET_OBJCOPY) --add-gnu-debuglink=$< $@
+ $(combo_2nd_arch_prefix)TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@ && \
+ $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
endif
-TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+$(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
-TARGET_arm_CFLAGS := -O2 \
+$(combo_2nd_arch_prefix)TARGET_arm_CFLAGS := -O2 \
-fomit-frame-pointer \
-fstrict-aliasing \
-funswitch-loops
# Modules can choose to compile some source as thumb.
-TARGET_thumb_CFLAGS := -mthumb \
+$(combo_2nd_arch_prefix)TARGET_thumb_CFLAGS := -mthumb \
-Os \
-fomit-frame-pointer \
-fno-strict-aliasing
@@ -89,13 +89,13 @@
# with -mlong-calls. When built at -O0, those libraries are
# too big for a thumb "BL <label>" to go from one end to the other.
ifeq ($(FORCE_ARM_DEBUGGING),true)
- TARGET_arm_CFLAGS += -fno-omit-frame-pointer -fno-strict-aliasing
- TARGET_thumb_CFLAGS += -marm -fno-omit-frame-pointer
+ $(combo_2nd_arch_prefix)TARGET_arm_CFLAGS += -fno-omit-frame-pointer -fno-strict-aliasing
+ $(combo_2nd_arch_prefix)TARGET_thumb_CFLAGS += -marm -fno-omit-frame-pointer
endif
android_config_h := $(call select-android-config-h,linux-arm)
-TARGET_GLOBAL_CFLAGS += \
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \
-msoft-float -fpic -fPIE \
-ffunction-sections \
-fdata-sections \
@@ -109,12 +109,12 @@
-include $(android_config_h) \
-I $(dir $(android_config_h))
-# This warning causes dalvik not to build with gcc 4.6+ and -Werror.
-# We cannot turn it off blindly since the option is not available
-# in gcc-4.4.x. We also want to disable sincos optimization globally
-# by turning off the builtin sin function.
-ifneq ($(filter 4.6 4.6.% 4.7 4.7.%, $(TARGET_GCC_VERSION)),)
-TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable -fno-builtin-sin \
+# The "-Wunused-but-set-variable" option often breaks projects that enable
+# "-Wall -Werror" due to a commom idiom "ALOGV(mesg)" where ALOGV is turned
+# into no-op in some builds while mesg is defined earlier. So we explicitly
+# disable "-Wunused-but-set-variable" here.
+ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8, $($(combo_2nd_arch_prefix)TARGET_GCC_VERSION)),)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable -fno-builtin-sin \
-fno-strict-volatile-bitfields
endif
@@ -126,9 +126,9 @@
# in their exported C++ functions). Also, GCC 4.5 has already
# removed the warning from the compiler.
#
-TARGET_GLOBAL_CFLAGS += -Wno-psabi
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -Wno-psabi
-TARGET_GLOBAL_LDFLAGS += \
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += \
-Wl,-z,noexecstack \
-Wl,-z,relro \
-Wl,-z,now \
@@ -137,12 +137,12 @@
-Wl,--icf=safe \
$(arch_variant_ldflags)
-TARGET_GLOBAL_CFLAGS += -mthumb-interwork
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -mthumb-interwork
-TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
# More flags/options can be added here
-TARGET_RELEASE_CFLAGS := \
+$(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS := \
-DNDEBUG \
-g \
-Wstrict-aliasing=2 \
@@ -153,84 +153,74 @@
libc_root := bionic/libc
libm_root := bionic/libm
libstdc++_root := bionic/libstdc++
-libthread_db_root := bionic/libthread_db
## on some hosts, the target cross-compiler is not available so do not run this command
-ifneq ($(wildcard $(TARGET_CC)),)
+ifneq ($(wildcard $($(combo_2nd_arch_prefix)TARGET_CC)),)
# We compile with the global cflags to ensure that
# any flags which affect libgcc are correctly taken
# into account.
-TARGET_LIBGCC := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) -print-libgcc-file-name)
-target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
+$(combo_2nd_arch_prefix)TARGET_LIBGCC := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) \
+ $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) -print-libgcc-file-name)
+target_libgcov := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
-print-file-name=libgcov.a)
endif
# Define FDO (Feedback Directed Optimization) options.
-TARGET_FDO_CFLAGS:=
-TARGET_FDO_LIB:=
+$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS:=
+$(combo_2nd_arch_prefix)TARGET_FDO_LIB:=
ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),)
# Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation.
# The profile will be generated on /data/local/tmp/profile on the device.
- TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO
- TARGET_FDO_LIB := $(target_libgcov)
+ $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO
+ $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov)
else
# If BUILD_FDO_INSTRUMENT is turned off, then consider doing the FDO optimizations.
# Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build.
- ifeq ($(strip $(TARGET_FDO_PROFILE_PATH)),)
- TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT)
+ ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)),)
+ $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)
else
- ifeq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
- $(warning Custom TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.)
+ ifeq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),)
+ $(warning Custom $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.)
endif
endif
# If the FDO profile directory can't be found, then FDO is off.
- ifneq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
- TARGET_FDO_CFLAGS := -fprofile-use=$(TARGET_FDO_PROFILE_PATH) -DANDROID_FDO
- TARGET_FDO_LIB := $(target_libgcov)
+ ifneq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),)
+ $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-use=$($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) -DANDROID_FDO
+ $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov)
endif
endif
-# unless CUSTOM_KERNEL_HEADERS is defined, we're going to use
-# symlinks located in out/ to point to the appropriate kernel
-# headers. see 'config/kernel_headers.make' for more details
-#
-ifneq ($(CUSTOM_KERNEL_HEADERS),)
- KERNEL_HEADERS_COMMON := $(CUSTOM_KERNEL_HEADERS)
- KERNEL_HEADERS_ARCH := $(CUSTOM_KERNEL_HEADERS)
-else
- KERNEL_HEADERS_COMMON := $(libc_root)/kernel/common
- KERNEL_HEADERS_ARCH := $(libc_root)/kernel/arch-$(TARGET_ARCH)
-endif
+KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
+KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-$(TARGET_$(combo_2nd_arch_prefix)ARCH)
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
-TARGET_C_INCLUDES := \
+$(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \
$(libc_root)/arch-arm/include \
$(libc_root)/include \
$(libstdc++_root)/include \
$(KERNEL_HEADERS) \
$(libm_root)/include \
$(libm_root)/include/arm \
- $(libthread_db_root)/include
-TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
-TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
-TARGET_CRTEND_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
+$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_STATIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
+$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_DYNAMIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
+$(combo_2nd_arch_prefix)TARGET_CRTEND_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
-TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
-TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
+$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
+$(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
-TARGET_STRIP_MODULE:=true
+$(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true
-TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
+$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
-TARGET_CUSTOM_LD_COMMAND := true
+$(combo_2nd_arch_prefix)TARGET_CUSTOM_LD_COMMAND := true
-define transform-o-to-shared-lib-inner
+define $(combo_2nd_arch_prefix)transform-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
-nostdlib -Wl,-soname,$(notdir $@) \
-Wl,--gc-sections \
@@ -245,16 +235,16 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
+ $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBGCC) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O))
endef
-define transform-o-to-executable-inner
+define $(combo_2nd_arch_prefix)transform-o-to-executable-inner
$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \
-Wl,-dynamic-linker,/system/bin/linker \
-Wl,--gc-sections \
@@ -270,16 +260,16 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
+ $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBGCC) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
endef
-define transform-o-to-static-executable-inner
+define $(combo_2nd_arch_prefix)transform-o-to-static-executable-inner
$(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \
-Wl,--gc-sections \
-o $@ \
diff --git a/core/combo/TARGET_linux-arm64.mk b/core/combo/TARGET_linux-arm64.mk
new file mode 100644
index 0000000..76ee567
--- /dev/null
+++ b/core/combo/TARGET_linux-arm64.mk
@@ -0,0 +1,229 @@
+#
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Configuration for Linux on ARM.
+# Included by combo/select.mk
+
+# You can set TARGET_ARCH_VARIANT to use an arch version other
+# than ARMv5TE. Each value should correspond to a file named
+# $(BUILD_COMBOS)/arch/<name>.mk which must contain
+# makefile variable definitions similar to the preprocessor
+# defines in build/core/combo/include/arch/<combo>/AndroidConfig.h. Their
+# purpose is to allow module Android.mk files to selectively compile
+# different versions of code based upon the funtionality and
+# instructions available in a given architecture version.
+#
+# The blocks also define specific arch_variant_cflags, which
+# include defines, and compiler settings for the given architecture
+# version.
+#
+ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
+TARGET_ARCH_VARIANT := armv8
+endif
+
+ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
+TARGET_GCC_VERSION := 4.8
+else
+TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
+endif
+
+TARGET_IS_64_BIT := true
+
+TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT).mk
+ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),)
+$(error Unknown ARM architecture version: $(TARGET_ARCH_VARIANT))
+endif
+
+# TODO: Enable Clang when aarch64 prebuilt is added
+WITHOUT_CLANG := true
+
+include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
+
+# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
+ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
+TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/aarch64/aarch64-linux-android-$(TARGET_GCC_VERSION)
+TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/aarch64-linux-android-
+endif
+
+TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
+TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
+ifeq ($(TARGET_BUILD_VARIANT),user)
+ TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@
+else
+ TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@ && \
+ $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
+endif
+
+TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+
+TARGET_GLOBAL_CFLAGS += \
+ -fno-strict-aliasing \
+
+android_config_h := $(call select-android-config-h,linux-arm64)
+
+TARGET_GLOBAL_CFLAGS += \
+ -fpic -fPIE \
+ -ffunction-sections \
+ -fdata-sections \
+ -funwind-tables \
+ -Wa,--noexecstack \
+ -Werror=format-security \
+ -D_FORTIFY_SOURCE=2 \
+ -fno-short-enums \
+ $(arch_variant_cflags) \
+ -include $(android_config_h) \
+ -I $(dir $(android_config_h))
+
+# HACK: globally disable -fstack-protector until the toolchain supports it
+TARGET_GLOBAL_UNSUPPORTED_CFLAGS := -fstack-protector
+
+# TODO - remove __ANDROID__ after the next aarch64 toolchain refresh
+TARGET_GLOBAL_CFLAGS += -D__ANDROID__=1
+
+TARGET_GLOBAL_CFLAGS += -fno-strict-volatile-bitfields
+
+# This is to avoid the dreaded warning compiler message:
+# note: the mangling of 'va_list' has changed in GCC 4.4
+#
+# The fact that the mangling changed does not affect the NDK ABI
+# very fortunately (since none of the exposed APIs used va_list
+# in their exported C++ functions). Also, GCC 4.5 has already
+# removed the warning from the compiler.
+#
+TARGET_GLOBAL_CFLAGS += -Wno-psabi
+
+# TODO - temporarily remove "-Wl,-z,relro -Wl,-z,now" as they cause segmentation fault on the
+# v8 foundation model.
+TARGET_GLOBAL_LDFLAGS += \
+ -Wl,-z,noexecstack \
+ -Wl,--warn-shared-textrel \
+ -Wl,--fatal-warnings \
+ $(arch_variant_ldflags)
+
+TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
+
+# More flags/options can be added here
+TARGET_RELEASE_CFLAGS := \
+ -DNDEBUG \
+ -O2 -g \
+ -Wstrict-aliasing=2 \
+ -fgcse-after-reload \
+ -frerun-cse-after-loop \
+ -frename-registers
+
+libc_root := bionic/libc
+libm_root := bionic/libm
+libstdc++_root := bionic/libstdc++
+
+TARGET_LIBGCC := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
+ -print-libgcc-file-name)
+
+KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
+KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-$(TARGET_ARCH)
+KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
+
+TARGET_C_INCLUDES := \
+ $(libc_root)/arch-arm64/include \
+ $(libc_root)/include \
+ $(libstdc++_root)/include \
+ $(KERNEL_HEADERS) \
+ $(libm_root)/include \
+ $(libm_root)/include/arm64 \
+
+TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
+TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
+TARGET_CRTEND_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
+
+TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
+TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
+
+TARGET_STRIP_MODULE:=true
+
+TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
+
+TARGET_CUSTOM_LD_COMMAND := true
+
+define transform-o-to-shared-lib-inner
+$(hide) $(PRIVATE_CXX) \
+ -nostdlib -Wl,-soname,$(notdir $@) \
+ -Wl,-shared,-Bsymbolic \
+ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ -Wl,--no-whole-archive \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
+ $(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
+ $(PRIVATE_TARGET_FDO_LIB) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ -o $@ \
+ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_TARGET_LIBGCC) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O))
+endef
+
+define transform-o-to-executable-inner
+$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \
+ -Wl,-dynamic-linker,/system/bin/linker64 \
+ -Wl,-z,nocopyreloc \
+ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
+ -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ -Wl,--no-whole-archive \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
+ $(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
+ $(PRIVATE_TARGET_FDO_LIB) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ -o $@ \
+ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_TARGET_LIBGCC) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
+endef
+
+define transform-o-to-static-executable-inner
+$(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \
+ -o $@ \
+ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_STATIC_O)) \
+ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ -Wl,--no-whole-archive \
+ $(call normalize-target-libraries,$(filter-out %libc_nomalloc.a,$(filter-out %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES)))) \
+ -Wl,--start-group \
+ $(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
+ $(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
+ $(PRIVATE_TARGET_FDO_LIB) \
+ $(PRIVATE_TARGET_LIBGCC) \
+ -Wl,--end-group \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
+endef
diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk
index a20465b..637c8f6 100644
--- a/core/combo/TARGET_linux-mips.mk
+++ b/core/combo/TARGET_linux-mips.mk
@@ -35,7 +35,7 @@
endif
ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
-TARGET_GCC_VERSION := 4.7
+TARGET_GCC_VERSION := 4.8
else
TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
endif
@@ -60,10 +60,10 @@
TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
ifeq ($(TARGET_BUILD_VARIANT),user)
- TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@
+ TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@
else
- TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@ && \
- $(TARGET_OBJCOPY) --add-gnu-debuglink=$< $@
+ TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@ && \
+ $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
endif
TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
@@ -99,7 +99,7 @@
# This warning causes dalvik not to build with gcc 4.6+ and -Werror.
# We cannot turn it off blindly since the option is not available
# in gcc-4.4.x.
-ifneq ($(filter 4.6 4.6.% 4.7 4.7.%, $(TARGET_GCC_VERSION)),)
+ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8, $(TARGET_GCC_VERSION)),)
TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable \
-fno-strict-volatile-bitfields
endif
@@ -123,6 +123,7 @@
-Wl,-z,relro \
-Wl,-z,now \
-Wl,--warn-shared-textrel \
+ -Wl,--fatal-warnings \
$(arch_variant_ldflags)
TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
@@ -139,7 +140,6 @@
libc_root := bionic/libc
libm_root := bionic/libm
libstdc++_root := bionic/libstdc++
-libthread_db_root := bionic/libthread_db
## on some hosts, the target cross-compiler is not available so do not run this command
@@ -186,17 +186,8 @@
endif
-# unless CUSTOM_KERNEL_HEADERS is defined, we're going to use
-# symlinks located in out/ to point to the appropriate kernel
-# headers. see 'config/kernel_headers.make' for more details
-#
-ifneq ($(CUSTOM_KERNEL_HEADERS),)
- KERNEL_HEADERS_COMMON := $(CUSTOM_KERNEL_HEADERS)
- KERNEL_HEADERS_ARCH := $(CUSTOM_KERNEL_HEADERS)
-else
- KERNEL_HEADERS_COMMON := $(libc_root)/kernel/common
- KERNEL_HEADERS_ARCH := $(libc_root)/kernel/arch-$(TARGET_ARCH)
-endif
+KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
+KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-mips # mips covers both mips and mips64.
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
TARGET_C_INCLUDES := \
@@ -206,7 +197,6 @@
$(KERNEL_HEADERS) \
$(libm_root)/include \
$(libm_root)/include/mips \
- $(libthread_db_root)/include
TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
@@ -236,11 +226,11 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBGCC) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O))
endef
@@ -261,11 +251,11 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBGCC) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
endef
diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk
old mode 100644
new mode 100755
index d5772b1..801f882
--- a/core/combo/TARGET_linux-x86.mk
+++ b/core/combo/TARGET_linux-x86.mk
@@ -23,7 +23,7 @@
endif
ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
-TARGET_GCC_VERSION := 4.7
+TARGET_GCC_VERSION := 4.8
else
TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
endif
@@ -42,8 +42,8 @@
# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
-TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/i686-linux-android-$(TARGET_GCC_VERSION)
-TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/i686-linux-android-
+TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/x86_64-linux-android-$(TARGET_GCC_VERSION)
+TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/x86_64-linux-android-
endif
TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
@@ -54,15 +54,17 @@
TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
ifeq ($(TARGET_BUILD_VARIANT),user)
-TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-debug $< -o $@
+TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-debug $< -o $@
else
-TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-debug $< -o $@ && \
- $(TARGET_OBJCOPY) --add-gnu-debuglink=$< $@
+TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-debug $< -o $@ && \
+ $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
endif
ifneq ($(wildcard $(TARGET_CC)),)
TARGET_LIBGCC := \
$(shell $(TARGET_CC) -m32 -print-file-name=libgcc.a)
+target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
+ -print-file-name=libgcov.a)
endif
TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
@@ -70,19 +72,37 @@
libc_root := bionic/libc
libm_root := bionic/libm
libstdc++_root := bionic/libstdc++
-libthread_db_root := bionic/libthread_db
-# unless CUSTOM_KERNEL_HEADERS is defined, we're going to use
-# symlinks located in out/ to point to the appropriate kernel
-# headers. see 'config/kernel_headers.make' for more details
-#
-ifneq ($(CUSTOM_KERNEL_HEADERS),)
- KERNEL_HEADERS_COMMON := $(CUSTOM_KERNEL_HEADERS)
- KERNEL_HEADERS_ARCH := $(CUSTOM_KERNEL_HEADERS)
+# Define FDO (Feedback Directed Optimization) options.
+
+TARGET_FDO_CFLAGS:=
+TARGET_FDO_LIB:=
+
+ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),)
+ # Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation.
+ # The profile will be generated on /data/local/tmp/profile on the device.
+ TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO
+ TARGET_FDO_LIB := $(target_libgcov)
else
- KERNEL_HEADERS_COMMON := $(libc_root)/kernel/common
- KERNEL_HEADERS_ARCH := $(libc_root)/kernel/arch-$(TARGET_ARCH)
+ # If BUILD_FDO_INSTRUMENT is turned off, then consider doing the FDO optimizations.
+ # Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build.
+ ifeq ($(strip $(TARGET_FDO_PROFILE_PATH)),)
+ TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT)
+ else
+ ifeq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
+ $(warning Custom TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.)
+ endif
+ endif
+
+ # If the FDO profile directory can't be found, then FDO is off.
+ ifneq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
+ TARGET_FDO_CFLAGS := -fprofile-use=$(TARGET_FDO_PROFILE_PATH) -DANDROID_FDO
+ TARGET_FDO_LIB := $(target_libgcov)
+ endif
endif
+
+KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
+KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-x86 # x86 covers both x86 and x86_64.
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
android_config_h := $(call select-android-config-h,target_linux-x86)
@@ -104,54 +124,37 @@
-funswitch-loops \
-funwind-tables \
-fstack-protector \
+ -m32 \
-include $(android_config_h) \
-I $(dir $(android_config_h))
-# XXX: Not sure this is still needed. Must check with our toolchains.
-TARGET_GLOBAL_CPPFLAGS += \
- -fno-use-cxa-atexit
-
-# XXX: Our toolchain is normally configured to always set these flags by default
-# however, there have been reports that this is sometimes not the case. So make
-# them explicit here unless we have the time to carefully check it
-#
-TARGET_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse -m32
-
-# XXX: These flags should not be defined here anymore. Instead, the Android.mk
-# of the modules that depend on these features should instead check the
-# corresponding macros (e.g. ARCH_X86_HAVE_SSE2 and ARCH_X86_HAVE_SSSE3)
-# Keep them here until this is all cleared up.
-#
-ifeq ($(ARCH_X86_HAVE_SSE2),true)
-TARGET_GLOBAL_CFLAGS += -DUSE_SSE2
-endif
+TARGET_GLOBAL_CFLAGS += $(arch_variant_cflags)
ifeq ($(ARCH_X86_HAVE_SSSE3),true) # yes, really SSSE3, not SSE3!
-TARGET_GLOBAL_CFLAGS += -DUSE_SSSE3
+ TARGET_GLOBAL_CFLAGS += -DUSE_SSSE3 -mssse3
+endif
+ifeq ($(ARCH_X86_HAVE_SSE4),true)
+ TARGET_GLOBAL_CFLAGS += -msse4
+endif
+ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
+ TARGET_GLOBAL_CFLAGS += -msse4.1
+endif
+ifeq ($(ARCH_X86_HAVE_SSE4_2),true)
+ TARGET_GLOBAL_CFLAGS += -msse4.2
+endif
+ifeq ($(ARCH_X86_HAVE_AVX),true)
+ TARGET_GLOBAL_CFLAGS += -mavx
+endif
+ifeq ($(ARCH_X86_HAVE_AES_NI),true)
+ TARGET_GLOBAL_CFLAGS += -maes
endif
-# XXX: This flag is probably redundant. I believe our toolchain always sets
-# it by default. Consider for removal.
-#
-TARGET_GLOBAL_CFLAGS += -mbionic
-
-# XXX: This flag is probably redundant. The macro should be defined by our
-# toolchain binaries automatically (as a compiler built-in).
-# Check with: $BINPREFIX-gcc -dM -E < /dev/null
-#
-# Consider for removal.
-#
-TARGET_GLOBAL_CFLAGS += -D__ANDROID__
-
-# XXX: This flag is probably redundant since our toolchain binaries already
-# generate 32-bit machine code. It probably dates back to the old days
-# where we were using the host toolchain on Linux to build the platform
-# images. Consider it for removal.
TARGET_GLOBAL_LDFLAGS += -m32
TARGET_GLOBAL_LDFLAGS += -Wl,-z,noexecstack
TARGET_GLOBAL_LDFLAGS += -Wl,-z,relro -Wl,-z,now
TARGET_GLOBAL_LDFLAGS += -Wl,--warn-shared-textrel
+TARGET_GLOBAL_LDFLAGS += -Wl,--fatal-warnings
TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections
TARGET_C_INCLUDES := \
@@ -161,7 +164,6 @@
$(KERNEL_HEADERS) \
$(libm_root)/include \
$(libm_root)/include/i387 \
- $(libthread_db_root)/include
TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
@@ -191,6 +193,7 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
@@ -202,7 +205,6 @@
$(hide) $(PRIVATE_CXX) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
-nostdlib -Bdynamic \
- -Wl,-dynamic-linker,/system/bin/linker \
-Wl,-z,nocopyreloc \
-fPIE -pie \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
@@ -216,6 +218,7 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
@@ -237,25 +240,8 @@
-Wl,--no-whole-archive \
-Wl,--start-group \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBGCC) \
-Wl,--end-group \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
endef
-
-# Special check for x86 NDK ABI compatibility.
-# The TARGET_CPU_ABI variable should be defined in BoardConfig.mk to 'x86'
-# *only* if the platform image is compatible with the NDK x86 ABI.
-#
-# We perform a small check here to ensure that nothing bad can happen.
-#
-ifeq ($(TARGET_CPU_ABI),x86)
- ifneq (true-true-true-true,$(ARCH_X86_HAVE_MMX)-$(ARCH_X86_HAVE_SSE)-$(ARCH_X86_HAVE_SSE2)-$(ARCH_X86_HAVE_SSE3))
- $(info ERROR: Your x86 platform image is not compatible with the NDK x86 ABI)
- $(info As such, you should *not* define TARGET_CPU_ABI to 'x86' in your BoardConfig.mk)
- $(info to ensure that your device will not be mistakenly listed as compatible by
- $(info the Android Market. Also, it is likely that the image will fail the CTS tests)
- $(info Please undefine TARGET_CPU_ABI in your BoardConfig.mk, or select the value 'none')
- $(info The corresponding image will still be able to run Dalvik-based Android applications)
- $(error Aborting build! Please fix your BoardConfig.mk)
- endif
-endif
diff --git a/core/combo/TARGET_linux-x86_64.mk b/core/combo/TARGET_linux-x86_64.mk
new file mode 100755
index 0000000..82e25e0
--- /dev/null
+++ b/core/combo/TARGET_linux-x86_64.mk
@@ -0,0 +1,248 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Configuration for Linux on x86_64 as a target.
+# Included by combo/select.mk
+
+# Provide a default variant.
+ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
+TARGET_ARCH_VARIANT := x86_64
+endif
+
+ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
+TARGET_GCC_VERSION := 4.7
+else
+TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
+endif
+
+TARGET_IS_64_BIT := true
+
+# Include the arch-variant-specific configuration file.
+# Its role is to define various ARCH_X86_HAVE_XXX feature macros,
+# plus initial values for TARGET_GLOBAL_CFLAGS
+#
+TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT).mk
+ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),)
+$(error Unknown $(TARGET_ARCH) architecture version: $(TARGET_ARCH_VARIANT))
+endif
+
+include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
+
+
+# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
+ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
+TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/x86_64-linux-android-$(TARGET_GCC_VERSION)
+TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/x86_64-linux-android-
+endif
+
+TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
+TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
+
+ifeq ($(TARGET_BUILD_VARIANT),user)
+TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-debug $< -o $@
+else
+TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-debug $< -o $@ && \
+ $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
+endif
+
+ifneq ($(wildcard $(TARGET_CC)),)
+TARGET_LIBGCC := \
+ $(shell $(TARGET_CC) -m64 -print-file-name=libgcc.a)
+target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
+ -print-file-name=libgcov.a)
+endif
+
+TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+
+libc_root := bionic/libc
+libm_root := bionic/libm
+libstdc++_root := bionic/libstdc++
+
+# Define FDO (Feedback Directed Optimization) options.
+
+TARGET_FDO_CFLAGS:=
+TARGET_FDO_LIB:=
+
+ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),)
+ # Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation.
+ # The profile will be generated on /data/local/tmp/profile on the device.
+ TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO
+ TARGET_FDO_LIB := $(target_libgcov)
+else
+ # If BUILD_FDO_INSTRUMENT is turned off, then consider doing the FDO optimizations.
+ # Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build.
+ ifeq ($(strip $(TARGET_FDO_PROFILE_PATH)),)
+ TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT)
+ else
+ ifeq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
+ $(warning Custom TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.)
+ endif
+ endif
+
+ # If the FDO profile directory can't be found, then FDO is off.
+ ifneq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
+ TARGET_FDO_CFLAGS := -fprofile-use=$(TARGET_FDO_PROFILE_PATH) -DANDROID_FDO
+ TARGET_FDO_LIB := $(target_libgcov)
+ endif
+endif
+
+KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
+KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-x86 # x86 covers both x86 and x86_64.
+KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
+
+TARGET_GLOBAL_CFLAGS += \
+ -O2 \
+ -Ulinux \
+ -Wa,--noexecstack \
+ -Werror=format-security \
+ -D_FORTIFY_SOURCE=2 \
+ -Wstrict-aliasing=2 \
+ -fPIC -fPIE \
+ -ffunction-sections \
+ -finline-functions \
+ -finline-limit=300 \
+ -fno-inline-functions-called-once \
+ -fno-short-enums \
+ -fstrict-aliasing \
+ -funswitch-loops \
+ -funwind-tables \
+ -fstack-protector \
+ -m64
+
+android_config_h := $(call select-android-config-h,target_linux-x86)
+TARGET_ANDROID_CONFIG_CFLAGS := -include $(android_config_h) -I $(dir $(android_config_h))
+TARGET_GLOBAL_CFLAGS += $(TARGET_ANDROID_CONFIG_CFLAGS)
+
+TARGET_GLOBAL_CFLAGS += $(arch_variant_cflags)
+
+ifeq ($(ARCH_X86_HAVE_SSSE3),true) # yes, really SSSE3, not SSE3!
+ TARGET_GLOBAL_CFLAGS += -DUSE_SSSE3 -mssse3
+endif
+ifeq ($(ARCH_X86_HAVE_SSE4),true)
+ TARGET_GLOBAL_CFLAGS += -msse4
+endif
+ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
+ TARGET_GLOBAL_CFLAGS += -msse4.1
+endif
+ifeq ($(ARCH_X86_HAVE_SSE4_2),true)
+ TARGET_GLOBAL_CFLAGS += -msse4.2
+endif
+ifeq ($(ARCH_X86_HAVE_AVX),true)
+ TARGET_GLOBAL_CFLAGS += -mavx
+endif
+ifeq ($(ARCH_X86_HAVE_AES_NI),true)
+ TARGET_GLOBAL_CFLAGS += -maes
+endif
+
+TARGET_GLOBAL_LDFLAGS += -m64
+
+TARGET_GLOBAL_LDFLAGS += -Wl,-z,noexecstack
+TARGET_GLOBAL_LDFLAGS += -Wl,-z,relro -Wl,-z,now
+TARGET_GLOBAL_LDFLAGS += -Wl,--warn-shared-textrel
+TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections
+
+TARGET_C_INCLUDES := \
+ $(libc_root)/arch-x86_64/include \
+ $(libc_root)/include \
+ $(libstdc++_root)/include \
+ $(KERNEL_HEADERS) \
+ $(libm_root)/include \
+ $(libm_root)/include/amd64 \
+
+TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
+TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
+TARGET_CRTEND_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
+
+TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
+TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
+
+TARGET_STRIP_MODULE:=true
+
+TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
+
+TARGET_CUSTOM_LD_COMMAND := true
+define transform-o-to-shared-lib-inner
+$(hide) $(PRIVATE_CXX) \
+ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+ -nostdlib -Wl,-soname,$(notdir $@) \
+ -shared -Bsymbolic \
+ $(TARGET_GLOBAL_CFLAGS) \
+ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ -Wl,--no-whole-archive \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
+ $(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_FDO_LIB) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ -o $@ \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_TARGET_LIBGCC) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O))
+endef
+
+define transform-o-to-executable-inner
+$(hide) $(PRIVATE_CXX) \
+ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+ -nostdlib -Bdynamic \
+ -Wl,-z,nocopyreloc \
+ -fPIE -pie \
+ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
+ -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ -Wl,--no-whole-archive \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
+ $(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_FDO_LIB) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ -o $@ \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_TARGET_LIBGCC) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
+endef
+
+define transform-o-to-static-executable-inner
+$(hide) $(PRIVATE_CXX) \
+ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+ -nostdlib -Bstatic \
+ -o $@ \
+ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_STATIC_O)) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ -Wl,--no-whole-archive \
+ -Wl,--start-group \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(PRIVATE_TARGET_FDO_LIB) \
+ $(PRIVATE_TARGET_LIBGCC) \
+ -Wl,--end-group \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
+endef
diff --git a/core/combo/arch/arm/armv7-a-neon.mk b/core/combo/arch/arm/armv7-a-neon.mk
index 057ce93..53d9220 100644
--- a/core/combo/arch/arm/armv7-a-neon.mk
+++ b/core/combo/arch/arm/armv7-a-neon.mk
@@ -1,12 +1,12 @@
# Configuration for Linux on ARM.
# Generating binaries for the ARMv7-a architecture and higher with NEON
#
-ARCH_ARM_HAVE_ARMV7A := true
-ARCH_ARM_HAVE_VFP := true
-ARCH_ARM_HAVE_VFP_D32 := true
-ARCH_ARM_HAVE_NEON := true
+$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_ARMV7A := true
+$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_VFP := true
+$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_VFP_D32 := true
+$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_NEON := true
-ifeq ($(strip $(TARGET_CPU_VARIANT)), cortex-a15)
+ifeq ($(TARGET_CPU_VARIANT),$(filter $(TARGET_CPU_VARIANT),cortex-a15 krait))
arch_variant_cflags := -mcpu=cortex-a15
else
ifeq ($(strip $(TARGET_CPU_VARIANT)),cortex-a8)
diff --git a/core/combo/arch/arm/armv7-a.mk b/core/combo/arch/arm/armv7-a.mk
index 4a51977..9549478 100644
--- a/core/combo/arch/arm/armv7-a.mk
+++ b/core/combo/arch/arm/armv7-a.mk
@@ -1,8 +1,8 @@
# Configuration for Linux on ARM.
# Generating binaries for the ARMv7-a architecture and higher
#
-ARCH_ARM_HAVE_ARMV7A := true
-ARCH_ARM_HAVE_VFP := true
+$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_ARMV7A := true
+$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_VFP := true
# Note: Hard coding the 'tune' value here is probably not ideal,
# and a better solution should be found in the future.
diff --git a/core/combo/arch/arm64/armv8-a.mk b/core/combo/arch/arm64/armv8-a.mk
new file mode 100644
index 0000000..edc0497
--- /dev/null
+++ b/core/combo/arch/arm64/armv8-a.mk
@@ -0,0 +1 @@
+arch_variant_cflags :=
diff --git a/core/combo/arch/mips/mips32r2-fp-xburst.mk b/core/combo/arch/mips/mips32r2-fp-xburst.mk
index fee9cb3..8b0fef1 100644
--- a/core/combo/arch/mips/mips32r2-fp-xburst.mk
+++ b/core/combo/arch/mips/mips32r2-fp-xburst.mk
@@ -10,7 +10,8 @@
-mtune=mips32r2 \
-mips32r2 \
-mhard-float \
- -mno-fused-madd
+ -mno-fused-madd \
+ -Wa,-mmxu
arch_variant_ldflags := \
-EL
diff --git a/core/combo/arch/x86/haswell.mk b/core/combo/arch/x86/haswell.mk
new file mode 100644
index 0000000..a00e0a6
--- /dev/null
+++ b/core/combo/arch/x86/haswell.mk
@@ -0,0 +1,16 @@
+# Configuration for Linux on x86.
+# Generating binaries for Haswell processors.
+#
+ARCH_X86_HAVE_SSSE3 := true
+ARCH_X86_HAVE_SSE4 := true
+ARCH_X86_HAVE_SSE4_1 := true
+ARCH_X86_HAVE_SSE4_2 := true
+ARCH_X86_HAVE_AES_NI := true
+ARCH_X86_HAVE_AVX := true
+
+# CFLAGS for this arch
+arch_variant_cflags := \
+ -march=core-avx2 \
+ -mstackrealign \
+ -mfpmath=sse \
+
diff --git a/core/combo/arch/x86/ivybridge.mk b/core/combo/arch/x86/ivybridge.mk
new file mode 100644
index 0000000..02dc1e0
--- /dev/null
+++ b/core/combo/arch/x86/ivybridge.mk
@@ -0,0 +1,16 @@
+# Configuration for Linux on x86.
+# Generating binaries for Ivy Bridge processors.
+#
+ARCH_X86_HAVE_SSSE3 := true
+ARCH_X86_HAVE_SSE4 := true
+ARCH_X86_HAVE_SSE4_1 := true
+ARCH_X86_HAVE_SSE4_2 := true
+ARCH_X86_HAVE_AES_NI := true
+ARCH_X86_HAVE_AVX := true
+
+# CFLAGS for this arch
+arch_variant_cflags := \
+ -march=core-avx-i \
+ -mstackrealign \
+ -mfpmath=sse \
+
diff --git a/core/combo/arch/x86/sandybridge.mk b/core/combo/arch/x86/sandybridge.mk
new file mode 100644
index 0000000..dfa540c
--- /dev/null
+++ b/core/combo/arch/x86/sandybridge.mk
@@ -0,0 +1,14 @@
+# Configuration for Linux on x86.
+# Generating binaries for SandyBridge processors.
+#
+ARCH_X86_HAVE_SSSE3 := true
+ARCH_X86_HAVE_SSE4_1 := true
+ARCH_X86_HAVE_SSE4_2 := true
+ARCH_X86_HAVE_AVX := true
+
+# CFLAGS for this arch
+arch_variant_cflags := \
+ -march=corei7-avx \
+ -mstackrealign \
+ -mfpmath=sse \
+
diff --git a/core/combo/arch/x86/x86-atom.mk b/core/combo/arch/x86/x86-atom.mk
index 85998e7..508a0af 100644
--- a/core/combo/arch/x86/x86-atom.mk
+++ b/core/combo/arch/x86/x86-atom.mk
@@ -4,15 +4,13 @@
#
# See build/core/combo/arch/x86/x86.mk for differences.
#
-ARCH_X86_HAVE_MMX := true
-ARCH_X86_HAVE_SSE := true
-ARCH_X86_HAVE_SSE2 := true
-ARCH_X86_HAVE_SSE3 := true
-
ARCH_X86_HAVE_SSSE3 := true
ARCH_X86_HAVE_MOVBE := true
ARCH_X86_HAVE_POPCNT := false # popcnt is not supported by current Atom CPUs
-# This flag is used to enabled Atom-specific optimizations with our toolchain
-#
-TARGET_GLOBAL_CFLAGS += -march=atom
+# CFLAGS for this arch
+arch_variant_cflags := \
+ -march=atom \
+ -mstackrealign \
+ -mfpmath=sse \
+
diff --git a/core/combo/arch/x86/x86.mk b/core/combo/arch/x86/x86.mk
index 476da45..73706c4 100644
--- a/core/combo/arch/x86/x86.mk
+++ b/core/combo/arch/x86/x86.mk
@@ -1,27 +1,13 @@
# This file contains feature macro definitions specific to the
-# base 'x86' platform ABI. This one must *strictly* match the NDK x86 ABI
-# which mandates specific CPU extensions to be available.
+# base 'x86' platform ABI.
#
# It is also used to build full_x86-eng / sdk_x86-eng platform images that
# are run in the emulator under KVM emulation (i.e. running directly on
# the host development machine's CPU).
-#
-
-# If your target device doesn't support the four following features, then
-# it cannot be compatible with the NDK x86 ABI. You should define a new
-# target arch variant (e.g. "x86-mydevice") and a corresponding file
-# under build/core/combo/arch/x86/
-#
-ARCH_X86_HAVE_MMX := true
-ARCH_X86_HAVE_SSE := true
-ARCH_X86_HAVE_SSE2 := true
-ARCH_X86_HAVE_SSE3 := true
# These features are optional and shall not be included in the base platform
-# Otherwise, they sdk_x86-eng system images might fail to run on some
+# Otherwise, sdk_x86-eng system images might fail to run on some
# developer machines.
-#
-
ARCH_X86_HAVE_SSSE3 := false
ARCH_X86_HAVE_MOVBE := false
ARCH_X86_HAVE_POPCNT := false
@@ -32,4 +18,6 @@
# not always work as intended, so keep it unless we have the time to check
# everything properly.
-TARGET_GLOBAL_CFLAGS += -march=i686
+arch_variant_cflags := \
+ -march=i686 \
+
diff --git a/core/combo/arch/x86_64/haswell.mk b/core/combo/arch/x86_64/haswell.mk
new file mode 100644
index 0000000..9cf95b3
--- /dev/null
+++ b/core/combo/arch/x86_64/haswell.mk
@@ -0,0 +1,13 @@
+# Configuration for Linux on x86_64.
+# Generating binaries for Haswell processors.
+#
+ARCH_X86_HAVE_SSSE3 := true
+ARCH_X86_HAVE_SSE4 := true
+ARCH_X86_HAVE_SSE4_1 := true
+ARCH_X86_HAVE_SSE4_2 := true
+ARCH_X86_HAVE_AES_NI := true
+ARCH_X86_HAVE_AVX := true
+
+# CFLAGS for this arch
+arch_variant_cflags := \
+ -march=core-avx2
diff --git a/core/combo/arch/x86_64/ivybridge.mk b/core/combo/arch/x86_64/ivybridge.mk
new file mode 100644
index 0000000..7b95190
--- /dev/null
+++ b/core/combo/arch/x86_64/ivybridge.mk
@@ -0,0 +1,13 @@
+# Configuration for Linux on x86_64.
+# Generating binaries for Ivy Bridge processors.
+#
+ARCH_X86_HAVE_SSSE3 := true
+ARCH_X86_HAVE_SSE4 := true
+ARCH_X86_HAVE_SSE4_1 := true
+ARCH_X86_HAVE_SSE4_2 := true
+ARCH_X86_HAVE_AES_NI := true
+ARCH_X86_HAVE_AVX := true
+
+# CFLAGS for this arch
+arch_variant_cflags := \
+ -march=core-avx-i
diff --git a/core/combo/arch/x86_64/sandybridge.mk b/core/combo/arch/x86_64/sandybridge.mk
new file mode 100644
index 0000000..a443b6b
--- /dev/null
+++ b/core/combo/arch/x86_64/sandybridge.mk
@@ -0,0 +1,11 @@
+# Configuration for Linux on x86_64.
+# Generating binaries for SandyBridge processors.
+#
+ARCH_X86_HAVE_SSSE3 := true
+ARCH_X86_HAVE_SSE4_1 := true
+ARCH_X86_HAVE_SSE4_2 := true
+ARCH_X86_HAVE_AVX := true
+
+# CFLAGS for this arch
+arch_variant_cflags := \
+ -march=corei7-avx
diff --git a/core/combo/arch/x86_64/x86_64-atom.mk b/core/combo/arch/x86_64/x86_64-atom.mk
new file mode 100755
index 0000000..64b07a0
--- /dev/null
+++ b/core/combo/arch/x86_64/x86_64-atom.mk
@@ -0,0 +1,13 @@
+# This file contains feature macro definitions specific to the
+# 'x86_64-atom' arch variant. This is an extension of the 'x86_64' base variant
+# that adds Atom-specific features.
+#
+# See build/core/combo/arch/x86_64/x86_64.mk for differences.
+#
+ARCH_X86_HAVE_SSSE3 := true
+ARCH_X86_HAVE_MOVBE := true
+ARCH_X86_HAVE_POPCNT := false # popcnt is not supported by current Atom CPUs
+
+# CFLAGS for this arch
+arch_variant_cflags := \
+ -march=atom
diff --git a/core/combo/arch/x86_64/x86_64.mk b/core/combo/arch/x86_64/x86_64.mk
new file mode 100755
index 0000000..9d2b620
--- /dev/null
+++ b/core/combo/arch/x86_64/x86_64.mk
@@ -0,0 +1,15 @@
+# This file contains feature macro definitions specific to the
+# base 'x86_64' platform ABI.
+#
+# It is also used to build full_x86_64-eng / sdk_x86_64-eng platform images
+# that are run in the emulator under KVM emulation (i.e. running directly on
+# the host development machine's CPU).
+
+ARCH_X86_HAVE_SSSE3 := true
+ARCH_X86_HAVE_MOVBE := false # Only supported on Atom.
+ARCH_X86_HAVE_POPCNT := true
+
+
+# CFLAGS for this arch
+arch_variant_cflags := \
+ -march=x86-64
diff --git a/core/combo/include/arch/linux-arm64/AndroidConfig.h b/core/combo/include/arch/linux-arm64/AndroidConfig.h
new file mode 100644
index 0000000..d649b2e
--- /dev/null
+++ b/core/combo/include/arch/linux-arm64/AndroidConfig.h
@@ -0,0 +1,362 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Android config -- "android-aarch64". Used for ARM aarch64 device builds.
+ */
+#ifndef _ANDROID_CONFIG_H
+#define _ANDROID_CONFIG_H
+
+/*
+ * ===========================================================================
+ * !!! IMPORTANT !!!
+ * ===========================================================================
+ *
+ * This file is included by ALL C/C++ source files. Don't put anything in
+ * here unless you are absolutely certain it can't go anywhere else.
+ *
+ * Any C++ stuff must be wrapped with "#ifdef __cplusplus". Do not use "//"
+ * comments.
+ */
+
+/*
+ * Threading model. Choose one:
+ *
+ * HAVE_PTHREADS - use the pthreads library.
+ * HAVE_WIN32_THREADS - use Win32 thread primitives.
+ * -- combine HAVE_CREATETHREAD, HAVE_CREATEMUTEX, and HAVE__BEGINTHREADEX
+ */
+#define HAVE_PTHREADS
+
+/*
+ * Do we have pthread_setname_np()?
+ *
+ * (HAVE_PTHREAD_SETNAME_NP is used by WebKit to enable a function with
+ * the same name but different parameters, so we can't use that here.)
+ */
+#define HAVE_ANDROID_PTHREAD_SETNAME_NP
+
+/*
+ * Do we have the futex syscall?
+ */
+#define HAVE_FUTEX
+
+/*
+ * Define if we already have the futex wrapper functions defined. Yes if
+ * compiling against bionic.
+ */
+#define HAVE_FUTEX_WRAPPERS 1
+
+/*
+ * Process creation model. Choose one:
+ *
+ * HAVE_FORKEXEC - use fork() and exec()
+ * HAVE_WIN32_PROC - use CreateProcess()
+ */
+#define HAVE_FORKEXEC
+
+/*
+ * Process out-of-memory adjustment. Set if running on Linux,
+ * where we can write to /proc/<pid>/oom_adj to modify the out-of-memory
+ * badness adjustment.
+ */
+#define HAVE_OOM_ADJ
+
+/*
+ * IPC model. Choose one:
+ *
+ * HAVE_SYSV_IPC - use the classic SysV IPC mechanisms (semget, shmget).
+ * HAVE_MACOSX_IPC - use Macintosh IPC mechanisms (sem_open, mmap).
+ * HAVE_WIN32_IPC - use Win32 IPC (CreateSemaphore, CreateFileMapping).
+ * HAVE_ANDROID_IPC - use Android versions (?, mmap).
+ */
+#define HAVE_ANDROID_IPC
+
+/*
+ * Memory-mapping model. Choose one:
+ *
+ * HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h
+ * HAVE_WIN32_FILEMAP - use Win32 filemaps
+ */
+#define HAVE_POSIX_FILEMAP
+
+/*
+ * Define this if you have <termio.h>
+ */
+#define HAVE_TERMIO_H 1
+
+/*
+ * Define this if you have <sys/sendfile.h>
+ */
+#define HAVE_SYS_SENDFILE_H 1
+
+/*
+ * Define this if you build against MSVCRT.DLL
+ */
+/* #define HAVE_MS_C_RUNTIME */
+
+/*
+ * Define this if you have sys/uio.h
+ */
+#define HAVE_SYS_UIO_H 1
+
+/*
+ * Define this if your platforms implements symbolic links
+ * in its filesystems
+ */
+#define HAVE_SYMLINKS
+
+/*
+ * Define this if we have localtime_r().
+ */
+/* #define HAVE_LOCALTIME_R 1 */
+
+/*
+ * Define this if we have gethostbyname_r().
+ */
+/* #define HAVE_GETHOSTBYNAME_R */
+
+/*
+ * Define this if we have ioctl().
+ */
+#define HAVE_IOCTL
+
+/*
+ * Define this if we want to use WinSock.
+ */
+/* #define HAVE_WINSOCK */
+
+/*
+ * Define this if have clock_gettime() and friends
+ */
+#define HAVE_POSIX_CLOCKS
+
+/*
+ * Define this if we have pthread_cond_timedwait_monotonic() and
+ * clock_gettime(CLOCK_MONOTONIC).
+ */
+#define HAVE_TIMEDWAIT_MONOTONIC
+
+/*
+ * Define this if we have linux style epoll()
+ */
+#define HAVE_EPOLL
+
+/*
+ * Endianness of the target machine. Choose one:
+ *
+ * HAVE_ENDIAN_H -- have endian.h header we can include.
+ * HAVE_LITTLE_ENDIAN -- we are little endian.
+ * HAVE_BIG_ENDIAN -- we are big endian.
+ */
+#define HAVE_ENDIAN_H
+#define HAVE_LITTLE_ENDIAN
+
+#define _FILE_OFFSET_BITS 64
+/* #define _LARGEFILE_SOURCE 1 */
+
+/*
+ * Define if platform has off64_t (and lseek64 and other xxx64 functions)
+ */
+#define HAVE_OFF64_T
+
+/*
+ * Defined if we have the backtrace() call for retrieving a stack trace.
+ * Needed for CallStack to operate; if not defined, CallStack is
+ * non-functional.
+ */
+#define HAVE_BACKTRACE 0
+
+/*
+ * Defined if we have the cxxabi.h header for demangling C++ symbols. If
+ * not defined, stack crawls will be displayed with raw mangled symbols
+ */
+#define HAVE_CXXABI 0
+
+/*
+ * Defined if we have the gettid() system call.
+ */
+#define HAVE_GETTID
+
+/*
+ * Defined if we have the sched_setscheduler() call
+ */
+#define HAVE_SCHED_SETSCHEDULER
+
+/*
+ * Add any extra platform-specific defines here.
+ */
+#ifndef __linux__
+#define __linux__
+#endif
+
+/*
+ * Define if we have <malloc.h> header
+ */
+#define HAVE_MALLOC_H
+
+/*
+ * Define if we're running on *our* linux on device or emulator.
+ */
+#define HAVE_ANDROID_OS 1
+
+/*
+ * Define if we have Linux-style non-filesystem Unix Domain Sockets
+ */
+#define HAVE_LINUX_LOCAL_SOCKET_NAMESPACE 1
+
+/*
+ * Define if we have Linux's inotify in <sys/inotify.h>.
+ */
+#define HAVE_INOTIFY 1
+
+/*
+ * Define if we have madvise() in <sys/mman.h>
+ */
+#define HAVE_MADVISE 1
+
+/*
+ * Define if tm struct has tm_gmtoff field
+ */
+#define HAVE_TM_GMTOFF 1
+
+/*
+ * Define if dirent struct has d_type field
+ */
+#define HAVE_DIRENT_D_TYPE 1
+
+/*
+ * Define if libc includes Android system properties implementation.
+ */
+#define HAVE_LIBC_SYSTEM_PROPERTIES 1
+
+/*
+ * Define if system provides a system property server (should be
+ * mutually exclusive with HAVE_LIBC_SYSTEM_PROPERTIES).
+ */
+/* #define HAVE_SYSTEM_PROPERTY_SERVER */
+
+/*
+ * What CPU architecture does this platform use?
+ */
+#define ARCH_AARCH64
+
+/*
+ * Define if the size of enums is as short as possible,
+ */
+/* #define HAVE_SHORT_ENUMS */
+
+/*
+ * sprintf() format string for shared library naming.
+ */
+#define OS_SHARED_LIB_FORMAT_STR "lib%s.so"
+
+/*
+ * Do we have __memcmp16()?
+ */
+#define HAVE__MEMCMP16 1
+
+/*
+ * type for the third argument to mincore().
+ */
+#define MINCORE_POINTER_TYPE unsigned char *
+
+/*
+ * Do we have the sigaction flag SA_NOCLDWAIT?
+ */
+#define HAVE_SA_NOCLDWAIT
+
+/*
+ * The default path separator for the platform
+ */
+#define OS_PATH_SEPARATOR '/'
+
+/*
+ * Is the filesystem case sensitive?
+ */
+#define OS_CASE_SENSITIVE
+
+/*
+ * Define if <sys/socket.h> exists.
+ */
+#define HAVE_SYS_SOCKET_H 1
+
+/*
+ * Define if the strlcpy() function exists on the system.
+ */
+#define HAVE_STRLCPY 1
+
+/*
+ * Define if the open_memstream() function exists on the system.
+ */
+/* #define HAVE_OPEN_MEMSTREAM 1 */
+
+/*
+ * Define if the BSD funopen() function exists on the system.
+ */
+#define HAVE_FUNOPEN 1
+
+/*
+ * Define if prctl() exists
+ */
+#define HAVE_PRCTL 1
+
+/*
+ * Define if writev() exists
+ */
+#define HAVE_WRITEV 1
+
+/*
+ * Define if <stdint.h> exists.
+ */
+#define HAVE_STDINT_H 1
+
+/*
+ * Define if <stdbool.h> exists.
+ */
+#define HAVE_STDBOOL_H 1
+
+/*
+ * Define if <sched.h> exists.
+ */
+#define HAVE_SCHED_H 1
+
+/*
+ * Define if pread() exists
+ */
+#define HAVE_PREAD 1
+
+/*
+ * Define if we have st_mtim in struct stat
+ */
+#define HAVE_STAT_ST_MTIM 1
+
+/*
+ * Define if printf() supports %zd for size_t arguments
+ */
+#define HAVE_PRINTF_ZD 1
+
+/*
+ * Define to 1 if <stdlib.h> provides qsort_r() with a BSD style function prototype.
+ */
+#define HAVE_BSD_QSORT_R 0
+
+/*
+ * Define to 1 if <stdlib.h> provides qsort_r() with a GNU style function prototype.
+ */
+#define HAVE_GNU_QSORT_R 0
+
+#endif /* _ANDROID_CONFIG_H */
diff --git a/core/combo/include/arch/target_linux-x86/AndroidConfig.h b/core/combo/include/arch/target_linux-x86/AndroidConfig.h
index aaaf0c9..25a1f5d 100644
--- a/core/combo/include/arch/target_linux-x86/AndroidConfig.h
+++ b/core/combo/include/arch/target_linux-x86/AndroidConfig.h
@@ -157,10 +157,10 @@
* agree on the same size. For desktop systems, use 64-bit values,
* because some of our libraries (e.g. wxWidgets) expect to be built that way.
*/
-/*
- * #define _FILE_OFFSET_BITS 64
- * #define _LARGEFILE_SOURCE 1
- */
+#if __LP64__
+#define _FILE_OFFSET_BITS 64
+#endif
+/* #define _LARGEFILE_SOURCE 1 */
/*
* Define if platform has off64_t (and lseek64 and other xxx64 functions)
diff --git a/core/combo/include/arch/windows/AndroidConfig.h b/core/combo/include/arch/windows/AndroidConfig.h
index 83d0a0f..0a52674 100644
--- a/core/combo/include/arch/windows/AndroidConfig.h
+++ b/core/combo/include/arch/windows/AndroidConfig.h
@@ -15,7 +15,7 @@
*/
/*
- * Android config -- "CYGWIN_NT-5.1".
+ * Android config -- "CYGWIN_NT-5.1".
*
* Cygwin has pthreads, but GDB seems to get confused if you use it to
* create threads. By "confused", I mean it freezes up the first time the
@@ -37,6 +37,24 @@
* comments.
*/
+/* MingW doesn't define __BEGIN_DECLS / __END_DECLS. */
+
+#ifndef __BEGIN_DECLS
+# ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# else
+# define __BEGIN_DECLS
+# endif
+#endif
+
+#ifndef __END_DECLS
+# ifdef __cplusplus
+# define __END_DECLS }
+# else
+# define __END_DECLS
+# endif
+#endif
+
/*
* Threading model. Choose one:
*
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index f8c99fb..cc2c872 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -3,16 +3,31 @@
# Inputs:
# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system
# default
+# ALTERNATE_JAVAC -- the alternate java compiler to use
#
# Outputs:
# COMMON_JAVAC -- Java compiler command with common arguments
+#
+
+ifeq ($(EXPERIMENTAL_USE_JAVA7),)
+common_flags := -target 1.5 -Xmaxerrs 9999999
+else
+common_flags := -source 1.7 -target 1.7 -Xmaxerrs 9999999
+endif
+
+# Use the indexer wrapper to index the codebase instead of the javac compiler
+ifeq ($(ALTERNATE_JAVAC),)
+JAVACC := javac
+else
+JAVACC := $(ALTERNATE_JAVAC)
+endif
# Whatever compiler is on this system.
ifeq ($(BUILD_OS), windows)
COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
- -target 1.5 -Xmaxerrs 9999999
+ $(common_flags)
else
- COMMON_JAVAC := javac -J-Xmx512M -target 1.5 -Xmaxerrs 9999999
+ COMMON_JAVAC := $(JAVACC) -J-Xmx512M $(common_flags)
endif
# Eclipse.
@@ -22,16 +37,8 @@
$(info CUSTOM_JAVA_COMPILER=eclipse)
endif
-# OpenJDK.
-ifeq ($(CUSTOM_JAVA_COMPILER), openjdk)
- # We set the VM options (like -Xmx) in the javac script.
- COMMON_JAVAC := prebuilt/common/openjdk/bin/javac -target 1.5 \
- -Xmaxerrs 9999999
- $(info CUSTOM_JAVA_COMPILER=openjdk)
-endif
-
HOST_JAVAC ?= $(COMMON_JAVAC)
TARGET_JAVAC ?= $(COMMON_JAVAC)
-
+
#$(info HOST_JAVAC=$(HOST_JAVAC))
#$(info TARGET_JAVAC=$(TARGET_JAVAC))
diff --git a/core/combo/select.mk b/core/combo/select.mk
index e485d00..c1a7cc0 100644
--- a/core/combo/select.mk
+++ b/core/combo/select.mk
@@ -18,43 +18,52 @@
#
# Inputs:
# combo_target -- prefix for final variables (HOST_ or TARGET_)
+# combo_2nd_arch_prefix -- it's defined if this is loaded for TARGET_2ND_ARCH.
#
# Build a target string like "linux-arm" or "darwin-x86".
+ifdef combo_2nd_arch_prefix
+combo_os_arch := $($(combo_target)OS)-$(TARGET_2ND_ARCH)
+else
combo_os_arch := $($(combo_target)OS)-$($(combo_target)ARCH)
+endif
+
+combo_var_prefix := $(combo_2nd_arch_prefix)$(combo_target)
# Set reasonable defaults for the various variables
-$(combo_target)CC := $(CC)
-$(combo_target)CXX := $(CXX)
-$(combo_target)AR := $(AR)
-$(combo_target)STRIP := $(STRIP)
+$(combo_var_prefix)CC := $(CC)
+$(combo_var_prefix)CXX := $(CXX)
+$(combo_var_prefix)AR := $(AR)
+$(combo_var_prefix)STRIP := $(STRIP)
-$(combo_target)BINDER_MINI := 0
+$(combo_var_prefix)BINDER_MINI := 0
-$(combo_target)HAVE_EXCEPTIONS := 0
-$(combo_target)HAVE_UNIX_FILE_PATH := 1
-$(combo_target)HAVE_WINDOWS_FILE_PATH := 0
-$(combo_target)HAVE_RTTI := 1
-$(combo_target)HAVE_CALL_STACKS := 1
-$(combo_target)HAVE_64BIT_IO := 1
-$(combo_target)HAVE_CLOCK_TIMERS := 1
-$(combo_target)HAVE_PTHREAD_RWLOCK := 1
-$(combo_target)HAVE_STRNLEN := 1
-$(combo_target)HAVE_STRERROR_R_STRRET := 1
-$(combo_target)HAVE_STRLCPY := 0
-$(combo_target)HAVE_STRLCAT := 0
-$(combo_target)HAVE_KERNEL_MODULES := 0
+$(combo_var_prefix)HAVE_EXCEPTIONS := 0
+$(combo_var_prefix)HAVE_UNIX_FILE_PATH := 1
+$(combo_var_prefix)HAVE_WINDOWS_FILE_PATH := 0
+$(combo_var_prefix)HAVE_RTTI := 1
+$(combo_var_prefix)HAVE_CALL_STACKS := 1
+$(combo_var_prefix)HAVE_64BIT_IO := 1
+$(combo_var_prefix)HAVE_CLOCK_TIMERS := 1
+$(combo_var_prefix)HAVE_PTHREAD_RWLOCK := 1
+$(combo_var_prefix)HAVE_STRNLEN := 1
+$(combo_var_prefix)HAVE_STRERROR_R_STRRET := 1
+$(combo_var_prefix)HAVE_STRLCPY := 0
+$(combo_var_prefix)HAVE_STRLCAT := 0
+$(combo_var_prefix)HAVE_KERNEL_MODULES := 0
-$(combo_target)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
-$(combo_target)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
-$(combo_target)GLOBAL_LDFLAGS :=
-$(combo_target)GLOBAL_ARFLAGS := crsP
+$(combo_var_prefix)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
+$(combo_var_prefix)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
+$(combo_var_prefix)GLOBAL_CPPFLAGS :=
+$(combo_var_prefix)GLOBAL_LDFLAGS :=
+$(combo_var_prefix)GLOBAL_ARFLAGS := crsPD
+$(combo_var_prefix)GLOBAL_LD_DIRS :=
-$(combo_target)EXECUTABLE_SUFFIX :=
-$(combo_target)SHLIB_SUFFIX := .so
-$(combo_target)JNILIB_SUFFIX := $($(combo_target)SHLIB_SUFFIX)
-$(combo_target)STATIC_LIB_SUFFIX := .a
+$(combo_var_prefix)EXECUTABLE_SUFFIX :=
+$(combo_var_prefix)SHLIB_SUFFIX := .so
+$(combo_var_prefix)JNILIB_SUFFIX := $($(combo_var_prefix)SHLIB_SUFFIX)
+$(combo_var_prefix)STATIC_LIB_SUFFIX := .a
# Now include the combo for this specific target.
include $(BUILD_COMBOS)/$(combo_target)$(combo_os_arch).mk
@@ -88,11 +97,11 @@
ccache := $(strip $(wildcard $(ccache)))
ifdef ccache
# prepend ccache if necessary
- ifneq ($(ccache),$(firstword $($(combo_target)CC)))
- $(combo_target)CC := $(ccache) $($(combo_target)CC)
+ ifneq ($(ccache),$(firstword $($(combo_var_prefix)CC)))
+ $(combo_var_prefix)CC := $(ccache) $($(combo_var_prefix)CC)
endif
- ifneq ($(ccache),$(firstword $($(combo_target)CXX)))
- $(combo_target)CXX := $(ccache) $($(combo_target)CXX)
+ ifneq ($(ccache),$(firstword $($(combo_var_prefix)CXX)))
+ $(combo_var_prefix)CXX := $(ccache) $($(combo_var_prefix)CXX)
endif
ccache =
endif
diff --git a/core/config.mk b/core/config.mk
index 96993c0..ee47772 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -79,6 +79,9 @@
BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk
BUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mk
BUILD_NOTICE_FILE := $(BUILD_SYSTEM)/notice_files.mk
+BUILD_HOST_DALVIK_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_java_library.mk
+BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk
+
-include cts/build/config.mk
@@ -114,9 +117,6 @@
# TODO: do symbol compression
TARGET_COMPRESS_MODULE_SYMBOLS := false
-# Default shell is mksh. Other possible value is ash.
-TARGET_SHELL := mksh
-
# ###############################################################
# Include sub-configuration files
# ###############################################################
@@ -136,49 +136,6 @@
# are specific to the user's build configuration.
include $(BUILD_SYSTEM)/envsetup.mk
-# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
-# or under vendor/*/$(TARGET_DEVICE). Search in both places, but
-# make sure only one exists.
-# Real boards should always be associated with an OEM vendor.
-board_config_mk := \
- $(strip $(wildcard \
- $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
- $(shell test -d device && find device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
- $(shell test -d vendor && find vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
- ))
-ifeq ($(board_config_mk),)
- $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
-endif
-ifneq ($(words $(board_config_mk)),1)
- $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
-endif
-include $(board_config_mk)
-ifeq ($(TARGET_ARCH),)
- $(error TARGET_ARCH not defined by board config: $(board_config_mk))
-endif
-TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
-board_config_mk :=
-
-# Perhaps we should move this block to build/core/Makefile,
-# once we don't have TARGET_NO_KERNEL reference in AndroidBoard.mk/Android.mk.
-ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
- INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
- ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
- INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
- else
- INSTALLED_2NDBOOTLOADER_TARGET :=
- endif
-else
- INSTALLED_BOOTLOADER_MODULE :=
- INSTALLED_2NDBOOTLOADER_TARGET :=
-endif # TARGET_NO_BOOTLOADER
-ifneq ($(strip $(TARGET_NO_KERNEL)),true)
- INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
-else
- INSTALLED_KERNEL_TARGET :=
-endif
-
-
# The build system exposes several variables for where to find the kernel
# headers:
# TARGET_DEVICE_KERNEL_HEADERS is automatically created for the current
@@ -251,14 +208,23 @@
endef
combo_target := HOST_
+combo_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/combo/select.mk
# on windows, the tools have .exe at the end, and we depend on the
# host config stuff being done first
combo_target := TARGET_
+combo_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/combo/select.mk
+# Load the 2nd target arch if it's needed.
+ifdef TARGET_2ND_ARCH
+combo_target := TARGET_
+combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
+include $(BUILD_SYSTEM)/combo/select.mk
+endif
+
# Compute TARGET_TOOLCHAIN_ROOT from TARGET_TOOLS_PREFIX
# if only TARGET_TOOLS_PREFIX is passed to the make command.
ifndef TARGET_TOOLCHAIN_ROOT
@@ -267,6 +233,37 @@
TARGET_TOOLCHAIN_ROOT := $(wildcard $(TARGET_TOOLCHAIN_ROOT))
endif
+# Normalize WITH_STATIC_ANALYZER and WITH_SYNTAX_CHECK
+ifeq ($(strip $(WITH_STATIC_ANALYZER)),0)
+ WITH_STATIC_ANALYZER :=
+endif
+ifeq ($(strip $(WITH_SYNTAX_CHECK)),0)
+ WITH_SYNTAX_CHECK :=
+endif
+
+# Disable WITH_STATIC_ANALYZER and WITH_SYNTAX_CHECK if tool can't be found
+SYNTAX_TOOLS_PREFIX := prebuilts/clang/$(HOST_PREBUILT_TAG)/host/3.3/bin
+ifneq ($(strip $(WITH_STATIC_ANALYZER)),)
+ ifeq ($(wildcard $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer),)
+ $(warning *** Disable WITH_STATIC_ANALYZER because $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer does not exist)
+ WITH_STATIC_ANALYZER :=
+ endif
+endif
+ifneq ($(strip $(WITH_SYNTAX_CHECK)),)
+ ifeq ($(wildcard $(SYNTAX_TOOLS_PREFIX)/ccc-syntax),)
+ $(warning *** Disable WITH_SYNTAX_CHECK because $(SYNTAX_TOOLS_PREFIX)/ccc-syntax does not exist)
+ WITH_SYNTAX_CHECK :=
+ endif
+endif
+
+# WITH_STATIC_ANALYZER trumps WITH_SYNTAX_CHECK
+ifneq ($(strip $(WITH_STATIC_ANALYZER)),)
+ ifneq ($(strip $(WITH_SYNTAX_CHECK)),)
+ $(warning *** Disable WITH_SYNTAX_CHECK in the presence of static analyzer WITH_STATIC_ANALYZER)
+ WITH_SYNTAX_CHECK :=
+ endif
+endif
+
# Pick a Java compiler.
include $(BUILD_SYSTEM)/combo/javac.mk
@@ -311,7 +308,11 @@
SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
+ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG)))
MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX)
+else
+MKBOOTIMG := $(BOARD_CUSTOM_MKBOOTIMG)
+endif
MKYAFFS2 := $(HOST_OUT_EXECUTABLES)/mkyaffs2image$(HOST_EXECUTABLE_SUFFIX)
APICHECK := $(HOST_OUT_EXECUTABLES)/apicheck$(HOST_EXECUTABLE_SUFFIX)
FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX)
@@ -329,8 +330,6 @@
JAVATAGS := build/tools/java-event-log-tags.py
LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc$(HOST_EXECUTABLE_SUFFIX)
BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat$(HOST_EXECUTABLE_SUFFIX)
-DEXOPT := $(HOST_OUT_EXECUTABLES)/dexopt$(HOST_EXECUTABLE_SUFFIX)
-DEXPREOPT := dalvik/tools/dex-preopt
LINT := prebuilts/sdk/tools/lint
# ACP is always for the build OS, not for the host OS
@@ -354,16 +353,20 @@
OLD_FLEX := prebuilts/misc/$(HOST_PREBUILT_TAG)/flex/flex-2.5.4a$(HOST_EXECUTABLE_SUFFIX)
ifeq ($(HOST_OS),darwin)
-# Mac OS' screwy version of java uses a non-standard directory layout
-# and doesn't even seem to have tools.jar. On the other hand, javac seems
-# to be able to magically find the classes in there, wherever they are, so
-# leave this blank
+ifneq ($(EXPERIMENTAL_USE_JAVA7),)
+HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
+else
+# Deliberately set to blank for Java 6 installations on MacOS. These
+# versions allegedly use a non-standard directory structure.
HOST_JDK_TOOLS_JAR :=
+endif
else
HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
+endif
+
+ifneq ($(HOST_JDK_TOOLS_JAR),)
ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
-$(error Error: could not find jdk tools.jar, please install JDK6, \
- which you can download from java.sun.com)
+$(error Error: could not find jdk tools.jar, please install JDK6)
endif
endif
@@ -428,6 +431,19 @@
TARGET_GLOBAL_CFLAGS += $(TARGET_RELEASE_CFLAGS)
TARGET_GLOBAL_CPPFLAGS += $(TARGET_RELEASE_CPPFLAGS)
+ifdef TARGET_2ND_ARCH
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
+$(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
+$(combo_2nd_arch_prefix)TARGET_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_LD_DIRS += -L$($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)
+$(combo_2nd_arch_prefix)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += $(TARGET_ERROR_FLAGS)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += $(TARGET_ERROR_FLAGS)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += $($(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += $($(combo_2nd_arch_prefix)TARGET_RELEASE_CPPFLAGS)
+endif
+
# allow overriding default Java libraries on a per-target basis
ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
TARGET_DEFAULT_JAVA_LIBRARIES := core core-junit ext framework framework2
diff --git a/core/definitions.mk b/core/definitions.mk
index 9a4a274..9774a68 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -426,6 +426,7 @@
# $(2): target name, like "NotePad"
# $(3): if non-empty, this is a HOST target.
# $(4): if non-empty, force the intermediates to be COMMON
+# $(5): if non-empty, force the intermedistes to be for the 2nd arch
define intermediates-dir-for
$(strip \
$(eval _idfClass := $(strip $(1))) \
@@ -435,10 +436,11 @@
$(if $(_idfName),, \
$(error $(LOCAL_PATH): Name not defined in call to intermediates-dir-for)) \
$(eval _idfPrefix := $(if $(strip $(3)),HOST,TARGET)) \
+ $(eval _idf2ndArchPrefix := $(if $(strip $(5)),$(TARGET_2ND_ARCH_VAR_PREFIX))) \
$(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
$(eval _idfIntBase := $($(_idfPrefix)_OUT_COMMON_INTERMEDIATES)) \
, \
- $(eval _idfIntBase := $($(_idfPrefix)_OUT_INTERMEDIATES)) \
+ $(eval _idfIntBase := $($(_idf2ndArchPrefix)$(_idfPrefix)_OUT_INTERMEDIATES)) \
) \
$(_idfIntBase)/$(_idfClass)/$(_idfName)_intermediates \
)
@@ -448,13 +450,59 @@
# to determine the intermediates directory.
#
# $(1): if non-empty, force the intermediates to be COMMON
+# $(2): if non-empty, force the intermediates to be for the 2nd arch
define local-intermediates-dir
$(strip \
$(if $(strip $(LOCAL_MODULE_CLASS)),, \
$(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)) \
+ $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(LOCAL_IS_HOST_MODULE),$(1),$(2)) \
+)
+endef
+
+###########################################################
+## The generated sources directory. Placing generated
+## source files directly in the intermediates directory
+## causes problems for multiarch builds, where there are
+## two intermediates directories for a single target. Put
+## them in a separate directory, and they will be copied to
+## each intermediates directory automatically.
+###########################################################
+
+# $(1): target class, like "APPS"
+# $(2): target name, like "NotePad"
+# $(3): if non-empty, this is a HOST target.
+# $(4): if non-empty, force the generated sources to be COMMON
+define generated-sources-dir-for
+$(strip \
+ $(eval _idfClass := $(strip $(1))) \
+ $(if $(_idfClass),, \
+ $(error $(LOCAL_PATH): Class not defined in call to generated-sources-dir-for)) \
+ $(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)) \
+ $(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
+ $(eval _idfIntBase := $($(_idfPrefix)_OUT_GEN_COMMON)) \
+ , \
+ $(eval _idfIntBase := $($(_idfPrefix)_OUT_GEN)) \
+ ) \
+ $(_idfIntBase)/$(_idfClass)/$(_idfName)_intermediates \
+)
+endef
+
+# Uses LOCAL_MODULE_CLASS, LOCAL_MODULE, and LOCAL_IS_HOST_MODULE
+# to determine the generated sources directory.
+#
+# $(1): if non-empty, force the intermediates to be COMMON
+define local-generated-sources-dir
+$(strip \
+ $(if $(strip $(LOCAL_MODULE_CLASS)),, \
+ $(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)) \
)
endef
@@ -1032,11 +1080,11 @@
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(filter-out $(PRIVATE_C_INCLUDES), \
$(HOST_PROJECT_INCLUDES) \
- $(HOST_C_INCLUDES)))) \
+ $(PRIVATE_HOST_C_INCLUDES)))) \
-c \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
- $(HOST_GLOBAL_CFLAGS) \
- $(HOST_GLOBAL_CPPFLAGS) \
+ $(PRIVATE_HOST_GLOBAL_CFLAGS) \
+ $(PRIVATE_HOST_GLOBAL_CPPFLAGS) \
) \
$(PRIVATE_CFLAGS) \
$(PRIVATE_CPPFLAGS) \
@@ -1060,10 +1108,10 @@
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(filter-out $(PRIVATE_C_INCLUDES), \
$(HOST_PROJECT_INCLUDES) \
- $(HOST_C_INCLUDES)))) \
+ $(PRIVATE_HOST_C_INCLUDES)))) \
-c \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
- $(HOST_GLOBAL_CFLAGS) \
+ $(PRIVATE_HOST_GLOBAL_CFLAGS) \
) \
$(1) \
-MD -MF $(patsubst %.o,%.d,$@) -o $@ $<
@@ -1135,10 +1183,11 @@
mkdir -p $$ldir; \
filelist=; \
for f in `$(TARGET_AR) t $(1)`; do \
- $(TARGET_AR) p $(1) $$f > $$ldir/$$f; \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) p $(1) $$f > $$ldir/$$f; \
filelist="$$filelist $$ldir/$$f"; \
done ; \
- $(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $$filelist
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \
+ $(PRIVATE_ARFLAGS) $@ $$filelist
endef
@@ -1154,7 +1203,8 @@
@rm -f $@
$(extract-and-include-target-whole-static-libs)
@echo "target StaticLib: $(PRIVATE_MODULE) ($@)"
-$(call split-long-arguments,$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@,$(filter %.o, $^))
+$(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \
+ $(PRIVATE_ARFLAGS) $@,$(filter %.o, $^))
endef
###########################################################
@@ -1207,7 +1257,7 @@
$(PRIVATE_LDFLAGS) \
$(HOST_GLOBAL_LD_DIRS) \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
- $(HOST_GLOBAL_LDFLAGS) \
+ $(PRIVATE_HOST_GLOBAL_LDFLAGS) \
) \
$(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \
@@ -1275,13 +1325,7 @@
define transform-o-to-shared-lib
@mkdir -p $(dir $@)
@echo "target SharedLib: $(PRIVATE_MODULE) ($@)"
-$(transform-o-to-shared-lib-inner)
-endef
-
-define transform-o-to-package
-@mkdir -p $(dir $@)
-@echo "target Package: $(PRIVATE_MODULE) ($@)"
-$(transform-o-to-shared-lib-inner)
+$($(PRIVATE_2ND_ARCH_VAR_PREFIX)transform-o-to-shared-lib-inner)
endef
@@ -1292,7 +1336,7 @@
define transform-to-stripped
@mkdir -p $(dir $@)
@echo "target Strip: $(PRIVATE_MODULE) ($@)"
-$(hide) $(TARGET_STRIP_COMMAND)
+$(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_STRIP_COMMAND)
endef
@@ -1324,7 +1368,7 @@
define transform-o-to-executable
@mkdir -p $(dir $@)
@echo "target Executable: $(PRIVATE_MODULE) ($@)"
-$(transform-o-to-executable-inner)
+$($(PRIVATE_2ND_ARCH_VAR_PREFIX)transform-o-to-executable-inner)
endef
@@ -1343,7 +1387,7 @@
define transform-o-to-static-executable
@mkdir -p $(dir $@)
@echo "target StaticExecutable: $(PRIVATE_MODULE) ($@)"
-$(transform-o-to-static-executable-inner)
+$($(PRIVATE_2ND_ARCH_VAR_PREFIX)transform-o-to-static-executable-inner)
endef
@@ -1367,7 +1411,8 @@
$(HOST_GLOBAL_LD_DIRS) \
$(PRIVATE_LDFLAGS) \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
- $(HOST_GLOBAL_LDFLAGS) \
+ $(PRIVATE_HOST_GLOBAL_LDFLAGS) \
+ -fPIE -pie \
) \
-o $@ \
$(PRIVATE_LDLIBS)
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index e2e76b8..160f128 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -1,84 +1,72 @@
####################################
-# Dexpreopt on the boot jars
+# dexpreopt support - typically used on user builds to run dexopt (for Dalvik) or dex2oat (for ART) ahead of time
#
####################################
-DEXPREOPT_BOOT_JARS := $(PRODUCT_BOOT_JARS)
-DEXPREOPT_BOOT_JARS_MODULES := $(subst :, ,$(DEXPREOPT_BOOT_JARS))
+ifeq ($(DALVIK_VM_LIB),)
+$(error No value for DALVIK_VM_LIB)
+endif
+
+# list of boot classpath jars for dexpreopt
+DEXPREOPT_BOOT_JARS := $(subst $(space),:,$(PRODUCT_BOOT_JARS))
+DEXPREOPT_BOOT_JARS_MODULES := $(PRODUCT_BOOT_JARS)
PRODUCT_BOOTCLASSPATH := $(subst $(space),:,$(foreach m,$(DEXPREOPT_BOOT_JARS_MODULES),/system/framework/$(m).jar))
DEXPREOPT_BUILD_DIR := $(OUT_DIR)
-DEXPREOPT_PRODUCT_DIR := $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(PRODUCT_OUT))/dex_bootjars
+DEXPREOPT_PRODUCT_DIR_FULL_PATH := $(PRODUCT_OUT)/dex_bootjars
+DEXPREOPT_PRODUCT_DIR := $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(DEXPREOPT_PRODUCT_DIR_FULL_PATH))
DEXPREOPT_BOOT_JAR_DIR := system/framework
-DEXPREOPT_DEXOPT := $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(DEXOPT))
-
-DEXPREOPT_BOOT_JAR_DIR_FULL_PATH := $(DEXPREOPT_BUILD_DIR)/$(DEXPREOPT_PRODUCT_DIR)/$(DEXPREOPT_BOOT_JAR_DIR)
-
-DEXPREOPT_BOOT_ODEXS := $(foreach b,$(DEXPREOPT_BOOT_JARS_MODULES),\
- $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(b).odex)
-
-# If the target is a uniprocessor, then explicitly tell the preoptimizer
-# that fact. (By default, it always optimizes for an SMP target.)
-ifeq ($(TARGET_CPU_SMP),true)
-DEXPREOPT_UNIPROCESSOR :=
-else
-DEXPREOPT_UNIPROCESSOR := --uniprocessor
-endif
+DEXPREOPT_BOOT_JAR_DIR_FULL_PATH := $(DEXPREOPT_PRODUCT_DIR_FULL_PATH)/$(DEXPREOPT_BOOT_JAR_DIR)
# $(1): the .jar or .apk to remove classes.dex
define dexpreopt-remove-classes.dex
$(hide) $(AAPT) remove $(1) classes.dex
endef
-# $(1): the input .jar or .apk file
-# $(2): the output .odex file
-define dexpreopt-one-file
-$(hide) $(DEXPREOPT) --dexopt=$(DEXPREOPT_DEXOPT) --build-dir=$(DEXPREOPT_BUILD_DIR) \
- --product-dir=$(DEXPREOPT_PRODUCT_DIR) --boot-dir=$(DEXPREOPT_BOOT_JAR_DIR) \
- --boot-jars=$(DEXPREOPT_BOOT_JARS) $(DEXPREOPT_UNIPROCESSOR) \
- $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(1)) \
- $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(2))
-endef
+# Special rules for building stripped boot jars that override java_library.mk rules
# $(1): boot jar module name
-define _dexpreopt-boot-jar
-$(eval _dbj_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1).jar)
-$(eval _dbj_odex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1).odex)
-$(eval _dbj_jar_no_dex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1)_nodex.jar)
-$(eval _dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar)
-$(eval $(_dbj_odex): PRIVATE_DBJ_JAR := $(_dbj_jar))
-$(_dbj_odex) : $(_dbj_src_jar) | $(ACP) $(DEXPREOPT) $(DEXOPT)
- @echo "Dexpreopt Boot Jar: $$@"
- $(hide) rm -f $$@
- $(hide) mkdir -p $$(dir $$@)
- $(hide) $(ACP) -fp $$< $$(PRIVATE_DBJ_JAR)
- $$(call dexpreopt-one-file,$$(PRIVATE_DBJ_JAR),$$@)
+define _dexpreopt-boot-jar-remove-classes.dex
+_dbj_jar_no_dex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1)_nodex.jar
+_dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
-$(_dbj_jar_no_dex) : $(_dbj_src_jar) | $(ACP) $(AAPT)
+$$(_dbj_jar_no_dex) : $$(_dbj_src_jar) | $(ACP) $(AAPT)
$$(call copy-file-to-target)
ifneq ($(DEX_PREOPT_DEFAULT),nostripping)
$$(call dexpreopt-remove-classes.dex,$$@)
endif
-$(eval _dbj_jar :=)
-$(eval _dbj_odex :=)
-$(eval _dbj_jar_no_dex :=)
-$(eval _dbj_src_jar :=)
+_dbj_jar_no_dex :=
+_dbj_src_jar :=
endef
-$(foreach b,$(DEXPREOPT_BOOT_JARS_MODULES),$(eval $(call _dexpreopt-boot-jar,$(b))))
+$(foreach b,$(DEXPREOPT_BOOT_JARS_MODULES),$(eval $(call _dexpreopt-boot-jar-remove-classes.dex,$(b))))
-# $(1): the rest list of boot jars
-define _build-dexpreopt-boot-jar-dependency-pair
-$(if $(filter 1,$(words $(1)))$(filter 0,$(words $(1))),,\
- $(eval _bdbjdp_target := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(word 2,$(1)).odex) \
- $(eval _bdbjdp_dep := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(word 1,$(1)).odex) \
- $(eval $(call add-dependency,$(_bdbjdp_target),$(_bdbjdp_dep))) \
- $(eval $(call _build-dexpreopt-boot-jar-dependency-pair,$(wordlist 2,999,$(1)))))
+# Conditionally include Dalvik support.
+ifeq ($(DALVIK_VM_LIB),libdvm.so)
+include $(BUILD_SYSTEM)/dex_preopt_libdvm.mk
+endif
+
+# Unconditionally include ART support because its used run dex2oat on the host for tests.
+include $(BUILD_SYSTEM)/dex_preopt_libart.mk
+
+# Define dexpreopt-one-file based on current default runtime.
+# $(1): the boot image to use (unused for libdvm)
+# $(2): the input .jar or .apk file
+# $(3): the input .jar or .apk target location (unused for libdvm)
+# $(4): the output .odex file
+ifeq ($(DALVIK_VM_LIB),libdvm.so)
+define dexpreopt-one-file
+$(call dexopt-one-file,$(2),$(4))
endef
-define _build-dexpreopt-boot-jar-dependency
-$(call _build-dexpreopt-boot-jar-dependency-pair,$(DEXPREOPT_BOOT_JARS_MODULES))
+DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS := $(DEXOPT_DEPENDENCY)
+DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $(DEXPREOPT_BOOT_ODEXS)
+else
+define dexpreopt-one-file
+$(call dex2oat-one-file,$(1),$(2),$(3),$(4))
endef
-$(eval $(call _build-dexpreopt-boot-jar-dependency))
+DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS := $(DEX2OAT_DEPENDENCY)
+DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $(DEFAULT_DEX_PREOPT_BUILT_IMAGE)
+endif
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
new file mode 100644
index 0000000..fa2b7e3
--- /dev/null
+++ b/core/dex_preopt_libart.mk
@@ -0,0 +1,100 @@
+####################################
+# dexpreopt support for ART
+#
+####################################
+
+DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
+DEX2OATD := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
+
+LIBART_COMPILER := $(HOST_OUT_SHARED_LIBRARIES)/libart-compiler$(HOST_SHLIB_SUFFIX)
+LIBARTD_COMPILER := $(HOST_OUT_SHARED_LIBRARIES)/libartd-compiler$(HOST_SHLIB_SUFFIX)
+
+# TODO: for now, override with debug version for better error reporting
+DEX2OAT := $(DEX2OATD)
+LIBART_COMPILER := $(LIBARTD_COMPILER)
+
+# By default, do not run rerun dex2oat if the tool changes.
+# Comment out the | to force dex2oat to rerun on after all changes.
+DEX2OAT_DEPENDENCY := art/runtime/oat.cc # dependency on oat version number
+DEX2OAT_DEPENDENCY += art/runtime/image.cc # dependency on image version number
+DEX2OAT_DEPENDENCY += |
+DEX2OAT_DEPENDENCY += $(DEX2OAT)
+DEX2OAT_DEPENDENCY += $(LIBART_COMPILER)
+
+PRELOADED_CLASSES := frameworks/base/preloaded-classes
+
+LIBART_BOOT_IMAGE := /$(DEXPREOPT_BOOT_JAR_DIR)/boot.art
+
+DEFAULT_DEX_PREOPT_BUILT_IMAGE := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.art
+
+DEFAULT_DEX_PREOPT_INSTALLED_IMAGE :=
+ifneq ($(PRODUCT_DEX_PREOPT_IMAGE_IN_DATA),true)
+DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := $(PRODUCT_OUT)$(LIBART_BOOT_IMAGE)
+
+# The rule to install boot.art and boot.oat
+$(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) | $(ACP)
+ $(call copy-file-to-target)
+ $(hide) $(ACP) -fp $(patsubst %.art,%.oat,$<) $(patsubst %.art,%.oat,$@)
+endif
+
+DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
+ifeq ($(TARGET_CPU_VARIANT),$(filter $(TARGET_CPU_VARIANT),cortex-a15 krait))
+DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div
+endif
+
+# start of image reserved address space
+LIBART_IMG_HOST_BASE_ADDRESS := 0x60000000
+
+ifeq ($(TARGET_ARCH),mips)
+LIBART_IMG_TARGET_BASE_ADDRESS := 0x30000000
+else
+LIBART_IMG_TARGET_BASE_ADDRESS := 0x60000000
+endif
+
+########################################################################
+# The full system boot classpath
+
+# note we use core-libart.jar in place of core.jar for ART.
+LIBART_TARGET_BOOT_JARS := $(patsubst core, core-libart,$(DEXPREOPT_BOOT_JARS_MODULES))
+LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
+LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar)
+
+# The .oat with symbols
+LIBART_TARGET_BOOT_OAT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)$(patsubst %.art,%.oat,$(LIBART_BOOT_IMAGE))
+
+$(DEFAULT_DEX_PREOPT_BUILT_IMAGE): $(LIBART_TARGET_BOOT_DEX_FILES) $(DEX2OAT_DEPENDENCY)
+ @echo "target dex2oat: $@ ($?)"
+ @mkdir -p $(dir $@)
+ @mkdir -p $(dir $(LIBART_TARGET_BOOT_OAT_UNSTRIPPED))
+ $(hide) $(DEX2OAT) --runtime-arg -Xms256m --runtime-arg -Xmx256m --image-classes=$(PRELOADED_CLASSES) \
+ $(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \
+ $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \
+ --oat-symbols=$(LIBART_TARGET_BOOT_OAT_UNSTRIPPED) \
+ --oat-file=$(patsubst %.art,%.oat,$@) \
+ --oat-location=$(patsubst %.art,%.oat,$(LIBART_BOOT_IMAGE)) \
+ --image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \
+ --instruction-set=$(TARGET_ARCH) --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
+ --host-prefix=$(DEXPREOPT_PRODUCT_DIR_FULL_PATH) --android-root=$(PRODUCT_OUT)/system
+
+
+########################################################################
+# For a single jar or APK
+
+# $(1): the boot image to use
+# $(2): the input .jar or .apk file
+# $(3): the input .jar or .apk target location
+# $(4): the output .odex file
+define dex2oat-one-file
+$(hide) rm -f $(4)
+$(hide) mkdir -p $(dir $(4))
+$(hide) $(DEX2OAT) \
+ --runtime-arg -Xms64m --runtime-arg -Xmx64m \
+ --boot-image=$(1) \
+ --dex-file=$(2) \
+ --dex-location=$(3) \
+ --oat-file=$(4) \
+ --host-prefix=$(DEXPREOPT_PRODUCT_DIR_FULL_PATH) \
+ --android-root=$(PRODUCT_OUT)/system \
+ --instruction-set=$(TARGET_ARCH) \
+ --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
+endef
diff --git a/core/dex_preopt_libdvm.mk b/core/dex_preopt_libdvm.mk
new file mode 100644
index 0000000..23a54e1
--- /dev/null
+++ b/core/dex_preopt_libdvm.mk
@@ -0,0 +1,76 @@
+####################################
+# dexpreopt support for Dalvik
+#
+####################################
+
+DEXOPT := $(HOST_OUT_EXECUTABLES)/dexopt$(HOST_EXECUTABLE_SUFFIX)
+DEXPREOPT := dalvik/tools/dex-preopt
+
+DEXPREOPT_DEXOPT := $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(DEXOPT))
+
+DEXPREOPT_BOOT_ODEXS := $(foreach b,$(DEXPREOPT_BOOT_JARS_MODULES),\
+ $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(b).odex)
+
+# If the target is a uniprocessor, then explicitly tell the preoptimizer
+# that fact. (By default, it always optimizes for an SMP target.)
+ifeq ($(TARGET_CPU_SMP),true)
+ DEXPREOPT_UNIPROCESSOR :=
+else
+ DEXPREOPT_UNIPROCESSOR := --uniprocessor
+endif
+
+# By default, do not run rerun dexopt if the tool changes.
+# Comment out the | to force dex2oat to rerun on after all changes.
+DEXOPT_DEPENDENCY := |
+DEXOPT_DEPENDENCY += $(DEXPREOPT) $(DEXOPT)
+
+# $(1): the input .jar or .apk file
+# $(2): the output .odex file
+define dexopt-one-file
+$(hide) rm -f $(2)
+$(hide) mkdir -p $(dir $(2))
+$(hide) $(DEXPREOPT) \
+ --dexopt=$(DEXPREOPT_DEXOPT) \
+ --build-dir=$(DEXPREOPT_BUILD_DIR) \
+ --product-dir=$(DEXPREOPT_PRODUCT_DIR) \
+ --boot-dir=$(DEXPREOPT_BOOT_JAR_DIR) \
+ --boot-jars=$(DEXPREOPT_BOOT_JARS) \
+ $(DEXPREOPT_UNIPROCESSOR) \
+ $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(1)) \
+ $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(2))
+endef
+
+# Special rules for building odex files for boot jars that override java_library.mk rules
+
+# $(1): boot jar module name
+define _dexpreopt-boot-odex
+_dbj_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1).jar
+_dbj_odex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1).odex
+_dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
+$$(_dbj_odex): PRIVATE_DBJ_JAR := $$(_dbj_jar)
+$$(_dbj_odex) : $$(_dbj_src_jar) | $(ACP) $(DEXPREOPT) $(DEXOPT)
+ @echo "Dexpreopt Boot Jar: $$@"
+ $(hide) mkdir -p $$(dir $$(PRIVATE_DBJ_JAR)) && $(ACP) -fp $$< $$(PRIVATE_DBJ_JAR)
+ $$(call dexopt-one-file,$$(PRIVATE_DBJ_JAR),$$@)
+
+_dbj_jar :=
+_dbj_odex :=
+_dbj_src_jar :=
+endef
+
+$(foreach b,$(DEXPREOPT_BOOT_JARS_MODULES),$(eval $(call _dexpreopt-boot-odex,$(b))))
+
+# $(1): the rest list of boot jars
+define _build-dexpreopt-boot-jar-dependency-pair
+$(if $(filter 1,$(words $(1)))$(filter 0,$(words $(1))),,\
+ $(eval _bdbjdp_target := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(word 2,$(1)).odex) \
+ $(eval _bdbjdp_dep := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(word 1,$(1)).odex) \
+ $(eval $(call add-dependency,$(_bdbjdp_target),$(_bdbjdp_dep))) \
+ $(eval $(call _build-dexpreopt-boot-jar-dependency-pair,$(wordlist 2,999,$(1)))))
+endef
+
+define _build-dexpreopt-boot-jar-dependency
+$(call _build-dexpreopt-boot-jar-dependency-pair,$(DEXPREOPT_BOOT_JARS_MODULES))
+endef
+
+$(eval $(call _build-dexpreopt-boot-jar-dependency))
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
new file mode 100644
index 0000000..b0b73af
--- /dev/null
+++ b/core/dex_preopt_odex_install.mk
@@ -0,0 +1,71 @@
+# dexpreopt_odex_install.mk is used to define odex creation rules for JARs and APKs
+# This file depends on variables set in base_rules.mk
+# Output variables: LOCAL_DEX_PREOPT, built_odex, dexpreopt_boot_jar_module
+
+# Setting LOCAL_DEX_PREOPT based on WITH_DEXPREOPT, LOCAL_DEX_PREOPT, etc
+LOCAL_DEX_PREOPT := $(strip $(LOCAL_DEX_PREOPT))
+ifneq (true,$(WITH_DEXPREOPT))
+ LOCAL_DEX_PREOPT :=
+else # WITH_DEXPREOPT=true
+ ifeq (,$(TARGET_BUILD_APPS)) # TARGET_BUILD_APPS empty
+ ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined
+ ifeq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES empty
+ LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
+ else # LOCAL_APK_LIBRARIES not empty
+ LOCAL_DEX_PREOPT := nostripping
+ endif # LOCAL_APK_LIBRARIES not empty
+ endif # LOCAL_DEX_PREOPT undefined
+ endif # TARGET_BUILD_APPS empty
+endif # WITH_DEXPREOPT=true
+ifeq (false,$(LOCAL_DEX_PREOPT))
+ LOCAL_DEX_PREOPT :=
+endif
+ifdef LOCAL_UNINSTALLABLE_MODULE
+LOCAL_DEX_PREOPT :=
+endif
+ifeq (,$(strip $(all_java_sources)$(full_static_java_libs)$(my_prebuilt_src_file))) # contains no java code
+LOCAL_DEX_PREOPT :=
+endif
+# if module oat file requested in data, disable LOCAL_DEX_PREOPT, will default location to dalvik-cache
+ifneq (,$(filter $(LOCAL_MODULE),$(PRODUCT_DEX_PREOPT_PACKAGES_IN_DATA)))
+LOCAL_DEX_PREOPT :=
+endif
+
+built_odex :=
+installed_odex :=
+ifdef LOCAL_DEX_PREOPT
+dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE))
+ifdef dexpreopt_boot_jar_module
+ifeq ($(DALVIK_VM_LIB),libdvm.so)
+built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
+installed_odex := $(basename $(LOCAL_INSTALLED_MODULE)).odex
+else # libdvm.so
+# For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
+# We use this installed_odex trick to get boot.art installed.
+installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
+endif # libdvm.so
+else # boot jar
+built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
+installed_odex := $(basename $(LOCAL_INSTALLED_MODULE)).odex
+
+ifneq ($(DALVIK_VM_LIB),libdvm.so) # libart
+ifndef LOCAL_DEX_PREOPT_IMAGE
+LOCAL_DEX_PREOPT_IMAGE := $(DEFAULT_DEX_PREOPT_BUILT_IMAGE)
+endif
+endif # libart
+endif # boot jar
+
+ifdef built_odex
+# We need $(LOCAL_BUILT_MODULE) in the deps to enforce reinstallation
+# even if $(built_odex) is byproduct of $(LOCAL_BUILT_MODULE), such as in package.mk.
+$(installed_odex) : $(built_odex) $(LOCAL_BUILT_MODULE) | $(ACP)
+ @echo "Install: $@"
+ $(copy-file-to-target)
+endif
+
+# Add the installed_odex to the list of installed files for this module.
+ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(installed_odex)
+# Make sure to install the .odex when you run "make <module_name>"
+$(my_register_name): $(installed_odex)
+
+endif # LOCAL_DEX_PREOPT
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index fd7f338..93b56d4 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -162,6 +162,7 @@
$(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
$(hide) ( \
javadoc \
+ -encoding UTF-8 \
\@$(PRIVATE_SRC_LIST_FILE) \
-J-Xmx1280m \
$(PRIVATE_PROFILING_OPTIONS) \
@@ -195,6 +196,7 @@
$(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
$(hide) ( \
javadoc \
+ -encoding UTF-8 \
$(PRIVATE_DROIDDOC_OPTIONS) \
\@$(PRIVATE_SRC_LIST_FILE) \
-J-Xmx1024m \
diff --git a/core/dumpvar.mk b/core/dumpvar.mk
index 92bf6af..2612e06 100644
--- a/core/dumpvar.mk
+++ b/core/dumpvar.mk
@@ -22,9 +22,9 @@
else ifeq ($(TARGET_ARCH),x86)
# Add the x86 toolchain bin dir if it actually exists
- ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/i686-linux-android-$(TARGET_GCC_VERSION)/bin),)
+ ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/x86_64-linux-android-$(TARGET_GCC_VERSION)/bin),)
# this should be copied to HOST_OUT_EXECUTABLES instead
- ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/i686-linux-android-$(TARGET_GCC_VERSION)/bin
+ ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/x86_64-linux-android-$(TARGET_GCC_VERSION)/bin
endif
endif
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 7778477..6d3d2b5 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -12,16 +12,6 @@
$(error This file should not be used to build host binaries. Included by (or near) $(lastword $(filter-out config/%,$(MAKEFILE_LIST))))
endif
-LOCAL_UNSTRIPPED_PATH := $(strip $(LOCAL_UNSTRIPPED_PATH))
-ifeq ($(LOCAL_UNSTRIPPED_PATH),)
- ifeq ($(LOCAL_MODULE_PATH),)
- LOCAL_UNSTRIPPED_PATH := $(TARGET_OUT_$(LOCAL_MODULE_CLASS)_UNSTRIPPED)
- else
- # We have to figure out the corresponding unstripped path if LOCAL_MODULE_PATH is customized.
- LOCAL_UNSTRIPPED_PATH := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(LOCAL_MODULE_PATH))
- endif
-endif
-
# The name of the target file, without any path prepended.
# TODO: This duplicates logic from base_rules.mk because we need to
# know its results before base_rules.mk is included.
@@ -41,7 +31,7 @@
# base_rules.make defines $(intermediates), but we need its value
# before we include base_rules. Make a guess, and verify that
# it's correct once the real value is defined.
-guessed_intermediates := $(call local-intermediates-dir)
+guessed_intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX))
# Define the target that is the unmodified output of the linker.
# The basename of this target must be the same as the final output
@@ -62,6 +52,8 @@
include $(BUILD_SYSTEM)/binary.mk
###################################
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
+
# Make sure that our guess at the value of intermediates was correct.
ifneq ($(intermediates),$(guessed_intermediates))
$(error Internal error: guessed path '$(guessed_intermediates)' doesn't match '$(intermediates))
@@ -94,8 +86,13 @@
###########################################################
## Store a copy with symbols for symbolic debugging
###########################################################
+ifeq ($(LOCAL_UNSTRIPPED_PATH),)
+my_unstripped_path := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
+else
+my_unstripped_path := $(LOCAL_UNSTRIPPED_PATH)
+endif
symbolic_input := $(compress_output)
-symbolic_output := $(LOCAL_UNSTRIPPED_PATH)/$(LOCAL_INSTALLED_MODULE_STEM)
+symbolic_output := $(my_unstripped_path)/$(LOCAL_INSTALLED_MODULE_STEM)
$(symbolic_output) : $(symbolic_input) | $(ACP)
@echo "target Symbolic: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
@@ -113,7 +110,9 @@
ifeq ($(LOCAL_STRIP_MODULE),true)
# Strip the binary
-$(strip_output): $(strip_input) | $(TARGET_STRIP)
+$(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
+$(strip_output): PRIVATE_OBJCOPY := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY)
+$(strip_output): $(strip_input) | $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
$(transform-to-stripped)
else
# Don't strip the binary, just copy it. We can't skip this step
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 8ac437e..4cb389b 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -120,6 +120,29 @@
$(error must be empty or one of: eng user userdebug)
endif
+# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
+# or under vendor/*/$(TARGET_DEVICE). Search in both places, but
+# make sure only one exists.
+# Real boards should always be associated with an OEM vendor.
+board_config_mk := \
+ $(strip $(wildcard \
+ $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
+ $(shell test -d device && find device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
+ $(shell test -d vendor && find vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
+ ))
+ifeq ($(board_config_mk),)
+ $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
+endif
+ifneq ($(words $(board_config_mk)),1)
+ $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
+endif
+include $(board_config_mk)
+ifeq ($(TARGET_ARCH),)
+ $(error TARGET_ARCH not defined by board config: $(board_config_mk))
+endif
+TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
+board_config_mk :=
+
# ---------------------------------------------------------------
# Set up configuration for target machine.
# The following must be set:
@@ -172,58 +195,92 @@
OUT_DOCS := $(TARGET_COMMON_OUT_ROOT)/docs
-BUILD_OUT_EXECUTABLES:= $(BUILD_OUT)/bin
+BUILD_OUT_EXECUTABLES := $(BUILD_OUT)/bin
-HOST_OUT_EXECUTABLES:= $(HOST_OUT)/bin
-HOST_OUT_SHARED_LIBRARIES:= $(HOST_OUT)/lib
-HOST_OUT_JAVA_LIBRARIES:= $(HOST_OUT)/framework
+HOST_OUT_EXECUTABLES := $(HOST_OUT)/bin
+HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib
+HOST_OUT_JAVA_LIBRARIES := $(HOST_OUT)/framework
HOST_OUT_SDK_ADDON := $(HOST_OUT)/sdk_addon
HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj
-HOST_OUT_HEADERS:= $(HOST_OUT_INTERMEDIATES)/include
+HOST_OUT_HEADERS := $(HOST_OUT_INTERMEDIATES)/include
HOST_OUT_INTERMEDIATE_LIBRARIES := $(HOST_OUT_INTERMEDIATES)/lib
-HOST_OUT_NOTICE_FILES:=$(HOST_OUT_INTERMEDIATES)/NOTICE_FILES
+HOST_OUT_NOTICE_FILES := $(HOST_OUT_INTERMEDIATES)/NOTICE_FILES
HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
+HOST_OUT_GEN := $(HOST_OUT)/gen
+HOST_OUT_COMMON_GEN := $(HOST_COMMON_OUT_ROOT)/gen
+
TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj
-TARGET_OUT_HEADERS:= $(TARGET_OUT_INTERMEDIATES)/include
+TARGET_OUT_HEADERS := $(TARGET_OUT_INTERMEDIATES)/include
TARGET_OUT_INTERMEDIATE_LIBRARIES := $(TARGET_OUT_INTERMEDIATES)/lib
TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj
+TARGET_OUT_GEN := $(PRODUCT_OUT)/gen
+TARGET_OUT_COMMON_GEN := $(TARGET_COMMON_OUT_ROOT)/gen
+
TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)
-TARGET_OUT_EXECUTABLES:= $(TARGET_OUT)/bin
-TARGET_OUT_OPTIONAL_EXECUTABLES:= $(TARGET_OUT)/xbin
-TARGET_OUT_SHARED_LIBRARIES:= $(TARGET_OUT)/lib
-TARGET_OUT_JAVA_LIBRARIES:= $(TARGET_OUT)/framework
-TARGET_OUT_APPS:= $(TARGET_OUT)/app
+TARGET_OUT_EXECUTABLES := $(TARGET_OUT)/bin
+TARGET_OUT_OPTIONAL_EXECUTABLES := $(TARGET_OUT)/xbin
+ifneq ($(filter %64,$(TARGET_ARCH)),)
+# /system/lib always contains 32-bit libraries,
+# and /system/lib64 (if present) always contains 64-bit libraries.
+TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib64
+else
+TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib
+endif
+TARGET_OUT_JAVA_LIBRARIES := $(TARGET_OUT)/framework
+TARGET_OUT_APPS := $(TARGET_OUT)/app
TARGET_OUT_APPS_PRIVILEGED := $(TARGET_OUT)/priv-app
TARGET_OUT_KEYLAYOUT := $(TARGET_OUT)/usr/keylayout
TARGET_OUT_KEYCHARS := $(TARGET_OUT)/usr/keychars
TARGET_OUT_ETC := $(TARGET_OUT)/etc
-TARGET_OUT_NOTICE_FILES:=$(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
+TARGET_OUT_NOTICE_FILES := $(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
+# Out for TARGET_2ND_ARCH
+TARGET_2ND_ARCH_VAR_PREFIX := 2ND_
+TARGET_2ND_ARCH_MODULE_SUFFIX := _32
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES)/lib
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS := $(TARGET_OUT_APPS)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS_PRIVILEGED := $(TARGET_OUT_APPS_PRIVILEGED)
+
TARGET_OUT_DATA := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)
-TARGET_OUT_DATA_EXECUTABLES:= $(TARGET_OUT_EXECUTABLES)
-TARGET_OUT_DATA_SHARED_LIBRARIES:= $(TARGET_OUT_SHARED_LIBRARIES)
-TARGET_OUT_DATA_JAVA_LIBRARIES:= $(TARGET_OUT_DATA)/framework
-TARGET_OUT_DATA_APPS:= $(TARGET_OUT_DATA)/app
+TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
+TARGET_OUT_DATA_SHARED_LIBRARIES := $(TARGET_OUT_SHARED_LIBRARIES)
+TARGET_OUT_DATA_JAVA_LIBRARIES := $(TARGET_OUT_DATA)/framework
+TARGET_OUT_DATA_APPS := $(TARGET_OUT_DATA)/app
TARGET_OUT_DATA_KEYLAYOUT := $(TARGET_OUT_KEYLAYOUT)
TARGET_OUT_DATA_KEYCHARS := $(TARGET_OUT_KEYCHARS)
TARGET_OUT_DATA_ETC := $(TARGET_OUT_ETC)
TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest
TARGET_OUT_DATA_FAKE := $(TARGET_OUT_DATA)/fake_packages
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_DATA_EXECUTABLES)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_SHARED_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_APPS := $(TARGET_OUT_DATA_APPS)
+
TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache
TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)
-TARGET_OUT_VENDOR_EXECUTABLES:= $(TARGET_OUT_VENDOR)/bin
-TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES:= $(TARGET_OUT_VENDOR)/xbin
-TARGET_OUT_VENDOR_SHARED_LIBRARIES:= $(TARGET_OUT_VENDOR)/lib
-TARGET_OUT_VENDOR_JAVA_LIBRARIES:= $(TARGET_OUT_VENDOR)/framework
-TARGET_OUT_VENDOR_APPS:= $(TARGET_OUT_VENDOR)/app
+TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR)/bin
+TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES := $(TARGET_OUT_VENDOR)/xbin
+ifneq ($(filter %64,$(TARGET_ARCH)),)
+TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(TARGET_OUT_VENDOR)/lib64
+else
+TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(TARGET_OUT_VENDOR)/lib
+endif
+TARGET_OUT_VENDOR_JAVA_LIBRARIES := $(TARGET_OUT_VENDOR)/framework
+TARGET_OUT_VENDOR_APPS := $(TARGET_OUT_VENDOR)/app
TARGET_OUT_VENDOR_ETC := $(TARGET_OUT_VENDOR)/etc
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR_EXECUTABLES)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(TARGET_OUT_VENDOR)/lib
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS := $(TARGET_OUT_VENDOR_APPS)
+
TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols
TARGET_OUT_EXECUTABLES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/bin
TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/lib
diff --git a/core/executable.mk b/core/executable.mk
index 52bf0cb..baa6a74 100644
--- a/core/executable.mk
+++ b/core/executable.mk
@@ -1,76 +1,13 @@
-###########################################################
-## Standard rules for building an executable file.
-##
-## Additional inputs from base_rules.make:
-## None.
-###########################################################
+# We don't automatically set up rules to build executables for both
+# TARGET_ARCH and TARGET_2ND_ARCH.
+# By default, an executable is built for TARGET_ARCH.
+# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_32BIT_ONLY := true".
-ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
-LOCAL_MODULE_CLASS := EXECUTABLES
-endif
-ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
-LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
-endif
-
-$(call target-executable-hook)
-
-skip_build_from_source :=
-ifdef LOCAL_PREBUILT_MODULE_FILE
-ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
-include $(BUILD_PREBUILT)
-skip_build_from_source := true
-endif
-endif
-
-ifndef skip_build_from_source
-####################################################
-## Add profiling libraries if aprof is turned
-####################################################
-ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
- ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE), true)
- LOCAL_STATIC_LIBRARIES += libaprof libaprof_static libc libcutils
- else
- LOCAL_SHARED_LIBRARIES += libaprof libaprof_runtime libc
- endif
- LOCAL_WHOLE_STATIC_LIBRARIES += libaprof_aux
-endif
-
-include $(BUILD_SYSTEM)/dynamic_binary.mk
-
-# Define PRIVATE_ variables from global vars
-my_target_global_ld_dirs := $(TARGET_GLOBAL_LD_DIRS)
-my_target_global_ldflags := $(TARGET_GLOBAL_LDFLAGS)
-my_target_fdo_lib := $(TARGET_FDO_LIB)
-my_target_libgcc := $(TARGET_LIBGCC)
-my_target_crtbegin_dynamic_o := $(TARGET_CRTBEGIN_DYNAMIC_O)
-my_target_crtbegin_static_o := $(TARGET_CRTBEGIN_STATIC_O)
-my_target_crtend_o := $(TARGET_CRTEND_O)
-ifdef LOCAL_SDK_VERSION
-# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
-# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
-my_target_global_ld_dirs := \
- $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
- $(my_ndk_version_root)/usr/lib) \
- $(my_target_global_ld_dirs)
-my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
-my_target_crtbegin_dynamic_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_dynamic.o)
-my_target_crtbegin_static_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_static.o)
-my_target_crtend_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtend_android.o)
-endif
-$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
-$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
-$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
-$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
-$(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
-$(linked_module): PRIVATE_TARGET_CRTBEGIN_STATIC_O := $(my_target_crtbegin_static_o)
-$(linked_module): PRIVATE_TARGET_CRTEND_O := $(my_target_crtend_o)
-
-ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
-$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
- $(transform-o-to-static-executable)
+ifeq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
+LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
else
-$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
- $(transform-o-to-executable)
+LOCAL_2ND_ARCH_VAR_PREFIX :=
endif
-endif # skip_build_from_source
+include $(BUILD_SYSTEM)/executable_internal.mk
+LOCAL_2ND_ARCH_VAR_PREFIX :=
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
new file mode 100644
index 0000000..33a573f
--- /dev/null
+++ b/core/executable_internal.mk
@@ -0,0 +1,69 @@
+###########################################################
+## Standard rules for building an executable file.
+##
+## Additional inputs from base_rules.make:
+## None.
+###########################################################
+
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
+LOCAL_MODULE_CLASS := EXECUTABLES
+endif
+ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
+LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
+endif
+
+$(call target-executable-hook)
+
+skip_build_from_source :=
+ifdef LOCAL_PREBUILT_MODULE_FILE
+ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
+include $(BUILD_PREBUILT)
+skip_build_from_source := true
+endif
+endif
+
+ifndef skip_build_from_source
+
+include $(BUILD_SYSTEM)/dynamic_binary.mk
+
+# Define PRIVATE_ variables from global vars
+my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
+ifeq ($(LOCAL_CLANG),true)
+my_target_global_ldflags := $(CLANG_TARGET_GLOBAL_LDFLAGS)
+else
+my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
+endif
+my_target_fdo_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_LIB)
+my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
+my_target_crtbegin_dynamic_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_DYNAMIC_O)
+my_target_crtbegin_static_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_STATIC_O)
+my_target_crtend_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTEND_O)
+ifdef LOCAL_SDK_VERSION
+# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
+# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
+my_target_global_ld_dirs := \
+ $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
+ $(my_ndk_version_root)/usr/lib) \
+ $(my_target_global_ld_dirs)
+my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
+my_target_crtbegin_dynamic_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_dynamic.o)
+my_target_crtbegin_static_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_static.o)
+my_target_crtend_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtend_android.o)
+endif
+$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
+$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
+$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
+$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
+$(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
+$(linked_module): PRIVATE_TARGET_CRTBEGIN_STATIC_O := $(my_target_crtbegin_static_o)
+$(linked_module): PRIVATE_TARGET_CRTEND_O := $(my_target_crtend_o)
+
+ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
+$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
+ $(transform-o-to-static-executable)
+else
+$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
+ $(transform-o-to-executable)
+endif
+
+endif # skip_build_from_source
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
new file mode 100644
index 0000000..a79d64d
--- /dev/null
+++ b/core/host_dalvik_java_library.mk
@@ -0,0 +1,106 @@
+#
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Rules for building a host dalvik java library. These libraries
+# are meant to be used by a dalvik VM instance running on the host.
+# They will be compiled against libcore and not the host JRE.
+#
+
+USE_CORE_LIB_BOOTCLASSPATH := true
+
+#######################################
+include $(BUILD_SYSTEM)/host_java_library_common.mk
+#######################################
+
+ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+ LOCAL_JAVA_LIBRARIES += core-hostdex
+endif
+
+full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
+full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
+full_classes_jar := $(intermediates.COMMON)/classes.jar
+built_dex := $(intermediates.COMMON)/classes.dex
+
+LOCAL_INTERMEDIATE_TARGETS += \
+ $(full_classes_compiled_jar) \
+ $(full_classes_jarjar_jar) \
+ $(full_classes_jar) \
+ $(built_dex)
+
+# See comment in java.mk
+java_alternative_checked_module := $(full_classes_compiled_jar)
+
+#######################################
+include $(BUILD_SYSTEM)/base_rules.mk
+#######################################
+
+$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
+
+java_alternative_checked_module :=
+
+# The layers file allows you to enforce a layering between java packages.
+# Run build/tools/java-layers.py for more details.
+layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
+
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
+
+$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
+
+$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
+$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
+$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
+$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
+$(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS :=
+$(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \
+ $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ $(transform-host-java-to-package)
+
+# Run jarjar if necessary, otherwise just copy the file.
+ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
+$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
+$(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
+ @echo JarJar: $@
+ $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
+else
+$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
+ @echo Copying: $@
+ $(hide) $(ACP) -fp $< $@
+endif
+
+$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP)
+ @echo Copying: $@
+ $(hide) $(ACP) -fp $< $@
+
+$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
+$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
+$(built_dex): $(full_classes_jar) $(DX)
+ $(transform-classes.jar-to-dex)
+
+$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
+$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
+ @echo "Host Jar: $(PRIVATE_MODULE) ($@)"
+ $(create-empty-package)
+ $(add-dex-to-package)
+ $(add-carried-java-resources)
+ifneq ($(extra_jar_args),)
+ $(add-java-resources-to-package)
+endif
+
+USE_CORE_LIB_BOOTCLASSPATH :=
diff --git a/core/host_dalvik_static_java_library.mk b/core/host_dalvik_static_java_library.mk
new file mode 100644
index 0000000..05c4b16
--- /dev/null
+++ b/core/host_dalvik_static_java_library.mk
@@ -0,0 +1,28 @@
+#
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Rules for building a host dalvik static java library.
+# These libraries will be compiled against libcore and not the host
+# JRE.
+#
+
+USE_CORE_LIB_BOOTCLASSPATH := true
+LOCAL_JAVA_LIBRARIES += core-hostdex
+
+include $(BUILD_SYSTEM)/host_java_library.mk
+
+USE_CORE_LIB_BOOTCLASSPATH :=
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index 391050c..e5ebb11 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -18,55 +18,8 @@
# Standard rules for building a host java library.
#
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
-LOCAL_IS_HOST_MODULE := true
-LOCAL_BUILT_MODULE_STEM := javalib.jar
-
-# base_rules.mk looks at this
-all_res_assets :=
-
-proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
-ifneq ($(proto_sources),)
-ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
- LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-2.3.0-micro
-else
- ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
- LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-2.3.0-nano
- else
- LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-2.3.0-lite
- endif
-endif
-endif
-
-intermediates := $(call local-intermediates-dir)
-intermediates.COMMON := $(call local-intermediates-dir,COMMON)
-
-LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
-
-ifeq ($(LOCAL_BUILD_HOST_DEX),true)
-ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
- LOCAL_JAVA_LIBRARIES += core-hostdex
-endif
-
-full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
-full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
-full_classes_jar := $(intermediates.COMMON)/classes.jar
-built_dex := $(intermediates.COMMON)/classes.dex
-
-LOCAL_INTERMEDIATE_TARGETS += \
- $(full_classes_compiled_jar) \
- $(full_classes_jarjar_jar) \
- $(full_classes_jar) \
- $(built_dex)
-
-# See comment in java.mk
-java_alternative_checked_module := $(full_classes_compiled_jar)
-endif # LOCAL_BUILD_HOST_DEX
-
-LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
-
#######################################
+include $(BUILD_SYSTEM)/host_java_library_common.mk
include $(BUILD_SYSTEM)/base_rules.mk
#######################################
@@ -78,57 +31,10 @@
# Run build/tools/java-layers.py for more details.
layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
-ifeq ($(LOCAL_BUILD_HOST_DEX),true)
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
-
-$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
-
-$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
-$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
-$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
-$(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \
- $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES)
- $(transform-host-java-to-package)
-
-# Run jarjar if necessary, otherwise just copy the file.
-ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
-$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
-$(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
- @echo JarJar: $@
- $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
-else
-$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
- @echo Copying: $@
- $(hide) $(ACP) -fp $< $@
-endif
-
-$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP)
- @echo Copying: $@
- $(hide) $(ACP) -fp $< $@
-
-$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
-$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(built_dex): $(full_classes_jar) $(DX)
- $(transform-classes.jar-to-dex)
-
-$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
-$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
- @echo "Host Jar: $(PRIVATE_MODULE) ($@)"
- $(create-empty-package)
- $(add-dex-to-package)
- $(add-carried-java-resources)
-ifneq ($(extra_jar_args),)
- $(add-java-resources-to-package)
-endif
-
-else
+$(LOCAL_BUILT_MODULE): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
$(LOCAL_BUILT_MODULE): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
$(LOCAL_BUILT_MODULE): PRIVATE_JAR_EXCLUDE_FILES :=
$(LOCAL_BUILT_MODULE): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
$(LOCAL_BUILT_MODULE): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \
$(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-host-java-to-package)
-endif # LOCAL_BUILD_HOST_DEX
diff --git a/core/host_java_library_common.mk b/core/host_java_library_common.mk
new file mode 100644
index 0000000..973afa0
--- /dev/null
+++ b/core/host_java_library_common.mk
@@ -0,0 +1,47 @@
+#
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# Common rules for building a host java library.
+#
+
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
+LOCAL_IS_HOST_MODULE := true
+LOCAL_BUILT_MODULE_STEM := javalib.jar
+
+# base_rules.mk looks at this
+all_res_assets :=
+
+proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
+ifneq ($(proto_sources),)
+ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
+ LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-2.3.0-micro
+else
+ ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
+ LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-2.3.0-nano
+ else
+ LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-2.3.0-lite
+ endif
+endif
+endif
+
+intermediates := $(call local-intermediates-dir)
+intermediates.COMMON := $(call local-intermediates-dir,COMMON)
+
+LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
+LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
+
diff --git a/core/host_native_test.mk b/core/host_native_test.mk
index a5d87e4..a631364 100644
--- a/core/host_native_test.mk
+++ b/core/host_native_test.mk
@@ -10,4 +10,6 @@
LOCAL_STATIC_LIBRARIES += libgtest_host libgtest_main_host
LOCAL_SHARED_LIBRARIES +=
+LOCAL_LDFLAGS += -lpthread
+
include $(BUILD_HOST_EXECUTABLE)
diff --git a/core/java.mk b/core/java.mk
index 4f44770..8863ac2 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -195,7 +195,7 @@
# We don't need the .so files in bundled branches
# Prevent these from showing up on the device
-ifneq (,$(TARGET_BUILD_APPS))
+ifneq (,$(TARGET_BUILD_APPS)$(FORCE_BUILD_RS_COMPAT))
rs_compatibility_jni_libs := $(addprefix \
$(renderscript_intermediate)/librs., \
@@ -252,6 +252,11 @@
java_alternative_checked_module :=
+#######################################
+# defines built_odex along with rule to install odex
+include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
+#######################################
+
# Make sure there's something to build.
ifdef full_classes_jar
ifndef need_compile_java
diff --git a/core/java_library.mk b/core/java_library.mk
index 4c6b652..343b27e 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -34,21 +34,6 @@
LOCAL_PROGUARD_ENABLED :=
endif
-ifneq (true,$(WITH_DEXPREOPT))
-LOCAL_DEX_PREOPT :=
-else
-ifeq (,$(TARGET_BUILD_APPS))
-ifeq (,$(LOCAL_APK_LIBRARIES))
-ifndef LOCAL_DEX_PREOPT
-LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
-endif
-endif
-endif
-endif
-ifeq (false,$(LOCAL_DEX_PREOPT))
-LOCAL_DEX_PREOPT :=
-endif
-
ifeq (true,$(EMMA_INSTRUMENT))
ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
ifeq (true,$(EMMA_INSTRUMENT_STATIC))
@@ -93,28 +78,30 @@
endif
ifdef LOCAL_DEX_PREOPT
-dexpreopt_boot_jar_module := $(filter $(LOCAL_MODULE),$(DEXPREOPT_BOOT_JARS_MODULES))
-ifneq ($(dexpreopt_boot_jar_module),)
+ifneq ($(dexpreopt_boot_jar_module),) # boot jar
# boot jar's rules are defined in dex_preopt.mk
dexpreopted_boot_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module)_nodex.jar
$(LOCAL_BUILT_MODULE) : $(dexpreopted_boot_jar) | $(ACP)
$(call copy-file-to-target)
+# For libart boot jars, we don't have .odex files.
+ifeq ($(DALVIK_VM_LIB),libdvm.so)
dexpreopted_boot_odex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(dexpreopt_boot_jar_module).odex
-built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
$(built_odex) : $(dexpreopted_boot_odex) | $(ACP)
$(call copy-file-to-target)
+endif
-else # dexpreopt_boot_jar_module
-built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
+else # ! boot jar
$(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE)
+$(built_odex): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
+$(built_odex): PRIVATE_DEX_PREOPT_IMAGE := $(LOCAL_DEX_PREOPT_IMAGE)
# Make sure the boot jars get dex-preopt-ed first
-$(built_odex) : $(DEXPREOPT_BOOT_ODEXS)
-$(built_odex) : $(common_javalib.jar) | $(DEXPREOPT) $(DEXOPT)
+$(built_odex) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT)
+$(built_odex) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS)
+$(built_odex) : $(LOCAL_DEX_PREOPT_IMAGE)
+$(built_odex) : $(common_javalib.jar)
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
- $(hide) rm -f $@
- @mkdir -p $(dir $@)
- $(call dexpreopt-one-file,$<,$@)
+ $(call dexpreopt-one-file,$(PRIVATE_DEX_PREOPT_IMAGE),$<,$(PRIVATE_DEX_LOCATION),$@)
$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP)
$(call copy-file-to-target)
@@ -122,7 +109,7 @@
$(call dexpreopt-remove-classes.dex,$@)
endif
-endif # dexpreopt_boot_jar_module
+endif # ! boot jar
else # LOCAL_DEX_PREOPT
$(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP)
diff --git a/core/llvm_config.mk b/core/llvm_config.mk
index 18e689e..33b1d06 100644
--- a/core/llvm_config.mk
+++ b/core/llvm_config.mk
@@ -3,107 +3,136 @@
LLVM_AS := $(HOST_OUT_EXECUTABLES)/llvm-as$(HOST_EXECUTABLE_SUFFIX)
LLVM_LINK := $(HOST_OUT_EXECUTABLES)/llvm-link$(HOST_EXECUTABLE_SUFFIX)
-define do-clang-flags-subst
- TARGET_GLOBAL_CLANG_FLAGS := $(subst $(1),$(2),$(TARGET_GLOBAL_CLANG_FLAGS))
- HOST_GLOBAL_CLANG_FLAGS := $(subst $(1),$(2),$(HOST_GLOBAL_CLANG_FLAGS))
-endef
-
-define clang-flags-subst
- $(eval $(call do-clang-flags-subst,$(1),$(2)))
-endef
-
+# Clang flags for all host or target rules
+CLANG_CONFIG_EXTRA_ASFLAGS :=
+CLANG_CONFIG_EXTRA_CPPFLAGS :=
+CLANG_CONFIG_EXTRA_LDFLAGS :=
CLANG_CONFIG_EXTRA_CFLAGS := \
- -D__compiler_offsetof=__builtin_offsetof \
+ -D__compiler_offsetof=__builtin_offsetof
CLANG_CONFIG_UNKNOWN_CFLAGS := \
- -funswitch-loops
+ -funswitch-loops \
+ -Wno-psabi \
+ -Wno-unused-but-set-variable \
+ -Wno-unused-but-set-parameter
-ifeq ($(TARGET_ARCH),arm)
- RS_TRIPLE := armv7-none-linux-gnueabi
- CLANG_CONFIG_EXTRA_ASFLAGS += \
- -target arm-linux-androideabi \
- -nostdlibinc \
- -B$(TARGET_TOOLCHAIN_ROOT)/arm-linux-androideabi/bin
- CLANG_CONFIG_EXTRA_CFLAGS += \
- $(CLANG_CONFIG_EXTRA_ASFLAGS) \
- -mllvm -arm-enable-ehabi
- CLANG_CONFIG_EXTRA_LDFLAGS += \
- -target arm-linux-androideabi \
- -B$(TARGET_TOOLCHAIN_ROOT)/arm-linux-androideabi/bin
- CLANG_CONFIG_UNKNOWN_CFLAGS += \
- -mthumb-interwork \
- -fgcse-after-reload \
- -frerun-cse-after-loop \
- -frename-registers \
- -fno-builtin-sin \
- -fno-strict-volatile-bitfields \
- -fno-align-jumps \
- -Wa,--noexecstack
+# Clang flags for all host rules
+CLANG_CONFIG_HOST_EXTRA_ASFLAGS :=
+CLANG_CONFIG_HOST_EXTRA_CFLAGS :=
+CLANG_CONFIG_HOST_EXTRA_CPPFLAGS :=
+CLANG_CONFIG_HOST_EXTRA_LDFLAGS :=
+
+# Clang flags for all target rules
+CLANG_CONFIG_TARGET_EXTRA_ASFLAGS :=
+CLANG_CONFIG_TARGET_EXTRA_CFLAGS := -nostdlibinc
+CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS := -nostdlibinc
+CLANG_CONFIG_TARGET_EXTRA_LDFLAGS :=
+
+# ARM
+llvm_arch := arm
+CLANG_CONFIG_arm_EXTRA_ASFLAGS :=
+CLANG_CONFIG_arm_EXTRA_CFLAGS := \
+ -mllvm -arm-enable-ehabi
+CLANG_CONFIG_arm_EXTRA_LDFLAGS :=
+CLANG_CONFIG_arm_UNKNOWN_CFLAGS := \
+ -mthumb-interwork \
+ -fgcse-after-reload \
+ -frerun-cse-after-loop \
+ -frename-registers \
+ -fno-builtin-sin \
+ -fno-strict-volatile-bitfields \
+ -fno-align-jumps \
+ -Wa,--noexecstack
+
+CLANG_CONFIG_arm_HOST_TRIPLE :=
+CLANG_CONFIG_arm_TARGET_TRIPLE := arm-linux-androideabi
+
+include $(BUILD_SYSTEM)/llvm_config_define_clang_flags.mk
+
+# MIPS
+llvm_arch := mips
+CLANG_CONFIG_mips_EXTRA_ASFLAGS :=
+CLANG_CONFIG_mips_EXTRA_CFLAGS :=
+CLANG_CONFIG_mips_EXTRA_LDFLAGS :=
+CLANG_CONFIG_mips_UNKNOWN_CFLAGS := \
+ -EL \
+ -mips32 \
+ -mips32r2 \
+ -mhard-float \
+ -fno-strict-volatile-bitfields \
+ -fgcse-after-reload \
+ -frerun-cse-after-loop \
+ -frename-registers \
+ -march=mips32r2 \
+ -mtune=mips32r2 \
+ -march=mips32 \
+ -mtune=mips32 \
+ -msynci \
+ -mno-fused-madd
+
+CLANG_CONFIG_mips_HOST_TRIPLE :=
+CLANG_CONFIG_mips_TARGET_TRIPLE := mipsel-linux-android
+
+include $(BUILD_SYSTEM)/llvm_config_define_clang_flags.mk
+
+# X86
+llvm_arch := x86
+CLANG_CONFIG_x86_EXTRA_ASFLAGS := \
+ -msse3
+CLANG_CONFIG_x86_EXTRA_CFLAGS :=
+CLANG_CONFIG_x86_EXTRA_LDFLAGS :=
+CLANG_CONFIG_x86_UNKNOWN_CFLAGS := \
+ -finline-limit=300 \
+ -fno-inline-functions-called-once \
+ -mfpmath=sse \
+ -mbionic
+
+ifeq ($(HOST_OS),linux)
+CLANG_CONFIG_x86_HOST_TRIPLE := i686-linux-gnu
endif
-ifeq ($(TARGET_ARCH),mips)
- RS_TRIPLE := mipsel-unknown-linux
- CLANG_CONFIG_EXTRA_ASFLAGS += \
- -target mipsel-linux-androideabi \
- -nostdlibinc \
- -B$(TARGET_TOOLCHAIN_ROOT)/mipsel-linux-android/bin
- CLANG_CONFIG_EXTRA_CFLAGS += $(CLANG_CONFIG_EXTRA_ASFLAGS)
- CLANG_CONFIG_EXTRA_LDFLAGS += \
- -target mipsel-linux-androideabi \
- -B$(TARGET_TOOLCHAIN_ROOT)/mipsel-linux-android/bin
- CLANG_CONFIG_UNKNOWN_CFLAGS += \
- -EL \
- -mips32 \
- -mips32r2 \
- -mhard-float \
- -fno-strict-volatile-bitfields \
- -fgcse-after-reload \
- -frerun-cse-after-loop \
- -frename-registers \
- -march=mips32r2 \
- -mtune=mips32r2 \
- -march=mips32 \
- -mtune=mips32 \
- -msynci \
- -mno-fused-madd
+ifeq ($(HOST_OS),darwin)
+CLANG_CONFIG_x86_HOST_TRIPLE := i686-apple-darwin
endif
-ifeq ($(TARGET_ARCH),x86)
- RS_TRIPLE := i686-unknown-linux
- CLANG_CONFIG_EXTRA_ASFLAGS += \
- -target i686-linux-android \
- -nostdlibinc \
- -B$(TARGET_TOOLCHAIN_ROOT)/i686-linux-android/bin
- CLANG_CONFIG_EXTRA_CFLAGS += $(CLANG_CONFIG_EXTRA_ASFLAGS)
- CLANG_CONFIG_EXTRA_LDFLAGS += \
- -target i686-linux-android \
- -B$(TARGET_TOOLCHAIN_ROOT)/i686-linux-android/bin
- CLANG_CONFIG_UNKNOWN_CFLAGS += \
- -finline-limit=300 \
- -fno-inline-functions-called-once \
- -mfpmath=sse \
- -mbionic
+ifeq ($(HOST_OS),windows)
+CLANG_CONFIG_x86_HOST_TRIPLE := i686-pc-mingw32
endif
+CLANG_CONFIG_x86_TARGET_TRIPLE := i686-linux-android
+CLANG_CONFIG_x86_TARGET_TOOLCHAIN_PREFIX := \
+ $(TARGET_TOOLCHAIN_ROOT)/x86_64-linux-android/bin
+
+include $(BUILD_SYSTEM)/llvm_config_define_clang_flags.mk
+
+# X86_64
+llvm_arch := x86_64
+CLANG_CONFIG_x86_64_EXTRA_ASFLAGS :=
+CLANG_CONFIG_x86_64_EXTRA_CFLAGS :=
+CLANG_CONFIG_x86_64_EXTRA_LDFLAGS :=
+CLANG_CONFIG_x86_64_UNKNOWN_CFLAGS := \
+ -finline-limit=300 \
+ -fno-inline-functions-called-once \
+ -mfpmath=sse \
+ -mbionic
+
+ifeq ($(HOST_OS),linux)
+CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-linux-gnu
+endif
+ifeq ($(HOST_OS),darwin)
+CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-apple-darwin
+endif
+ifeq ($(HOST_OS),windows)
+CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-pc-mingw64
+endif
+CLANG_CONFIG_x86_64_TARGET_TRIPLE := x86_64-linux-android
+
+include $(BUILD_SYSTEM)/llvm_config_define_clang_flags.mk
+
+# Clang compiler-specific libc headers
+CLANG_CONFIG_EXTRA_HOST_C_INCLUDES := external/clang/lib/include
CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES := external/clang/lib/include $(TARGET_OUT_HEADERS)/clang
-# remove unknown flags to define CLANG_FLAGS
-TARGET_GLOBAL_CLANG_FLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(TARGET_GLOBAL_CFLAGS))
-HOST_GLOBAL_CLANG_FLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(HOST_GLOBAL_CFLAGS))
-
-TARGET_arm_CLANG_CFLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(TARGET_arm_CFLAGS))
-TARGET_thumb_CLANG_CFLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(TARGET_thumb_CFLAGS))
-
-# llvm does not yet support -march=armv5e nor -march=armv5te, fall back to armv5 or armv5t
-$(call clang-flags-subst,-march=armv5te,-march=armv5t)
-$(call clang-flags-subst,-march=armv5e,-march=armv5)
-
-# clang does not support -Wno-psabi and -Wno-unused-but-set-variable
-$(call clang-flags-subst,-Wno-psabi,)
-$(call clang-flags-subst,-Wno-unused-but-set-variable,)
-
-# clang does not support -mcpu=cortex-a15 yet - fall back to armv7-a for now
-$(call clang-flags-subst,-mcpu=cortex-a15,-march=armv7-a)
-
+# Address sanitizer clang config
ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fsanitize=address
ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit
ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl libasan_preload
@@ -112,3 +141,56 @@
# This allows us to use the superset of functionality that compiler-rt
# provides to Clang (for supporting features like -ftrapv).
COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler_rt-extras
+
+# Macros to convert gcc flags to clang flags
+define subst-clang-incompatible-flags
+ $(subst -march=armv5te,-march=armv5t,\
+ $(subst -march=armv5e,-march=armv5,\
+ $(subst -mcpu=cortex-a15,-march=armv7-a,\
+ $(1))))
+endef
+
+define convert-to-host-clang-flags
+ $(strip \
+ $(call subst-clang-incompatible-flags,\
+ $(filter-out $(CLANG_CONFIG_$(HOST_ARCH)_UNKNOWN_CFLAGS),\
+ $(1))))
+endef
+
+define convert-to-clang-flags
+ $(strip \
+ $(call subst-clang-incompatible-flags,\
+ $(filter-out $(CLANG_CONFIG_$(TARGET_ARCH)_UNKNOWN_CFLAGS),\
+ $(1))))
+endef
+
+# Define clang global flags
+define get-clang-host-global-flags
+ $(call convert-to-host-clang-flags,$(HOST_GLOBAL_$(1))) $(CLANG_CONFIG_$(HOST_ARCH)_HOST_EXTRA_$(1))
+endef
+
+define get-clang-global-flags
+ $(call convert-to-clang-flags,$(TARGET_GLOBAL_$(1))) $(CLANG_CONFIG_$(TARGET_ARCH)_TARGET_EXTRA_$(1))
+endef
+
+CLANG_HOST_GLOBAL_CFLAGS := $(call get-clang-host-global-flags,CFLAGS)
+CLANG_HOST_GLOBAL_CPPFLAGS := $(call get-clang-host-global-flags,CPPFLAGS)
+CLANG_HOST_GLOBAL_LDFLAGS := $(call get-clang-host-global-flags,LDFLAGS)
+
+CLANG_TARGET_GLOBAL_CFLAGS := $(call get-clang-global-flags,CFLAGS)
+CLANG_TARGET_GLOBAL_CPPFLAGS := $(call get-clang-global-flags,CPPFLAGS)
+CLANG_TARGET_GLOBAL_LDFLAGS := $(call get-clang-global-flags,LDFLAGS)
+
+# Renderscript clang target triple
+ifeq ($(TARGET_ARCH),arm)
+ RS_TRIPLE := armv7-none-linux-gnueabi
+endif
+ifeq ($(TARGET_ARCH),mips)
+ RS_TRIPLE := mipsel-unknown-linux
+endif
+ifeq ($(TARGET_ARCH),x86)
+ RS_TRIPLE := i686-unknown-linux
+endif
+ifeq ($(TARGET_ARCH),x86_64)
+ RS_TRIPLE := x86_64-unknown-linux
+endif
diff --git a/core/llvm_config_define_clang_flags.mk b/core/llvm_config_define_clang_flags.mk
new file mode 100644
index 0000000..b7b57e2
--- /dev/null
+++ b/core/llvm_config_define_clang_flags.mk
@@ -0,0 +1,76 @@
+ifeq ($(strip $(llvm_arch)),)
+ $(error "$$(llvm_arch) should be defined.")
+endif
+
+ifeq ($(strip $(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE)),)
+ $(error "$$(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE) should be defined.")
+endif
+
+ifeq ($(strip $(CLANG_CONFIG_$(llvm_arch)_TARGET_TOOLCHAIN_PREFIX)),)
+CLANG_CONFIG_$(llvm_arch)_TARGET_TOOLCHAIN_PREFIX := \
+ $(TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE)/bin
+endif
+
+# Include common unknown flags
+CLANG_CONFIG_$(llvm_arch)_UNKNOWN_CFLAGS += \
+ $(CLANG_CONFIG_UNKNOWN_CFLAGS)
+
+# Clang extra flags for host
+CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_ASFLAGS := \
+ $(CLANG_CONFIG_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_HOST_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_$(llvm_arch)_EXTRA_ASFLAGS)
+
+ifneq ($(strip $(CLANG_CONFIG_$(llvm_arch)_HOST_TRIPLE)),)
+CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_ASFLAGS += \
+ -target $(CLANG_CONFIG_$(llvm_arch)_HOST_TRIPLE)
+endif
+
+CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_CFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_HOST_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_$(llvm_arch)_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_ASFLAGS)
+
+CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_CPPFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_HOST_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_$(llvm_arch)_EXTRA_CPPFLAGS)
+
+CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_LDFLAGS := \
+ $(CLANG_CONFIG_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_HOST_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_$(llvm_arch)_EXTRA_LDFLAGS)
+
+ifneq ($(strip $(CLANG_CONFIG_$(llvm_arch)_HOST_TRIPLE)),)
+CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_LDFLAGS += \
+ -target $(CLANG_CONFIG_$(llvm_arch)_HOST_TRIPLE)
+endif
+
+# Clang extra flags for target
+CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_ASFLAGS := \
+ $(CLANG_CONFIG_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_$(llvm_arch)_EXTRA_ASFLAGS) \
+ -target $(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_$(llvm_arch)_TARGET_TOOLCHAIN_PREFIX)
+
+CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_CFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_$(llvm_arch)_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_ASFLAGS)
+
+CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_CPPFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_$(llvm_arch)_EXTRA_CPPFLAGS)
+
+CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_LDFLAGS := \
+ $(CLANG_CONFIG_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_$(llvm_arch)_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_$(llvm_arch)_TARGET_TOOLCHAIN_PREFIX)
+
+llvm_arch :=
diff --git a/core/main.mk b/core/main.mk
index d424b25..e2b93c2 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -40,17 +40,15 @@
# Check for broken versions of make.
# (Allow any version under Cygwin since we don't actually build the platform there.)
ifeq (,$(findstring CYGWIN,$(shell uname -sm)))
-ifeq (0,$(shell expr $$(echo $(MAKE_VERSION) | sed "s/[^0-9\.].*//") = 3.81))
-ifeq (0,$(shell expr $$(echo $(MAKE_VERSION) | sed "s/[^0-9\.].*//") = 3.82))
+ifneq (1,$(strip $(shell expr $(MAKE_VERSION) \>= 3.81)))
$(warning ********************************************************************************)
$(warning * You are using version $(MAKE_VERSION) of make.)
-$(warning * Android can only be built by versions 3.81 and 3.82.)
+$(warning * Android can only be built by versions 3.81 and higher.)
$(warning * see https://source.android.com/source/download.html)
$(warning ********************************************************************************)
$(error stopping)
endif
endif
-endif
# Absolute path of the present working direcotry.
# This overrides the shell variable $PWD, which does not necessarily points to
@@ -140,7 +138,30 @@
$(error Directory names containing spaces not supported)
endif
-# Check for the corrent jdk
+# Check for the current JDK.
+#
+# For Java 1.7, we require OpenJDK on linux and Oracle JDK on Mac OS.
+# For Java 1.6, we require Oracle for all host OSes.
+requires_openjdk := false
+ifneq ($(EXPERIMENTAL_USE_JAVA7),)
+ifeq ($(HOST_OS), linux)
+requires_openjdk := true
+endif
+endif
+
+ifeq ($(requires_openjdk), true)
+ifeq ($(shell java -version 2>&1 | grep -i openjdk),)
+$(info ************************************************************)
+$(info You are attempting to build with an unsupported JDK.)
+$(info $(space))
+$(info This build requires OpenJDK, but you are using:)
+$(info $(shell java -version 2>&1 | head -n 2).)
+$(info Please follow the machine setup instructions at)
+$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
+$(info ************************************************************)
+$(error stop)
+endif # java version is not OpenJdk
+else # if requires_openjdk
ifneq ($(shell java -version 2>&1 | grep -i openjdk),)
$(info ************************************************************)
$(info You are attempting to build with an unsupported JDK.)
@@ -150,17 +171,28 @@
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
$(info ************************************************************)
$(error stop)
-endif
+endif # java version is not Sun Oracle JDK
+endif # if requires_openjdk
-# Check for the correct version of java
+# Check for the correct version of java, should be 1.7 if
+# EXPERIMENTAL_USE_JAVA7 is set, 1.6 otherwise.
+ifneq ($(EXPERIMENTAL_USE_JAVA7),)
+required_version := "1.7.x"
+java_version := $(shell java -version 2>&1 | head -n 1 | grep '^java .*[ "]1\.7[\. "$$]')
+javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.7[\. "$$]')
+else # if EXPERIMENTAL_USE_JAVA7
+required_version := "1.6.x"
java_version := $(shell java -version 2>&1 | head -n 1 | grep '^java .*[ "]1\.6[\. "$$]')
+javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
+endif # if EXPERIMENTAL_USE_JAVA7
+
ifeq ($(strip $(java_version)),)
$(info ************************************************************)
$(info You are attempting to build with the incorrect version)
$(info of java.)
$(info $(space))
$(info Your version is: $(shell java -version 2>&1 | head -n 1).)
-$(info The correct version is: Java SE 1.6.)
+$(info The required version is: $(required_version))
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
@@ -169,14 +201,13 @@
endif
# Check for the correct version of javac
-javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
ifeq ($(strip $(javac_version)),)
$(info ************************************************************)
$(info You are attempting to build with the incorrect version)
$(info of javac.)
$(info $(space))
$(info Your version is: $(shell javac -version 2>&1 | head -n 1).)
-$(info The correct version is: 1.6.)
+$(info The required version is: $(required_java_version))
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
@@ -572,6 +603,14 @@
$(eval r := $(filter $(HOST_OUT_ROOT)/%,$(call module-installed-files,\
$(subst $(comma),$(space),$(lastword $(p)))))) \
$(eval $(call add-required-deps,$(word 2,$(p)),$(r))))
+ifdef TARGET_2ND_ARCH
+$(foreach m,$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES), \
+ $(eval p := $(subst :,$(space),$(m))) \
+ $(eval r := $(filter $(TARGET_OUT_ROOT)/%,$(call module-installed-files,\
+ $(addsuffix $(TARGET_2ND_ARCH_MODULE_SUFFIX), \
+ $(subst $(comma),$(space),$(lastword $(p))))))) \
+ $(eval $(call add-required-deps,$(word 2,$(p)),$(r))))
+endif
m :=
r :=
@@ -622,12 +661,10 @@
# TODO: Remove the 3 places in the tree that use ALL_DEFAULT_INSTALLED_MODULES
# and get rid of it from this list.
-# TODO: The shell is chosen by magic. Do we still need this?
modules_to_install := $(sort \
$(ALL_DEFAULT_INSTALLED_MODULES) \
$(product_FILES) \
$(foreach tag,$(tags_to_install),$($(tag)_MODULES)) \
- $(call get-tagged-modules, shell_$(TARGET_SHELL)) \
$(CUSTOM_MODULES) \
)
diff --git a/core/notice_files.mk b/core/notice_files.mk
index 5af0113..e63cd84 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -35,7 +35,7 @@
# We can't use xxx_OUT_STATIC_LIBRARIES because it points into
# device-obj or host-obj.
module_installed_filename := \
- $(patsubst $(PRODUCT_OUT)%,%,$($(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE))
+ $(patsubst $(PRODUCT_OUT)%,%,$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE))
else
ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
# Stick the static java libraries with the regular java libraries.
diff --git a/core/package.mk b/core/package.mk
index 551028c..53192b4 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -25,6 +25,11 @@
## be set for you.
###########################################################
+ifeq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
+LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
+else
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+endif
# If this makefile is being read from within an inheritance,
# use the new values.
@@ -146,23 +151,6 @@
endif # !custom
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
-ifneq (true,$(WITH_DEXPREOPT))
-LOCAL_DEX_PREOPT :=
-else
-ifeq (,$(TARGET_BUILD_APPS))
-ifeq (,$(LOCAL_APK_LIBRARIES))
-ifneq (,$(LOCAL_SRC_FILES))
-ifndef LOCAL_DEX_PREOPT
-LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
-endif
-endif
-endif
-endif
-endif
-ifeq (false,$(LOCAL_DEX_PREOPT))
-LOCAL_DEX_PREOPT :=
-endif
-
ifeq (true,$(EMMA_INSTRUMENT))
ifndef LOCAL_EMMA_INSTRUMENT
# No emma for test apks.
@@ -323,7 +311,7 @@
so_suffix := $($(my_prefix)SHLIB_SUFFIX)
jni_shared_libraries := \
- $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
+ $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
$(addsuffix $(so_suffix), \
$(LOCAL_JNI_SHARED_LIBRARIES)))
@@ -342,7 +330,7 @@
LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME))
endif
jni_shared_libraries += \
- $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_shared.so
+ $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources/cxx-stl/stlport/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libstlport_shared.so
endif
# Set the abi directory used by the local JNI shared libraries.
@@ -350,7 +338,7 @@
# sets where they are stored in the apk.)
ifeq ($(LOCAL_JNI_SHARED_LIBRARIES_ABI),)
- jni_shared_libraries_abi := $(TARGET_CPU_ABI)
+ jni_shared_libraries_abi := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)
else
jni_shared_libraries_abi := $(LOCAL_JNI_SHARED_LIBRARIES_ABI)
endif
@@ -391,8 +379,16 @@
# Define the rule to build the actual package.
$(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
ifdef LOCAL_DEX_PREOPT
+$(LOCAL_BUILT_MODULE): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
+$(LOCAL_BUILT_MODULE): PRIVATE_BUILT_ODEX := $(built_odex)
+$(LOCAL_BUILT_MODULE): PRIVATE_DEX_PREOPT_IMAGE := $(LOCAL_DEX_PREOPT_IMAGE)
# Make sure the boot jars get dexpreopt-ed first
-$(LOCAL_BUILT_MODULE): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT)
+$(LOCAL_BUILT_MODULE) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT)
+$(LOCAL_BUILT_MODULE) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS)
+$(LOCAL_BUILT_MODULE) : $(LOCAL_DEX_PREOPT_IMAGE)
+
+# built_odex is byproduct of LOCAL_BUILT_MODULE without its own build recipe.
+$(built_odex) : $(LOCAL_BUILT_MODULE)
endif
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries)
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abi)
@@ -423,8 +419,7 @@
endif
$(sign-package)
ifdef LOCAL_DEX_PREOPT
- $(hide) rm -f $(patsubst %.apk,%.odex,$@)
- $(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
+ $(call dexpreopt-one-file,$(PRIVATE_DEX_PREOPT_IMAGE),$@,$(PRIVATE_DEX_LOCATION),$(PRIVATE_BUILT_ODEX))
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
$(call dexpreopt-remove-classes.dex,$@)
endif
@@ -432,11 +427,6 @@
@# Alignment must happen after all other zip operations.
$(align-package)
-ifdef LOCAL_DEX_PREOPT
-built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
-$(built_odex): $(LOCAL_BUILT_MODULE)
-endif
-
# Save information about this package
PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources)
@@ -483,3 +473,5 @@
# Reset internal variables.
all_res_assets :=
+
+LOCAL_2ND_ARCH_VAR_PREFIX :=
diff --git a/core/pathmap.mk b/core/pathmap.mk
index 5dfc543..feecfbf 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -42,7 +42,6 @@
libpagemap:system/extras/libpagemap/include \
libril:hardware/ril/include \
libstdc++:bionic/libstdc++/include \
- libthread_db:bionic/libthread_db/include \
mkbootimg:system/core/mkbootimg \
opengl-tests-includes:frameworks/native/opengl/tests/include \
recovery:bootable/recovery \
diff --git a/core/prebuilt.mk b/core/prebuilt.mk
index 3e73c8d..d5fa4ba 100644
--- a/core/prebuilt.mk
+++ b/core/prebuilt.mk
@@ -16,6 +16,15 @@
$(error dont use LOCAL_PREBUILT_JAVA_LIBRARIES anymore LOCAL_PATH=$(LOCAL_PATH))
endif
+ifneq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
+# Build for TARGET_ARCH
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+else
+# Build for TARGET_2ND_ARCH
+LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
+endif
+
+
# Not much sense to check build prebuilts
LOCAL_DONT_CHECK_MODULE := true
@@ -33,7 +42,7 @@
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 := $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
+ OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
endif
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
@@ -145,18 +154,37 @@
endif
ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
-ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
-# Ensure that presigned .apks have been aligned.
-$(built_module) : $(my_prebuilt_src_file) | $(ZIPALIGN)
- $(transform-prebuilt-to-target-with-zipalign)
-else
+
+# Disable dex-preopt of prebuilts to save space
+LOCAL_DEX_PREOPT := false
+
+#######################################
+# defines built_odex along with rule to install odex
+include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
+#######################################
+ifdef LOCAL_DEX_PREOPT
+$(built_module): PRIVATE_DEX_PREOPT_IMAGE := $(LOCAL_DEX_PREOPT_IMAGE)
+$(built_module): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
+$(built_module): PRIVATE_BUILT_ODEX := $(built_odex)
+# Make sure the boot jars get dexpreopt-ed first
+$(built_module) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT)
+$(built_module) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS)
+(built_module) : $(LOCAL_DEX_PREOPT_IMAGE)
+# built_odex is byproduct of LOCAL_BUILT_MODULE without its own build recipe.
+$(built_odex) : $(LOCAL_BUILT_MODULE)
+endif # LOCAL_DEX_PREOPT
# Sign and align non-presigned .apks.
$(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR)
$(transform-prebuilt-to-target)
+ifneq ($(LOCAL_CERTIFICATE),PRESIGNED)
$(sign-package)
- $(align-package)
endif
-else
+ifdef LOCAL_DEX_PREOPT
+ $(call dexpreopt-one-file,$(PRIVATE_DEX_PREOPT_IMAGE),$@,$(PRIVATE_DEX_LOCATION),$(PRIVATE_BUILT_ODEX))
+endif
+ $(align-package)
+
+else # LOCAL_MODULE_CLASS != APPS
ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
$(built_module) : $(my_prebuilt_src_file)
$(transform-prebuilt-to-target-strip-comments)
@@ -171,7 +199,7 @@
endif
endif
endif
-endif
+endif # LOCAL_MODULE_CLASS != APPS
ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
@@ -190,3 +218,9 @@
# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
$(built_module) : $(common_javalib_jar)
endif # TARGET JAVA_LIBRARIES
+
+$(built_module) : $(LOCAL_ADDITIONAL_DEPENDENCIES)
+
+my_prebuilt_src_file :=
+
+LOCAL_2ND_ARCH_VAR_PREFIX :=
diff --git a/core/product.mk b/core/product.mk
index a2f4abc..cf6fb9a 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -97,8 +97,8 @@
PRODUCT_FACTORY_RAMDISK_MODULES \
PRODUCT_FACTORY_BUNDLE_MODULES \
PRODUCT_RUNTIMES \
- PRODUCT_BOOT_JARS
-
+ PRODUCT_BOOT_JARS \
+ PRODUCT_DEX_PREOPT_IMAGE_IN_DATA \
define dump-product
$(info ==== $(1) ====)\
@@ -255,7 +255,7 @@
DEFAULT_SYSTEM_DEV_CERTIFICATE
#
-# Stash vaues of the variables in _product_stash_var_list.
+# Stash values of the variables in _product_stash_var_list.
# $(1): Renamed prefix
#
define stash-product-vars
diff --git a/core/product_config.mk b/core/product_config.mk
index e4b68cf..7a27426 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -266,10 +266,21 @@
# Now we can assign to PRODUCT_RUNTIMES
PRODUCT_RUNTIMES := $(product_runtimes)
product_runtimes :=
+
+PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PROPERTY_OVERRIDES += persist.sys.dalvik.vm.lib=$(DALVIK_VM_LIB)
+
+ifeq ($(words $(PRODUCT_RUNTIMES)),1)
+ # If we only have one runtime, we can strip classes.dex by default during dex_preopt
+ DEX_PREOPT_DEFAULT := true
+else
+ # If we have more than one, we leave the classes.dex alone for post-boot analysis
+ DEX_PREOPT_DEFAULT := nostripping
+endif
+
#############################################################################
# A list of module names of BOOTCLASSPATH (jar files)
-PRODUCT_BOOT_JARS := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BOOT_JARS)
+PRODUCT_BOOT_JARS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BOOT_JARS))
# Find the device that this product maps to.
TARGET_DEVICE := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEVICE)
@@ -391,3 +402,7 @@
PRODUCT_EXTRA_RECOVERY_KEYS := $(sort \
$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_EXTRA_RECOVERY_KEYS))
+
+# If there is no room in /system for the image, place it in /data
+PRODUCT_DEX_PREOPT_IMAGE_IN_DATA := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_IMAGE_IN_DATA))
diff --git a/core/raw_static_library.mk b/core/raw_static_library.mk
index f7b11ef..14a404d 100644
--- a/core/raw_static_library.mk
+++ b/core/raw_static_library.mk
@@ -1,5 +1,4 @@
LOCAL_RAW_STATIC_LIBRARY:=true
-include $(BUILD_STATIC_LIBRARY)
-
+include $(BUILD_SYSTEM)/static_library_internal.mk
diff --git a/core/shared_library.mk b/core/shared_library.mk
index 10012df..9a75a7b 100644
--- a/core/shared_library.mk
+++ b/core/shared_library.mk
@@ -1,83 +1,35 @@
-###########################################################
-## Standard rules for building a normal shared library.
-##
-## Additional inputs from base_rules.make:
-## None.
-##
-## LOCAL_MODULE_SUFFIX will be set for you.
-###########################################################
-
-ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-endif
-ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
-LOCAL_MODULE_SUFFIX := $(TARGET_SHLIB_SUFFIX)
-endif
-ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
-$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
-endif
-ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
-$(error $(LOCAL_PATH): Cannot set module stem for a library)
-endif
-
-$(call target-shared-library-hook)
-
-skip_build_from_source :=
-ifdef LOCAL_PREBUILT_MODULE_FILE
-ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
-include $(BUILD_PREBUILT)
-skip_build_from_source := true
+ifneq ($(LOCAL_MODULE_PATH),)
+ifneq ($(TARGET_2ND_ARCH),)
+$(warning $(LOCAL_MODULE): LOCAL_MODULE_PATH for shared libraries is unsupported in multiarch builds, use LOCAL_MODULE_RELATIVE_PATH instead)
endif
endif
-ifndef skip_build_from_source
-####################################################
-## Add profiling libraries if aprof is turned
-####################################################
-ifeq ($(strip $(LOCAL_ENABLE_APROF_JNI)),true)
- LOCAL_ENABLE_APROF := true
- LOCAL_WHOLE_STATIC_LIBRARIES += libaprof_jni
+ifneq ($(LOCAL_UNSTRIPPED_PATH),)
+ifneq ($(TARGET_2ND_ARCH),)
+$(warning $(LOCAL_MODULE): LOCAL_UNSTRIPPED_PATH for shared libraries is unsupported in multiarch builds)
+endif
endif
-ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
- LOCAL_SHARED_LIBRARIES += libaprof libaprof_runtime
+ifneq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
+# Build for TARGET_ARCH
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+include $(BUILD_SYSTEM)/shared_library_internal.mk
endif
-# Put the built targets of all shared libraries in a common directory
-# to simplify the link line.
-OVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
+ifdef TARGET_2ND_ARCH
+ifneq ($(LOCAL_NO_2ND_ARCH),true)
+# Build for TARGET_2ND_ARCH
+OVERRIDE_BUILT_MODULE_PATH :=
+LOCAL_BUILT_MODULE :=
+LOCAL_INSTALLED_MODULE :=
+LOCAL_MODULE_STEM :=
+LOCAL_BUILT_MODULE_STEM :=
+LOCAL_INSTALLED_MODULE_STEM :=
+LOCAL_INTERMEDIATE_TARGETS :=
-include $(BUILD_SYSTEM)/dynamic_binary.mk
+LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
+include $(BUILD_SYSTEM)/shared_library_internal.mk
+LOCAL_2ND_ARCH_VAR_PREFIX :=
-
-# Define PRIVATE_ variables from global vars
-my_target_global_ld_dirs := $(TARGET_GLOBAL_LD_DIRS)
-my_target_global_ldflags := $(TARGET_GLOBAL_LDFLAGS)
-my_target_fdo_lib := $(TARGET_FDO_LIB)
-my_target_libgcc := $(TARGET_LIBGCC)
-my_target_crtbegin_so_o := $(TARGET_CRTBEGIN_SO_O)
-my_target_crtend_so_o := $(TARGET_CRTEND_SO_O)
-ifdef LOCAL_SDK_VERSION
-# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
-# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
-my_target_global_ld_dirs := \
- $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
- $(my_ndk_version_root)/usr/lib) \
- $(my_target_global_ld_dirs)
-my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
-my_target_crtbegin_so_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_so.o)
-my_target_crtend_so_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtend_so.o)
-endif
-$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
-$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
-$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
-$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
-$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
-$(linked_module): PRIVATE_TARGET_CRTEND_SO_O := $(my_target_crtend_so_o)
-
-$(linked_module): $(all_objects) $(all_libraries) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) \
- $(my_target_crtbegin_so_o) $(my_target_crtend_so_o)
- $(transform-o-to-shared-lib)
-
-endif # skip_build_from_source
+endif # LOCAL_NO_2ND_ARCH
+endif # TARGET_2ND_ARCH
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
new file mode 100644
index 0000000..1ded4a1
--- /dev/null
+++ b/core/shared_library_internal.mk
@@ -0,0 +1,75 @@
+###########################################################
+## Standard rules for building a normal shared library.
+##
+## Additional inputs from base_rules.make:
+## None.
+##
+## LOCAL_MODULE_SUFFIX will be set for you.
+###########################################################
+
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+endif
+ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
+LOCAL_MODULE_SUFFIX := $(TARGET_SHLIB_SUFFIX)
+endif
+ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
+$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
+endif
+ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
+$(error $(LOCAL_PATH): Cannot set module stem for a library)
+endif
+
+$(call target-shared-library-hook)
+
+skip_build_from_source :=
+ifdef LOCAL_PREBUILT_MODULE_FILE
+ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
+include $(BUILD_PREBUILT)
+skip_build_from_source := true
+endif
+endif
+
+ifndef skip_build_from_source
+
+# 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)TARGET_OUT_INTERMEDIATE_LIBRARIES)
+
+include $(BUILD_SYSTEM)/dynamic_binary.mk
+
+# Define PRIVATE_ variables from global vars
+my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
+ifeq ($(LOCAL_CLANG),true)
+my_target_global_ldflags := $(CLANG_TARGET_GLOBAL_LDFLAGS)
+else
+my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
+endif
+my_target_fdo_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_LIB)
+my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
+my_target_crtbegin_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_SO_O)
+my_target_crtend_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTEND_SO_O)
+ifdef LOCAL_SDK_VERSION
+# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
+# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
+my_target_global_ld_dirs := \
+ $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
+ $(my_ndk_version_root)/usr/lib) \
+ $(my_target_global_ld_dirs)
+my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
+my_target_crtbegin_so_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_so.o)
+my_target_crtend_so_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtend_so.o)
+endif
+$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
+$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
+$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
+$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
+$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
+$(linked_module): PRIVATE_TARGET_CRTEND_SO_O := $(my_target_crtend_so_o)
+
+$(linked_module): $(all_objects) $(all_libraries) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES) \
+ $(my_target_crtbegin_so_o) $(my_target_crtend_so_o)
+ $(transform-o-to-shared-lib)
+
+endif # skip_build_from_source
diff --git a/core/static_library.mk b/core/static_library.mk
index 976963e..747db81 100644
--- a/core/static_library.mk
+++ b/core/static_library.mk
@@ -1,40 +1,23 @@
-###########################################################
-## Standard rules for building a static library.
-##
-## Additional inputs from base_rules.make:
-## None.
-##
-## LOCAL_MODULE_SUFFIX will be set for you.
-###########################################################
-
-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)
+ifneq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
+# Build for TARGET_ARCH
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+include $(BUILD_SYSTEM)/static_library_internal.mk
endif
-####################################################
-## Add profiling libraries if aprof is turned
-####################################################
-ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
- LOCAL_WHOLE_STATIC_LIBRARIES += libaprof
-endif
+ifdef TARGET_2ND_ARCH
+ifneq ($(LOCAL_NO_2ND_ARCH),true)
+# Build for TARGET_2ND_ARCH
+OVERRIDE_BUILT_MODULE_PATH :=
+LOCAL_BUILT_MODULE :=
+LOCAL_INSTALLED_MODULE :=
+LOCAL_MODULE_STEM :=
+LOCAL_BUILT_MODULE_STEM :=
+LOCAL_INSTALLED_MODULE_STEM :=
+LOCAL_INTERMEDIATE_TARGETS :=
-include $(BUILD_SYSTEM)/binary.mk
+LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
+include $(BUILD_SYSTEM)/static_library_internal.mk
+LOCAL_2ND_ARCH_VAR_PREFIX :=
-ifeq ($(LOCAL_RAW_STATIC_LIBRARY),true)
-LOCAL_RAW_STATIC_LIBRARY:=
-$(all_objects) : PRIVATE_TARGET_PROJECT_INCLUDES :=
-$(all_objects) : PRIVATE_TARGET_C_INCLUDES :=
-$(all_objects) : PRIVATE_TARGET_GLOBAL_CFLAGS :=
-$(all_objects) : PRIVATE_TARGET_GLOBAL_CPPFLAGS :=
-endif
-
-$(LOCAL_BUILT_MODULE): $(built_whole_libraries)
-$(LOCAL_BUILT_MODULE): $(all_objects)
- $(transform-o-to-static-lib)
+endif # LOCAL_NO_2ND_ARCH
+endif # TARGET_2ND_ARCH
diff --git a/core/static_library_internal.mk b/core/static_library_internal.mk
new file mode 100644
index 0000000..2d3468c
--- /dev/null
+++ b/core/static_library_internal.mk
@@ -0,0 +1,34 @@
+###########################################################
+## Standard rules for building a static library.
+##
+## Additional inputs from base_rules.make:
+## None.
+##
+## LOCAL_MODULE_SUFFIX will be set for you.
+###########################################################
+
+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
+
+ifeq ($(LOCAL_RAW_STATIC_LIBRARY),true)
+LOCAL_RAW_STATIC_LIBRARY:=
+$(all_objects) : PRIVATE_TARGET_PROJECT_INCLUDES :=
+$(all_objects) : PRIVATE_TARGET_C_INCLUDES :=
+$(all_objects) : PRIVATE_TARGET_GLOBAL_CFLAGS :=
+$(all_objects) : PRIVATE_TARGET_GLOBAL_CPPFLAGS :=
+endif
+
+$(LOCAL_BUILT_MODULE): PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
+$(LOCAL_BUILT_MODULE) : $(built_whole_libraries)
+$(LOCAL_BUILT_MODULE) : $(all_objects)
+ $(transform-o-to-static-lib)
diff --git a/core/tasks/collect_gpl_sources.mk b/core/tasks/collect_gpl_sources.mk
index 3c7afcc..30ba62b 100644
--- a/core/tasks/collect_gpl_sources.mk
+++ b/core/tasks/collect_gpl_sources.mk
@@ -14,8 +14,9 @@
gpl_source_tgz := $(call intermediates-dir-for,PACKAGING,gpl_source,HOST,COMMON)/gpl_source.tgz
+# FORCE since we can't know whether any of the sources changed
$(gpl_source_tgz): PRIVATE_PATHS := $(sort $(patsubst %/, %, $(dir $(ALL_GPL_MODULE_LICENSE_FILES))))
-$(gpl_source_tgz) : $(ALL_GPL_MODULE_LICENSE_FILES)
+$(gpl_source_tgz) : $(ALL_GPL_MODULE_LICENSE_FILES) FORCE
@echo Package gpl sources: $@
@rm -rf $(dir $@) && mkdir -p $(dir $@)
$(hide) tar cfz $@ --exclude ".git*" $(PRIVATE_PATHS)
diff --git a/core/tasks/cts.mk b/core/tasks/cts.mk
index f38f090..ed8c125 100644
--- a/core/tasks/cts.mk
+++ b/core/tasks/cts.mk
@@ -76,7 +76,7 @@
@echo "Generate core-test description ("$(notdir $(1))")"
$(hide) java -Xmx256M \
-Xbootclasspath/a:$(PRIVATE_CLASSPATH) \
- -classpath $(PRIVATE_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/descGen.jar:$(HOST_JDK_TOOLS_JAR) \
+ -classpath $(PRIVATE_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/descGen.jar:$(HOST_OUT_JAVA_LIBRARIES)/junit.jar:$(HOST_JDK_TOOLS_JAR) \
$(PRIVATE_PARAMS) CollectAllTests $(1) $(2) $(3) "$(4)" $(5) $(6)
endef
@@ -107,7 +107,7 @@
# build system requires that dependencies use javalib.jar. If
# javalib.jar is up-to-date, then classes.jar is as well. Depending
# on classes.jar will build the files incorrectly.
-CTS_CORE_XMLS_DEPS := $(CTS_CORE_CASES) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(CORE_INTERMEDIATES)/javalib.jar $(BOUNCYCASTLE_INTERMEDIATES)/javalib.jar $(APACHEXML_INTERMEDIATES)/javalib.jar $(OKHTTP_INTERMEDIATES)/javalib.jar $(SQLITEJDBC_INTERMEDIATES)/javalib.jar $(JUNIT_INTERMEDIATES)/javalib.jar $(CORETESTS_INTERMEDIATES)/javalib.jar $(CONSCRYPTTESTS_INTERMEDIATES)/javalib.jar | $(ACP)
+CTS_CORE_XMLS_DEPS := $(CTS_CORE_CASES) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(HOST_OUT_JAVA_LIBRARIES)/junit.jar $(CORE_INTERMEDIATES)/javalib.jar $(BOUNCYCASTLE_INTERMEDIATES)/javalib.jar $(APACHEXML_INTERMEDIATES)/javalib.jar $(OKHTTP_INTERMEDIATES)/javalib.jar $(SQLITEJDBC_INTERMEDIATES)/javalib.jar $(JUNIT_INTERMEDIATES)/javalib.jar $(CORETESTS_INTERMEDIATES)/javalib.jar $(CONSCRYPTTESTS_INTERMEDIATES)/javalib.jar | $(ACP)
$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.dalvik.xml: $(CTS_CORE_XMLS_DEPS)
$(hide) mkdir -p $(CTS_TESTCASES_OUT)
@@ -170,7 +170,7 @@
$(CORE_VM_TEST_TF_DESC): PRIVATE_CLASSPATH:=$(GEN_CLASSPATH)
# Please see big comment above on why this line depends on javalib.jar instead of classes.jar
-$(CORE_VM_TEST_TF_DESC): $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(CORE_INTERMEDIATES)/javalib.jar $(JUNIT_INTERMEDIATES)/javalib.jar $(VMTESTSTF_JAR) $(DDMLIB_JAR) | $(ACP)
+$(CORE_VM_TEST_TF_DESC): $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(HOST_OUT_JAVA_LIBRARIES)/junit.jar $(CORE_INTERMEDIATES)/javalib.jar $(JUNIT_INTERMEDIATES)/javalib.jar $(VMTESTSTF_JAR) $(DDMLIB_JAR) | $(ACP)
$(hide) mkdir -p $(CTS_TESTCASES_OUT)
$(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.vm-tests-tf,\
cts/tests/vm-tests-tf/AndroidManifest.xml,\
diff --git a/envsetup.sh b/envsetup.sh
index 0661fe6..3ec6cce 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -34,7 +34,7 @@
return
fi
(\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
- make --no-print-directory -C "$T" -f build/core/config.mk dumpvar-abs-$1)
+ make --no-print-directory -f build/core/config.mk dumpvar-abs-$1)
}
# Get the exact value of a build variable.
@@ -45,8 +45,8 @@
echo "Couldn't locate the top of the tree. Try setting TOP." >&2
return
fi
- CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
- make --no-print-directory -C "$T" -f build/core/config.mk dumpvar-$1
+ (\cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
+ make --no-print-directory -f build/core/config.mk dumpvar-$1)
}
# check to see if the supplied product is one we can build
@@ -126,10 +126,14 @@
export ANDROID_EABI_TOOLCHAIN=
local ARCH=$(get_build_var TARGET_ARCH)
case $ARCH in
- x86) toolchaindir=x86/i686-linux-android-$targetgccversion/bin
+ x86) toolchaindir=x86/x86_64-linux-android-$targetgccversion/bin
+ ;;
+ x86_64) toolchaindir=x86/x86_64-linux-android-$targetgccversion/bin
;;
arm) toolchaindir=arm/arm-linux-androideabi-$targetgccversion/bin
;;
+ arm64) toolchaindir=aarch64/aarch64-linux-android-$targetgccversion/bin
+ ;;
mips) toolchaindir=mips/mipsel-linux-android-$targetgccversion/bin
;;
*)
@@ -205,6 +209,8 @@
set_sequence_number
export ANDROID_BUILD_TOP=$(gettop)
+ # With this environment variable new GCC can apply colors to warnings/errors
+ export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
}
function set_sequence_number()
@@ -429,6 +435,8 @@
add_lunch_combo aosp_arm-eng
add_lunch_combo aosp_x86-eng
add_lunch_combo aosp_mips-eng
+add_lunch_combo aosp_x86_64-eng
+add_lunch_combo aosp_arm64-eng
add_lunch_combo vbox_x86-eng
function print_lunch_menu()
@@ -601,11 +609,26 @@
fi
}
+# Return driver for "make", if any (eg. static analyzer)
+function getdriver()
+{
+ local T="$1"
+ test "$WITH_STATIC_ANALYZER" = "0" && unset WITH_STATIC_ANALYZER
+ if [ -n "$WITH_STATIC_ANALYZER" ]; then
+ echo "\
+$T/prebuilts/clang/linux-x86/host/3.3/tools/scan-build/scan-build \
+--use-analyzer $T/prebuilts/clang/linux-x86/host/3.3/bin/analyzer \
+--status-bugs \
+--top=$T"
+ fi
+}
+
function m()
{
- T=$(gettop)
+ local T=$(gettop)
+ local DRV=$(getdriver $T)
if [ "$T" ]; then
- make -C $T -f build/core/main.mk $@
+ $DRV make -C $T -f build/core/main.mk $@
else
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
@@ -630,13 +653,14 @@
function mm()
{
+ local T=$(gettop)
+ local DRV=$(getdriver $T)
# If we're sitting in the root of the build tree, just do a
# normal make.
if [ -f build/core/envsetup.mk -a -f Makefile ]; then
- make $@
+ $DRV make $@
else
# Find the closest Android.mk file.
- T=$(gettop)
local M=$(findmakefile)
local MODULES=
local GET_INSTALL_PATH=
@@ -660,14 +684,15 @@
MODULES=all_modules
ARGS=$@
fi
- ONE_SHOT_MAKEFILE=$M make -C $T -f build/core/main.mk $MODULES $ARGS
+ ONE_SHOT_MAKEFILE=$M $DRV make -C $T -f build/core/main.mk $MODULES $ARGS
fi
fi
}
function mmm()
{
- T=$(gettop)
+ local T=$(gettop)
+ local DRV=$(getdriver $T)
if [ "$T" ]; then
local MAKEFILE=
local MODULES=
@@ -705,7 +730,7 @@
ARGS=$GET_INSTALL_PATH
MODULES=
fi
- ONE_SHOT_MAKEFILE="$MAKEFILE" make -C $T -f build/core/main.mk $DASH_ARGS $MODULES $ARGS
+ ONE_SHOT_MAKEFILE="$MAKEFILE" $DRV make -C $T -f build/core/main.mk $DASH_ARGS $MODULES $ARGS
else
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
@@ -713,21 +738,23 @@
function mma()
{
+ local T=$(gettop)
+ local DRV=$(getdriver $T)
if [ -f build/core/envsetup.mk -a -f Makefile ]; then
- make $@
+ $DRV make $@
else
- T=$(gettop)
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
local MY_PWD=`PWD= /bin/pwd|sed 's:'$T'/::'`
- make -C $T -f build/core/main.mk $@ all_modules BUILD_MODULES_IN_PATHS="$MY_PWD"
+ $DRV make -C $T -f build/core/main.mk $@ all_modules BUILD_MODULES_IN_PATHS="$MY_PWD"
fi
}
function mmma()
{
- T=$(gettop)
+ local T=$(gettop)
+ local DRV=$(getdriver $T)
if [ "$T" ]; then
local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
@@ -754,7 +781,7 @@
esac
fi
done
- make -C $T -f build/core/main.mk $DASH_ARGS $ARGS all_modules BUILD_MODULES_IN_PATHS="$MODULE_PATHS"
+ $DRV make -C $T -f build/core/main.mk $DASH_ARGS $ARGS all_modules BUILD_MODULES_IN_PATHS="$MODULE_PATHS"
else
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
@@ -902,7 +929,7 @@
local ARCH=$(get_build_var TARGET_ARCH)
local GDB
case "$ARCH" in
- x86) GDB=i686-linux-android-gdb;;
+ x86) GDB=x86_64-linux-android-gdb;;
arm) GDB=arm-linux-androideabi-gdb;;
mips) GDB=mipsel-linux-android-gdb;;
*) echo "Unknown arch $ARCH"; return 1;;
@@ -990,17 +1017,17 @@
function jgrep()
{
- find . -name .repo -prune -o -name .git -prune -o -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@"
+ find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@"
}
function cgrep()
{
- find . -name .repo -prune -o -name .git -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@"
+ find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@"
}
function resgrep()
{
- for dir in `find . -name .repo -prune -o -name .git -prune -o -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done;
+ for dir in `find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done;
}
function mangrep()
@@ -1295,9 +1322,23 @@
\cd $T/$pathname
}
-# Force JAVA_HOME to point to java 1.6 if it isn't already set
+# Force JAVA_HOME to point to java 1.7 or java 1.6 if it isn't already set.
+#
+# Note that the MacOS path for java 1.7 includes a minor revision number (sigh).
+# For some reason, installing the JDK doesn't make it show up in the
+# JavaVM.framework/Versions/1.7/ folder.
function set_java_home() {
+ # Clear the existing JAVA_HOME value if we set it ourselves, so that
+ # we can reset it later, depending on the value of EXPERIMENTAL_USE_JAVA7.
+ #
+ # If we don't do this, the JAVA_HOME value set by the first call to
+ # build/envsetup.sh will persist forever.
+ if [ -n "$ANDROID_SET_JAVA_HOME" ]; then
+ export JAVA_HOME=""
+ fi
+
if [ ! "$JAVA_HOME" ]; then
+ if [ ! "$EXPERIMENTAL_USE_JAVA7" ]; then
case `uname -s` in
Darwin)
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
@@ -1306,6 +1347,20 @@
export JAVA_HOME=/usr/lib/jvm/java-6-sun
;;
esac
+ else
+ case `uname -s` in
+ Darwin)
+ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
+ ;;
+ *)
+ export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
+ ;;
+ esac
+ fi
+
+ # Keep track of the fact that we set JAVA_HOME ourselves, so that
+ # we can change it on the next envsetup.sh, if required.
+ export ANDROID_SET_JAVA_HOME=true
fi
}
diff --git a/target/board/emulator/AndroidBoard.mk b/target/board/emulator/AndroidBoard.mk
deleted file mode 100644
index 7911f61..0000000
--- a/target/board/emulator/AndroidBoard.mk
+++ /dev/null
@@ -1 +0,0 @@
-LOCAL_PATH := $(call my-dir)
diff --git a/target/board/emulator/BoardConfig.mk b/target/board/emulator/BoardConfig.mk
deleted file mode 100644
index 9ab607a..0000000
--- a/target/board/emulator/BoardConfig.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-# config.mk
-#
-# Product-specific compile-time definitions.
-#
-
-# The generic product target doesn't have any hardware-specific pieces.
-TARGET_NO_BOOTLOADER := true
-TARGET_NO_KERNEL := true
-HAVE_HTC_AUDIO_DRIVER := true
-
-# no hardware camera
-USE_CAMERA_STUB := true
diff --git a/target/board/emulator/README.txt b/target/board/emulator/README.txt
deleted file mode 100644
index 6a1ec89..0000000
--- a/target/board/emulator/README.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-The "emulator" product defines an almost non-hardware-specific target
-without a kernel or bootloader, except that it defines the
-HAVE_HTC_AUDIO_DRIVER constant, since that is what the emulator
-emulates currently.
-
-It can be used to build the entire user-level system, and
-will work with the emulator.
-
-It is not a product "base class"; no other products inherit
-from it or use it in any way.
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 60decfb..e0ad23a 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -74,3 +74,9 @@
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+
+BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
+BOARD_SEPOLICY_UNION += \
+ bootanim.te \
+ domain.te \
+ surfaceflinger.te
diff --git a/target/board/generic/device.mk b/target/board/generic/device.mk
index aca8d24..fe64bcb 100644
--- a/target/board/generic/device.mk
+++ b/target/board/generic/device.mk
@@ -30,4 +30,5 @@
PRODUCT_PACKAGES := \
audio.primary.goldfish \
- power.goldfish
+ power.goldfish \
+ vibrator.goldfish
diff --git a/target/board/generic/sepolicy/bootanim.te b/target/board/generic/sepolicy/bootanim.te
new file mode 100644
index 0000000..d6506e1
--- /dev/null
+++ b/target/board/generic/sepolicy/bootanim.te
@@ -0,0 +1,2 @@
+allow bootanim self:process execmem;
+allow bootanim ashmem_device:chr_file execute;
diff --git a/target/board/generic/sepolicy/domain.te b/target/board/generic/sepolicy/domain.te
new file mode 100644
index 0000000..f026100
--- /dev/null
+++ b/target/board/generic/sepolicy/domain.te
@@ -0,0 +1,2 @@
+# For /sys/qemu_trace files in the emulator.
+allow domain sysfs_writable:file rw_file_perms;
diff --git a/target/board/generic/sepolicy/surfaceflinger.te b/target/board/generic/sepolicy/surfaceflinger.te
new file mode 100644
index 0000000..4c35469
--- /dev/null
+++ b/target/board/generic/sepolicy/surfaceflinger.te
@@ -0,0 +1,2 @@
+allow surfaceflinger self:process execmem;
+allow surfaceflinger ashmem_device:chr_file execute;
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
new file mode 100644
index 0000000..03284d7
--- /dev/null
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -0,0 +1,53 @@
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# The generic product target doesn't have any hardware-specific pieces.
+TARGET_NO_BOOTLOADER := true
+TARGET_NO_KERNEL := true
+TARGET_ARCH := arm64
+TARGET_ARCH_VARIANT := armv8-a
+TARGET_CPU_VARIANT := generic
+TARGET_CPU_ABI := arm64-v8a
+
+# no hardware camera
+USE_CAMERA_STUB := true
+
+# Enable dex-preoptimization to speed up the first boot sequence
+# of an SDK AVD. Note that this operation only works on Linux for now
+ifeq ($(HOST_OS),linux)
+ ifeq ($(WITH_DEXPREOPT),)
+ WITH_DEXPREOPT := true
+ endif
+endif
+
+# Build OpenGLES emulation host and guest libraries
+BUILD_EMULATOR_OPENGL := true
+
+# Build and enable the OpenGL ES View renderer. When running on the emulator,
+# the GLES renderer disables itself if host GL acceleration isn't available.
+USE_OPENGL_RENDERER := true
+
+TARGET_USERIMAGES_USE_EXT4 := true
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 576716800
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 209715200
+BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
+BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_FLASH_BLOCK_SIZE := 512
+TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+
+# FIXME
+# Temporarily disable linking against compiler_rt until there is an arm64
+# version
+WITHOUT_LIBCOMPILER_RT := true
diff --git a/target/board/generic_arm64/README.txt b/target/board/generic_arm64/README.txt
new file mode 100644
index 0000000..21c71d7
--- /dev/null
+++ b/target/board/generic_arm64/README.txt
@@ -0,0 +1,5 @@
+The "generic_arm64" product defines a non-hardware-specific arm64 target
+without a kernel or bootloader.
+
+It is not a product "base class"; no other products inherit
+from it or use it in any way.
diff --git a/target/board/generic_arm64/device.mk b/target/board/generic_arm64/device.mk
new file mode 100644
index 0000000..354fb2a
--- /dev/null
+++ b/target/board/generic_arm64/device.mk
@@ -0,0 +1,32 @@
+#
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is a build configuration for the product aspects that
+# are specific to the emulator.
+
+PRODUCT_PROPERTY_OVERRIDES := \
+ ro.ril.hsxpa=1 \
+ ro.ril.gprsclass=10 \
+ ro.adb.qemud=1
+
+PRODUCT_COPY_FILES := \
+ device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
+ device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \
+ device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml
+
+PRODUCT_PACKAGES := \
+ audio.primary.goldfish \
+ vibrator.goldfish
diff --git a/target/board/generic_arm64/system.prop b/target/board/generic_arm64/system.prop
new file mode 100644
index 0000000..aee6b13
--- /dev/null
+++ b/target/board/generic_arm64/system.prop
@@ -0,0 +1,6 @@
+#
+# system.prop for generic arm64 sdk
+#
+
+rild.libpath=/system/lib/libreference-ril.so
+rild.libargs=-d /dev/ttyS0
diff --git a/target/board/generic_mips/device.mk b/target/board/generic_mips/device.mk
index 58fe976..b182c4c 100644
--- a/target/board/generic_mips/device.mk
+++ b/target/board/generic_mips/device.mk
@@ -31,4 +31,5 @@
PRODUCT_PACKAGES := \
audio.primary.goldfish \
power.goldfish \
+ vibrator.goldfish \
libffi
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index ed7da38..2381fea 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -41,3 +41,11 @@
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+
+BOARD_SEPOLICY_DIRS += build/target/board/generic_x86/sepolicy
+BOARD_SEPOLICY_UNION += \
+ domain.te \
+ healthd.te \
+ installd.te \
+ system_server.te \
+ zygote.te
diff --git a/target/board/generic_x86/device.mk b/target/board/generic_x86/device.mk
index 574ce4f..089f584 100644
--- a/target/board/generic_x86/device.mk
+++ b/target/board/generic_x86/device.mk
@@ -28,4 +28,5 @@
device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml
PRODUCT_PACKAGES := \
- audio.primary.goldfish
+ audio.primary.goldfish \
+ vibrator.goldfish
diff --git a/target/board/generic_x86/sepolicy/domain.te b/target/board/generic_x86/sepolicy/domain.te
new file mode 100644
index 0000000..0bc8d87
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/domain.te
@@ -0,0 +1 @@
+allow domain cpuctl_device:dir search;
diff --git a/target/board/generic_x86/sepolicy/healthd.te b/target/board/generic_x86/sepolicy/healthd.te
new file mode 100644
index 0000000..95fa807
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/healthd.te
@@ -0,0 +1 @@
+allow healthd self:capability sys_nice;
diff --git a/target/board/generic_x86/sepolicy/installd.te b/target/board/generic_x86/sepolicy/installd.te
new file mode 100644
index 0000000..7a558b1
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/installd.te
@@ -0,0 +1 @@
+allow installd self:process execmem;
diff --git a/target/board/generic_x86/sepolicy/system_server.te b/target/board/generic_x86/sepolicy/system_server.te
new file mode 100644
index 0000000..5d98a14
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/system_server.te
@@ -0,0 +1 @@
+allow system_server self:process execmem;
diff --git a/target/board/generic_x86/sepolicy/zygote.te b/target/board/generic_x86/sepolicy/zygote.te
new file mode 100644
index 0000000..93993a4
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/zygote.te
@@ -0,0 +1,2 @@
+allow zygote self:process execmem;
+allow zygote self:capability sys_nice;
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
new file mode 100755
index 0000000..8a2fd13
--- /dev/null
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -0,0 +1,43 @@
+# config.mk
+#
+# Product-specific compile-time definitions.
+#
+
+# The generic product target doesn't have any hardware-specific pieces.
+TARGET_NO_BOOTLOADER := true
+TARGET_NO_KERNEL := true
+TARGET_CPU_ABI := x86_64
+TARGET_ARCH := x86_64
+TARGET_ARCH_VARIANT := x86_64
+TARGET_PRELINK_MODULE := false
+
+# The IA emulator (qemu) uses the Goldfish devices
+HAVE_HTC_AUDIO_DRIVER := true
+BOARD_USES_GENERIC_AUDIO := true
+
+# no hardware camera
+USE_CAMERA_STUB := true
+
+# customize the malloced address to be 16-byte aligned
+BOARD_MALLOC_ALIGNMENT := 16
+
+# Enable dex-preoptimization to speed up the first boot sequence
+# of an SDK AVD. Note that this operation only works on Linux for now
+ifeq ($(HOST_OS),linux)
+WITH_DEXPREOPT := true
+endif
+
+# Build OpenGLES emulation host and guest libraries
+BUILD_EMULATOR_OPENGL := true
+
+# Build and enable the OpenGL ES View renderer. When running on the emulator,
+# the GLES renderer disables itself if host GL acceleration isn't available.
+USE_OPENGL_RENDERER := true
+
+TARGET_USERIMAGES_USE_EXT4 := true
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 576716800
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 209715200
+BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
+BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_FLASH_BLOCK_SIZE := 512
+TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
diff --git a/target/board/generic_x86_64/README.txt b/target/board/generic_x86_64/README.txt
new file mode 100644
index 0000000..46b015b
--- /dev/null
+++ b/target/board/generic_x86_64/README.txt
@@ -0,0 +1,8 @@
+The "generic_x86_64" product defines a non-hardware-specific IA target
+without a kernel or bootloader.
+
+It can be used to build the entire user-level system, and
+will work with the IA version of the emulator,
+
+It is not a product "base class"; no other products inherit
+from it or use it in any way.
diff --git a/target/board/generic_x86_64/device.mk b/target/board/generic_x86_64/device.mk
new file mode 100755
index 0000000..089f584
--- /dev/null
+++ b/target/board/generic_x86_64/device.mk
@@ -0,0 +1,32 @@
+#
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is a build configuration for the product aspects that
+# are specific to the emulator.
+
+PRODUCT_PROPERTY_OVERRIDES := \
+ ro.ril.hsxpa=1 \
+ ro.ril.gprsclass=10 \
+ ro.adb.qemud=1
+
+PRODUCT_COPY_FILES := \
+ device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
+ device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \
+ device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml
+
+PRODUCT_PACKAGES := \
+ audio.primary.goldfish \
+ vibrator.goldfish
diff --git a/target/board/generic_x86_64/system.prop b/target/board/generic_x86_64/system.prop
new file mode 100644
index 0000000..137a0f9
--- /dev/null
+++ b/target/board/generic_x86_64/system.prop
@@ -0,0 +1,6 @@
+#
+# system.prop for generic sdk
+#
+
+rild.libpath=/system/lib/libreference-ril.so
+rild.libargs=-d /dev/ttyS0
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index a72d2f3..65adb0c 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -40,7 +40,8 @@
$(LOCAL_DIR)/aosp_x86.mk \
$(LOCAL_DIR)/full_x86.mk \
$(LOCAL_DIR)/aosp_mips.mk \
- $(LOCAL_DIR)/full_mips.mk
+ $(LOCAL_DIR)/full_mips.mk \
+ $(LOCAL_DIR)/aosp_arm64.mk
else
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/core.mk \
@@ -53,6 +54,9 @@
$(LOCAL_DIR)/full_x86.mk \
$(LOCAL_DIR)/aosp_mips.mk \
$(LOCAL_DIR)/full_mips.mk \
+ $(LOCAL_DIR)/aosp_arm64.mk \
+ $(LOCAL_DIR)/aosp_x86_64.mk \
+ $(LOCAL_DIR)/full_x86_64.mk \
$(LOCAL_DIR)/vbox_x86.mk \
$(LOCAL_DIR)/sdk.mk \
$(LOCAL_DIR)/sdk_x86.mk \
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
new file mode 100644
index 0000000..7f97a61
--- /dev/null
+++ b/target/product/aosp_arm64.mk
@@ -0,0 +1,29 @@
+#
+# Copyright (C) 2013 The Android Open-Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is a build configuration for a full-featured build of the
+# Open-Source part of the tree. It's geared toward a US-centric
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
+
+include $(SRC_TARGET_DIR)/product/emulator.mk
+PRODUCT_NAME := aosp_arm64
+PRODUCT_DEVICE := generic_arm64
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on ARM arm64 Emulator
diff --git a/target/product/aosp_x86_64.mk b/target/product/aosp_x86_64.mk
new file mode 100644
index 0000000..5a12c08
--- /dev/null
+++ b/target/product/aosp_x86_64.mk
@@ -0,0 +1,18 @@
+#
+# Copyright 2013 The Android Open-Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/full_x86_64.mk)
+
+PRODUCT_NAME := aosp_x86_64
diff --git a/target/product/base.mk b/target/product/base.mk
index 0959fb4..68e3ff3 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -31,10 +31,10 @@
dhcpcd-run-hooks \
dnsmasq \
framework \
+ framework2 \
fsck_msdos \
ime \
javax.obex \
- libSR_AudioIn \
libandroid \
libandroid_runtime \
libandroid_servers \
@@ -78,7 +78,6 @@
libutils \
libvisualizer \
libvorbisidec \
- libwpa_client \
media \
media_cmd \
mediaserver \
diff --git a/target/product/core_base.mk b/target/product/core_base.mk
index cde2b85..658e502 100644
--- a/target/product/core_base.mk
+++ b/target/product/core_base.mk
@@ -67,5 +67,20 @@
voip-common
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_minimal.mk)
-# Override the PRODUCT_BOOT_JARS set in core_minimal.mk
-PRODUCT_BOOT_JARS := core:conscrypt:okhttp:core-junit:bouncycastle:ext:framework:framework2:telephony-common:voip-common:mms-common:android.policy:services:apache-xml:webviewchromium
+# Override the PRODUCT_BOOT_JARS set in core_minimal.mk. The order matters.
+PRODUCT_BOOT_JARS := \
+ core \
+ conscrypt \
+ okhttp \
+ core-junit \
+ bouncycastle \
+ ext \
+ framework \
+ framework2 \
+ telephony-common \
+ voip-common \
+ mms-common \
+ android.policy \
+ services \
+ apache-xml \
+ webviewchromium
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 159e7b2..79ba0d4 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -57,9 +57,22 @@
sensorservice \
uiautomator
-PRODUCT_BOOT_JARS := core:conscrypt:okhttp:core-junit:bouncycastle:ext:framework:framework2:android.policy:services:apache-xml:webviewchromium
+# The order of PRODUCT_BOOT_JARS matters.
+PRODUCT_BOOT_JARS := \
+ core \
+ conscrypt \
+ okhttp \
+ core-junit \
+ bouncycastle \
+ ext \
+ framework \
+ framework2 \
+ android.policy \
+ services \
+ apache-xml \
+ webviewchromium
-PRODUCT_RUNTIMES := runtime_libdvm_default
-PRODUCT_RUNTIMES += runtime_libart
+PRODUCT_RUNTIMES := runtime_libart_default
+PRODUCT_RUNTIMES += runtime_libdvm
$(call inherit-product, $(SRC_TARGET_DIR)/product/base.mk)
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index 11e02ae..d370af9 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -55,15 +55,16 @@
libsurfaceflinger \
libsurfaceflinger_ddmconnection \
libsysutils \
- libthread_db \
libui \
libutils \
linker \
logcat \
logwrapper \
+ mkshrc \
reboot \
service \
servicemanager \
+ sh \
surfaceflinger \
toolbox
diff --git a/target/product/emulator.mk b/target/product/emulator.mk
index 439e6c7..6812c22 100644
--- a/target/product/emulator.mk
+++ b/target/product/emulator.mk
@@ -53,7 +53,8 @@
camera.goldfish.jpeg \
lights.goldfish \
gps.goldfish \
- sensors.goldfish
+ sensors.goldfish \
+ e2fsck
PRODUCT_COPY_FILES += \
diff --git a/target/product/full_x86_64.mk b/target/product/full_x86_64.mk
new file mode 100755
index 0000000..644f2a2
--- /dev/null
+++ b/target/product/full_x86_64.mk
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is a build configuration for a full-featured build of the
+# Open-Source part of the tree. It's geared toward a US-centric
+# build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+
+# If running on an emulator or some other device that has a LAN connection
+# that isn't a wifi connection. This will instruct init.rc to enable the
+# network connection so that you can use it with ADB
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk)
+
+include $(SRC_TARGET_DIR)/product/emulator.mk
+
+ifdef NET_ETH0_STARTONBOOT
+ PRODUCT_PROPERTY_OVERRIDES += net.eth0.startonboot=1
+endif
+
+# Ensure we package the BIOS files too.
+PRODUCT_PACKAGES += \
+ bios.bin \
+ vgabios-cirrus.bin \
+
+# Overrides
+PRODUCT_NAME := full_x86_64
+PRODUCT_DEVICE := generic_x86_64
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on IA x86_64 Emulator
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index 1155b4e..963d56a 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -45,8 +45,6 @@
TeleService \
CalendarProvider \
bluetooth-health \
- hostapd \
- wpa_supplicant.conf \
WallpaperCropper
PRODUCT_PACKAGES += \
@@ -57,8 +55,7 @@
network \
pand \
pppd \
- sdptool \
- wpa_supplicant
+ sdptool
PRODUCT_PACKAGES += \
librs_jni \
@@ -72,6 +69,7 @@
audio.primary.default \
audio_policy.default \
local_time.default \
+ vibrator.default \
power.default
PRODUCT_PACKAGES += \
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index 5fddc3f..1a7c925 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -28,7 +28,4 @@
core-libart-hostdex
endif
-# We currently don't suport DEX_PREOPT for art
-DEX_PREOPT_DEFAULT := nostripping
-
include $(SRC_TARGET_DIR)/product/runtime_common.mk
diff --git a/target/product/runtime_libart_default.mk b/target/product/runtime_libart_default.mk
index 575ca04..2d4c793 100644
--- a/target/product/runtime_libart_default.mk
+++ b/target/product/runtime_libart_default.mk
@@ -16,7 +16,6 @@
# Set ART as the default runtime environment
-PRODUCT_PROPERTY_OVERRIDES += \
- persist.sys.dalvik.vm.lib=libart.so
+DALVIK_VM_LIB := libart.so
include $(SRC_TARGET_DIR)/product/runtime_libart.mk
diff --git a/target/product/runtime_libdvm.mk b/target/product/runtime_libdvm.mk
index 42e86ed..e7647b8 100644
--- a/target/product/runtime_libdvm.mk
+++ b/target/product/runtime_libdvm.mk
@@ -27,9 +27,4 @@
core-hostdex
endif
-# If runtime_libart has disabled, do not override
-ifndef DEX_PREOPT_DEFAULT
-DEX_PREOPT_DEFAULT := true
-endif
-
include $(SRC_TARGET_DIR)/product/runtime_common.mk
diff --git a/target/product/runtime_libdvm_default.mk b/target/product/runtime_libdvm_default.mk
index 3ae4130..b581ce5 100644
--- a/target/product/runtime_libdvm_default.mk
+++ b/target/product/runtime_libdvm_default.mk
@@ -16,7 +16,6 @@
# Set Dalvik as the default runtime environment
-PRODUCT_PROPERTY_OVERRIDES += \
- persist.sys.dalvik.vm.lib=libdvm.so
+DALVIK_VM_LIB := libdvm.so
include $(SRC_TARGET_DIR)/product/runtime_libdvm.mk
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index 604790a..4005e57 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -91,6 +91,7 @@
include $(SRC_TARGET_DIR)/product/emulator.mk
+$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)
$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
$(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
$(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk)
diff --git a/tools/adbs b/tools/adbs
index 37c520c..a9bc7c2 100755
--- a/tools/adbs
+++ b/tools/adbs
@@ -20,9 +20,9 @@
import sys
###############################################################################
-# match "#00 pc 0003f52e /system/lib/libdvm.so" for example
+# match "#00 pc 0003f52e /system/lib/libdvm.so" for example
###############################################################################
-trace_line = re.compile("(.*)(\#[0-9]+) (..) ([0-9a-f]{8}) ([^\r\n \t]*)")
+trace_line = re.compile("(.*)(\#[0-9]+) {1,2}(..) ([0-9a-f]{8}) ([^\r\n \t]*)")
# returns a list containing the function name and the file/lineno
def CallAddr2Line(lib, addr):
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index a3217dd..f179717 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -287,7 +287,10 @@
assert p1.returncode == 0, "mkbootfs of %s ramdisk failed" % (targetname,)
assert p2.returncode == 0, "minigzip of %s ramdisk failed" % (targetname,)
- cmd = ["mkbootimg", "--kernel", os.path.join(sourcedir, "kernel")]
+ # use MKBOOTIMG from environ, or "mkbootimg" if empty or not set
+ mkbootimg = os.getenv('MKBOOTIMG') or "mkbootimg"
+
+ cmd = [mkbootimg, "--kernel", os.path.join(sourcedir, "kernel")]
fn = os.path.join(sourcedir, "cmdline")
if os.access(fn, os.F_OK):
@@ -306,7 +309,7 @@
args = info_dict.get("mkbootimg_args", None)
if args and args.strip():
- cmd.extend(args.split())
+ cmd.extend(shlex.split(args))
cmd.extend(["--ramdisk", ramdisk_img.name,
"--output", img.name])
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index a31d70a..8d3f6ce 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -94,6 +94,7 @@
OPTIONS.aslr_mode = True
OPTIONS.worker_threads = 3
OPTIONS.two_step = False
+OPTIONS.no_signing = False
def MostPopularKey(d, default):
"""Given a dict, return the key corresponding to the largest
@@ -968,6 +969,8 @@
OPTIONS.worker_threads = int(a)
elif o in ("-2", "--two_step"):
OPTIONS.two_step = True
+ elif o in ("--no_signing"):
+ OPTIONS.no_signing = True
else:
return False
return True
@@ -983,6 +986,7 @@
"worker_threads=",
"aslr_mode=",
"two_step",
+ "no_signing",
],
extra_option_handler=option_handler)
@@ -1017,9 +1021,12 @@
OPTIONS.device_specific = os.path.normpath(OPTIONS.device_specific)
print "using device-specific extensions in", OPTIONS.device_specific
- temp_zip_file = tempfile.NamedTemporaryFile()
- output_zip = zipfile.ZipFile(temp_zip_file, "w",
- compression=zipfile.ZIP_DEFLATED)
+ if OPTIONS.no_signing:
+ output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
+ else:
+ temp_zip_file = tempfile.NamedTemporaryFile()
+ output_zip = zipfile.ZipFile(temp_zip_file, "w",
+ compression=zipfile.ZIP_DEFLATED)
if OPTIONS.incremental_source is None:
WriteFullOTAPackage(input_zip, output_zip)
@@ -1043,8 +1050,9 @@
output_zip.close()
- SignOutput(temp_zip_file.name, args[1])
- temp_zip_file.close()
+ if not OPTIONS.no_signing:
+ SignOutput(temp_zip_file.name, args[1])
+ temp_zip_file.close()
common.Cleanup()
diff --git a/tools/releasetools/sign_target_files_apks b/tools/releasetools/sign_target_files_apks
index 00693b8..ab24706 100755
--- a/tools/releasetools/sign_target_files_apks
+++ b/tools/releasetools/sign_target_files_apks
@@ -235,8 +235,9 @@
elif key == "ro.build.display.id":
# change, eg, "JWR66N dev-keys" to "JWR66N"
value = value.split()
- if len(value) == 2 and value[1].endswith("-keys"):
- value = value[0]
+ if len(value) > 1 and value[-1].endswith("-keys"):
+ value.pop()
+ value = " ".join(value)
line = key + "=" + value
if line != original_line:
print " replace: ", original_line
diff --git a/tools/signapk/SignApk.java b/tools/signapk/SignApk.java
index 716ea3b..b247072 100644
--- a/tools/signapk/SignApk.java
+++ b/tools/signapk/SignApk.java
@@ -20,6 +20,7 @@
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.DEROutputStream;
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers;
+import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.cert.jcajce.JcaCertStore;
import org.bouncycastle.cms.CMSException;
import org.bouncycastle.cms.CMSProcessableByteArray;
@@ -35,7 +36,7 @@
import org.bouncycastle.util.encoders.Base64;
import java.io.BufferedReader;
-import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.File;
@@ -47,6 +48,7 @@
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
+import java.lang.reflect.Constructor;
import java.security.DigestOutputStream;
import java.security.GeneralSecurityException;
import java.security.Key;
@@ -59,11 +61,11 @@
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.security.spec.InvalidKeySpecException;
-import java.security.spec.KeySpec;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
import java.util.jar.Attributes;
@@ -83,9 +85,9 @@
* Prior to the keylimepie release, SignApk ignored the signature
* algorithm specified in the certificate and always used SHA1withRSA.
*
- * Starting with keylimepie, we support SHA256withRSA, and use the
- * signature algorithm in the certificate to select which to use
- * (SHA256withRSA or SHA1withRSA).
+ * Starting with JB-MR2, the platform supports SHA256withRSA, so we use
+ * the signature algorithm in the certificate to select which to use
+ * (SHA256withRSA or SHA1withRSA). Also in JB-MR2, EC keys are supported.
*
* Because there are old keys still in use whose certificate actually
* says "MD5withRSA", we treat these as though they say "SHA1withRSA"
@@ -95,15 +97,15 @@
/**
- * Command line tool to sign JAR files (including APKs and OTA
- * updates) in a way compatible with the mincrypt verifier, using RSA
- * keys and SHA1 or SHA-256.
+ * Command line tool to sign JAR files (including APKs and OTA updates) in a way
+ * compatible with the mincrypt verifier, using EC or RSA keys and SHA1 or
+ * SHA-256 (see historical note).
*/
class SignApk {
private static final String CERT_SF_NAME = "META-INF/CERT.SF";
- private static final String CERT_RSA_NAME = "META-INF/CERT.RSA";
+ private static final String CERT_SIG_NAME = "META-INF/CERT.%s";
private static final String CERT_SF_MULTI_NAME = "META-INF/CERT%d.SF";
- private static final String CERT_RSA_MULTI_NAME = "META-INF/CERT%d.RSA";
+ private static final String CERT_SIG_MULTI_NAME = "META-INF/CERT%d.%s";
private static final String OTACERT_NAME = "META-INF/com/android/otacert";
@@ -117,12 +119,12 @@
* Return one of USE_SHA1 or USE_SHA256 according to the signature
* algorithm specified in the cert.
*/
- private static int getAlgorithm(X509Certificate cert) {
- String sigAlg = cert.getSigAlgName();
- if ("SHA1withRSA".equals(sigAlg) ||
- "MD5withRSA".equals(sigAlg)) { // see "HISTORICAL NOTE" above.
+ private static int getDigestAlgorithm(X509Certificate cert) {
+ String sigAlg = cert.getSigAlgName().toUpperCase(Locale.US);
+ if ("SHA1WITHRSA".equals(sigAlg) ||
+ "MD5WITHRSA".equals(sigAlg)) { // see "HISTORICAL NOTE" above.
return USE_SHA1;
- } else if ("SHA256withRSA".equals(sigAlg)) {
+ } else if (sigAlg.startsWith("SHA256WITH")) {
return USE_SHA256;
} else {
throw new IllegalArgumentException("unsupported signature algorithm \"" + sigAlg +
@@ -130,9 +132,26 @@
}
}
+ /** Returns the expected signature algorithm for this key type. */
+ private static String getSignatureAlgorithm(X509Certificate cert) {
+ String sigAlg = cert.getSigAlgName().toUpperCase(Locale.US);
+ String keyType = cert.getPublicKey().getAlgorithm().toUpperCase(Locale.US);
+ if ("RSA".equalsIgnoreCase(keyType)) {
+ if (getDigestAlgorithm(cert) == USE_SHA256) {
+ return "SHA256withRSA";
+ } else {
+ return "SHA1withRSA";
+ }
+ } else if ("EC".equalsIgnoreCase(keyType)) {
+ return "SHA256withECDSA";
+ } else {
+ throw new IllegalArgumentException("unsupported key type: " + keyType);
+ }
+ }
+
// Files matching this pattern are not copied to the output.
private static Pattern stripPattern =
- Pattern.compile("^(META-INF/((.*)[.](SF|RSA|DSA)|com/android/otacert))|(" +
+ Pattern.compile("^(META-INF/((.*)[.](SF|RSA|DSA|EC)|com/android/otacert))|(" +
Pattern.quote(JarFile.MANIFEST_NAME) + ")$");
private static X509Certificate readPublicKey(File file)
@@ -164,7 +183,7 @@
}
/**
- * Decrypt an encrypted PKCS 8 format private key.
+ * Decrypt an encrypted PKCS#8 format private key.
*
* Based on ghstark's post on Aug 6, 2006 at
* http://forums.sun.com/thread.jspa?threadID=758133&messageID=4330949
@@ -172,7 +191,7 @@
* @param encryptedPrivateKey The raw data of the private key
* @param keyFile The file containing the private key
*/
- private static KeySpec decryptPrivateKey(byte[] encryptedPrivateKey, File keyFile)
+ private static PKCS8EncodedKeySpec decryptPrivateKey(byte[] encryptedPrivateKey, File keyFile)
throws GeneralSecurityException {
EncryptedPrivateKeyInfo epkInfo;
try {
@@ -198,7 +217,7 @@
}
}
- /** Read a PKCS 8 format private key. */
+ /** Read a PKCS#8 format private key. */
private static PrivateKey readPrivateKey(File file)
throws IOException, GeneralSecurityException {
DataInputStream input = new DataInputStream(new FileInputStream(file));
@@ -206,16 +225,21 @@
byte[] bytes = new byte[(int) file.length()];
input.read(bytes);
- KeySpec spec = decryptPrivateKey(bytes, file);
+ /* Check to see if this is in an EncryptedPrivateKeyInfo structure. */
+ PKCS8EncodedKeySpec spec = decryptPrivateKey(bytes, file);
if (spec == null) {
spec = new PKCS8EncodedKeySpec(bytes);
}
- try {
- return KeyFactory.getInstance("RSA").generatePrivate(spec);
- } catch (InvalidKeySpecException ex) {
- return KeyFactory.getInstance("DSA").generatePrivate(spec);
- }
+ /*
+ * Now it's in a PKCS#8 PrivateKeyInfo structure. Read its Algorithm
+ * OID and use that to construct a KeyFactory.
+ */
+ ASN1InputStream bIn = new ASN1InputStream(new ByteArrayInputStream(spec.getEncoded()));
+ PrivateKeyInfo pki = PrivateKeyInfo.getInstance(bIn.readObject());
+ String algOid = pki.getPrivateKeyAlgorithm().getAlgorithm().getId();
+
+ return KeyFactory.getInstance(algOid).generatePrivate(spec);
} finally {
input.close();
}
@@ -413,8 +437,7 @@
JcaCertStore certs = new JcaCertStore(certList);
CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
- ContentSigner signer = new JcaContentSignerBuilder(
- getAlgorithm(publicKey) == USE_SHA256 ? "SHA256withRSA" : "SHA1withRSA")
+ ContentSigner signer = new JcaContentSignerBuilder(getSignatureAlgorithm(publicKey))
.setProvider(sBouncyCastleProvider)
.build(privateKey);
gen.addSignerInfoGenerator(
@@ -560,7 +583,7 @@
signer = new WholeFileSignerOutputStream(out, outputStream);
JarOutputStream outputJar = new JarOutputStream(signer);
- int hash = getAlgorithm(publicKey);
+ int hash = getDigestAlgorithm(publicKey);
// Assume the certificate is valid for at least an hour.
long timestamp = publicKey.getNotBefore().getTime() + 3600L * 1000;
@@ -685,13 +708,15 @@
je.setTime(timestamp);
outputJar.putNextEntry(je);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- writeSignatureFile(manifest, baos, getAlgorithm(publicKey[k]));
+ writeSignatureFile(manifest, baos, getDigestAlgorithm(publicKey[k]));
byte[] signedData = baos.toByteArray();
outputJar.write(signedData);
- // CERT.RSA / CERT#.RSA
- je = new JarEntry(numKeys == 1 ? CERT_RSA_NAME :
- (String.format(CERT_RSA_MULTI_NAME, k)));
+ // CERT.{EC,RSA} / CERT#.{EC,RSA}
+ final String keyType = publicKey[k].getPublicKey().getAlgorithm();
+ je = new JarEntry(numKeys == 1 ?
+ (String.format(CERT_SIG_NAME, keyType)) :
+ (String.format(CERT_SIG_MULTI_NAME, k, keyType)));
je.setTime(timestamp);
outputJar.putNextEntry(je);
writeSignatureBlock(new CMSProcessableByteArray(signedData),
@@ -699,8 +724,61 @@
}
}
+ /**
+ * Tries to load a JSE Provider by class name. This is for custom PrivateKey
+ * types that might be stored in PKCS#11-like storage.
+ */
+ private static void loadProviderIfNecessary(String providerClassName) {
+ if (providerClassName == null) {
+ return;
+ }
+
+ final Class<?> klass;
+ try {
+ final ClassLoader sysLoader = ClassLoader.getSystemClassLoader();
+ if (sysLoader != null) {
+ klass = sysLoader.loadClass(providerClassName);
+ } else {
+ klass = Class.forName(providerClassName);
+ }
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ System.exit(1);
+ return;
+ }
+
+ Constructor<?> constructor = null;
+ for (Constructor<?> c : klass.getConstructors()) {
+ if (c.getParameterTypes().length == 0) {
+ constructor = c;
+ break;
+ }
+ }
+ if (constructor == null) {
+ System.err.println("No zero-arg constructor found for " + providerClassName);
+ System.exit(1);
+ return;
+ }
+
+ final Object o;
+ try {
+ o = constructor.newInstance();
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ return;
+ }
+ if (!(o instanceof Provider)) {
+ System.err.println("Not a Provider class: " + providerClassName);
+ System.exit(1);
+ }
+
+ Security.insertProviderAt((Provider) o, 1);
+ }
+
private static void usage() {
System.err.println("Usage: signapk [-w] " +
+ "[-providerClass <className>] " +
"publickey.x509[.pem] privatekey.pk8 " +
"[publickey2.x509[.pem] privatekey2.pk8 ...] " +
"input.jar output.jar");
@@ -714,10 +792,23 @@
Security.addProvider(sBouncyCastleProvider);
boolean signWholeFile = false;
+ String providerClass = null;
+ String providerArg = null;
+
int argstart = 0;
- if (args[0].equals("-w")) {
- signWholeFile = true;
- argstart = 1;
+ while (argstart < args.length && args[argstart].startsWith("-")) {
+ if ("-w".equals(args[argstart])) {
+ signWholeFile = true;
+ ++argstart;
+ } else if ("-providerClass".equals(args[argstart])) {
+ if (argstart + 1 >= args.length) {
+ usage();
+ }
+ providerClass = args[++argstart];
+ ++argstart;
+ } else {
+ usage();
+ }
}
if ((args.length - argstart) % 2 == 1) usage();
@@ -727,6 +818,8 @@
System.exit(2);
}
+ loadProviderIfNecessary(providerClass);
+
String inputFilename = args[args.length-2];
String outputFilename = args[args.length-1];
@@ -742,7 +835,7 @@
for (int i = 0; i < numKeys; ++i) {
int argNum = argstart + i*2;
publicKey[i] = readPublicKey(new File(args[argNum]));
- hashes |= getAlgorithm(publicKey[i]);
+ hashes |= getDigestAlgorithm(publicKey[i]);
}
} catch (IllegalArgumentException e) {
System.err.println(e);