From 87974056d901acb61c9c6d67fc99f5fad36a5730 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 21 Mar 2014 12:25:44 -0700 Subject: [PATCH 1/2] add support for LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 Some executables will need to be built for both 32-bit and 64-bit. For tests, it will be convienient to keep the name of the executable the same, but install them in a different location. Add LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 to allow a module to specify different paths for 32-bit and 64-bit executables. Change-Id: I3be830e899c6d485fe55c25c66b20b3fe64c795e --- core/base_rules.mk | 13 +++++++++++++ core/binary.mk | 2 -- core/clear_vars.mk | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/core/base_rules.mk b/core/base_rules.mk index 32e6b734c8..051addcb2a 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -99,8 +99,21 @@ ifneq ($(words $(LOCAL_MODULE_CLASS)),1) $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must contain exactly one word, not "$(LOCAL_MODULE_CLASS)") endif +ifndef LOCAL_IS_HOST_MODULE +my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_IS_64_BIT),64,32) +endif + ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE)) +ifndef LOCAL_IS_HOST_MODULE +my_multilib_module_path := $(strip $(LOCAL_MODULE_PATH_$(my_32_64_bit_suffix))) +else +my_multilib_module_path := +endif +ifdef my_multilib_module_path +my_module_path := $(my_multilib_module_path) +else my_module_path := $(strip $(LOCAL_MODULE_PATH)) +endif my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH)) ifeq ($(my_module_path),) ifdef LOCAL_IS_HOST_MODULE diff --git a/core/binary.mk b/core/binary.mk index 50111294c5..cc8de4638a 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -106,8 +106,6 @@ my_c_includes := $(LOCAL_C_INCLUDES) my_generated_sources := $(LOCAL_GENERATED_SOURCES) ifndef LOCAL_IS_HOST_MODULE -my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_IS_64_BIT),64,32) - my_src_files += $(LOCAL_SRC_FILES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(my_32_64_bit_suffix)) my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SHARED_LIBRARIES_$(my_32_64_bit_suffix)) my_cflags += $(LOCAL_CFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix)) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 4c403b4501..5aa228fbf4 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -197,6 +197,8 @@ LOCAL_ASFLAGS_32:= LOCAL_ASFLAGS_64:= LOCAL_C_INCLUDES_32:= LOCAL_C_INCLUDES_64:= +LOCAL_MODULE_PATH_32:= +LOCAL_MODULE_PATH_64:= # Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to # iterate over thousands of entries every time. From 5a9db90e408e8d5c2079c8ec79a3e9896d3c02f4 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 21 Mar 2014 12:27:37 -0700 Subject: [PATCH 2/2] add support for LOCAL_MODULE_STEM_32 and LOCAL_MODULE_STEM_64 Some executables will need to be built for both 32-bit and 64-bit. For linker/linker64, debuggerd/debuggerd64, and a few more, they will be installed in the same path (/system/bin), but with different filenames. Allow the module to specify LOCAL_MODULE_STEM_32 and LOCAL_MODULE_STEM_64 to name the two versions. Change-Id: I573e8678c7332245a064f31246be0a05f0a9e25f --- core/base_rules.mk | 12 +----------- core/clear_vars.mk | 2 ++ core/configure_module_stem.mk | 16 ++++++++++++++++ core/dynamic_binary.mk | 17 +++-------------- core/shared_library_internal.mk | 2 +- 5 files changed, 23 insertions(+), 26 deletions(-) create mode 100644 core/configure_module_stem.mk diff --git a/core/base_rules.mk b/core/base_rules.mk index 051addcb2a..43f351ada7 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -167,17 +167,7 @@ generated_sources_dir := $(call local-generated-sources-dir) ########################################################### # Pick a name for the intermediate and final targets ########################################################### -ifndef LOCAL_MODULE_STEM - LOCAL_MODULE_STEM := $(LOCAL_MODULE) -endif - -ifndef LOCAL_BUILT_MODULE_STEM - LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX) -endif - -ifndef LOCAL_INSTALLED_MODULE_STEM - LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX) -endif +include $(BUILD_SYSTEM)/configure_module_stem.mk # OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the # internal SHARED_LIBRARIES build files. diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 5aa228fbf4..8129014dcb 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -199,6 +199,8 @@ LOCAL_C_INCLUDES_32:= LOCAL_C_INCLUDES_64:= LOCAL_MODULE_PATH_32:= LOCAL_MODULE_PATH_64:= +LOCAL_MODULE_STEM_32:= +LOCAL_MODULE_STEM_64:= # Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to # iterate over thousands of entries every time. diff --git a/core/configure_module_stem.mk b/core/configure_module_stem.mk new file mode 100644 index 0000000000..2823e3758d --- /dev/null +++ b/core/configure_module_stem.mk @@ -0,0 +1,16 @@ +my_multilib_stem := $(LOCAL_MODULE_STEM_$(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_IS_64_BIT),64,32)) +ifdef my_multilib_stem +LOCAL_MODULE_STEM := $(my_multilib_stem) +endif + +ifndef LOCAL_MODULE_STEM + LOCAL_MODULE_STEM := $(LOCAL_MODULE) +endif + +ifndef LOCAL_BUILT_MODULE_STEM + LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX) +endif + +ifndef LOCAL_INSTALLED_MODULE_STEM + LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX) +endif diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk index 32f2c91067..b3ca4fcbd5 100644 --- a/core/dynamic_binary.mk +++ b/core/dynamic_binary.mk @@ -13,20 +13,9 @@ $(error This file should not be used to build host binaries. Included by (or ne 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. -# Consolidate the duplicates. -ifndef LOCAL_MODULE_STEM - LOCAL_MODULE_STEM := $(LOCAL_MODULE) -endif - -ifndef LOCAL_BUILT_MODULE_STEM - LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX) -endif - -ifndef LOCAL_INSTALLED_MODULE_STEM - LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX) -endif +# This duplicates logic from base_rules.mk because we need to +# know its results before base_rules.mk is included. +include $(BUILD_SYSTEM)/configure_module_stem.mk # base_rules.make defines $(intermediates), but we need its value # before we include base_rules. Make a guess, and verify that diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk index b5ac32ad45..3090d3684c 100644 --- a/core/shared_library_internal.mk +++ b/core/shared_library_internal.mk @@ -16,7 +16,7 @@ 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)),) +ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)$(LOCAL_MODULE_STEM_32)$(LOCAL_MODULE_STEM_64)),) $(error $(LOCAL_PATH): Cannot set module stem for a library) endif