1# We don't automatically set up rules to build executables for both 2# TARGET_ARCH and TARGET_2ND_ARCH. 3# By default, an executable is built for TARGET_ARCH. 4# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_MULTILIB := 32" 5# To build it for both set LOCAL_MULTILIB := both and specify 6# LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 or LOCAL_MODULE_STEM_32 and 7# LOCAL_MODULE_STEM_64 8 9my_prefix := TARGET_ 10include $(BUILD_SYSTEM)/multilib.mk 11 12ifeq ($(my_module_multilib),both) 13ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),) 14$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_32 or LOCAL_MODULE_PATH_32 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE)) 15endif 16ifeq ($(LOCAL_MODULE_PATH_64)$(LOCAL_MODULE_STEM_64),) 17$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_64 or LOCAL_MODULE_PATH_64 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE)) 18endif 19else #!LOCAL_MULTILIB == both 20LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true 21endif 22 23# if TARGET_PREFER_32_BIT_EXECUTABLES is set, try to build 32-bit first 24ifdef TARGET_2ND_ARCH 25ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true) 26LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) 27else 28LOCAL_2ND_ARCH_VAR_PREFIX := 29endif 30endif 31 32my_skip_non_preferred_arch := 33 34# check if preferred arch is supported 35include $(BUILD_SYSTEM)/module_arch_supported.mk 36ifeq ($(my_module_arch_supported),true) 37# first arch is supported 38include $(BUILD_SYSTEM)/executable_internal.mk 39ifneq ($(my_module_multilib),both) 40my_skip_non_preferred_arch := true 41endif 42endif 43 44# check if preferred arch was not supported or asked to build both 45ifndef my_skip_non_preferred_arch 46ifdef TARGET_2ND_ARCH 47 48# check if the non-preferred arch is the primary or secondary 49ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true) 50LOCAL_2ND_ARCH_VAR_PREFIX := 51else 52LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) 53endif 54 55# check if non-preferred arch is supported 56include $(BUILD_SYSTEM)/module_arch_supported.mk 57ifeq ($(my_module_arch_supported),true) 58# non-preferred arch is supported 59OVERRIDE_BUILT_MODULE_PATH := 60LOCAL_BUILT_MODULE := 61LOCAL_INSTALLED_MODULE := 62LOCAL_MODULE_STEM := 63LOCAL_BUILT_MODULE_STEM := 64LOCAL_INSTALLED_MODULE_STEM := 65LOCAL_INTERMEDIATE_TARGETS := 66include $(BUILD_SYSTEM)/executable_internal.mk 67endif 68endif # TARGET_2ND_ARCH 69endif # !my_skip_non_preferred_arch || LOCAL_MULTILIB 70LOCAL_2ND_ARCH_VAR_PREFIX := 71LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := 72 73my_module_arch_supported := 74