Ying Wang | dd814bf | 2014-01-17 16:17:28 -0800 | [diff] [blame] | 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. |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 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 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 9 | my_prefix := TARGET_ |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 10 | include $(BUILD_SYSTEM)/multilib.mk |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 11 | |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 12 | ifeq ($(my_module_multilib),both) |
| 13 | ifeq ($(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)) |
| 15 | endif |
| 16 | ifeq ($(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)) |
| 18 | endif |
| 19 | else #!LOCAL_MULTILIB == both |
Colin Cross | aee1e77 | 2014-02-04 11:16:16 -0800 | [diff] [blame] | 20 | LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 21 | endif |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 22 | |
Colin Cross | a3339e9 | 2014-04-30 18:09:13 -0700 | [diff] [blame] | 23 | # if TARGET_PREFER_32_BIT_EXECUTABLES is set, try to build 32-bit first |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 24 | ifdef TARGET_2ND_ARCH |
Colin Cross | a3339e9 | 2014-04-30 18:09:13 -0700 | [diff] [blame] | 25 | ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 26 | LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) |
| 27 | else |
| 28 | LOCAL_2ND_ARCH_VAR_PREFIX := |
| 29 | endif |
| 30 | endif |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 31 | |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 32 | my_skip_non_preferred_arch := |
| 33 | |
| 34 | # check if preferred arch is supported |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 35 | include $(BUILD_SYSTEM)/module_arch_supported.mk |
| 36 | ifeq ($(my_module_arch_supported),true) |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 37 | # first arch is supported |
Ying Wang | dd814bf | 2014-01-17 16:17:28 -0800 | [diff] [blame] | 38 | include $(BUILD_SYSTEM)/executable_internal.mk |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 39 | ifneq ($(my_module_multilib),both) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 40 | my_skip_non_preferred_arch := true |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 41 | endif |
| 42 | endif |
| 43 | |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 44 | # check if preferred arch was not supported or asked to build both |
| 45 | ifndef my_skip_non_preferred_arch |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 46 | ifdef TARGET_2ND_ARCH |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 47 | |
| 48 | # check if the non-preferred arch is the primary or secondary |
Colin Cross | a3339e9 | 2014-04-30 18:09:13 -0700 | [diff] [blame] | 49 | ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 50 | LOCAL_2ND_ARCH_VAR_PREFIX := |
| 51 | else |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 52 | LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 53 | endif |
| 54 | |
| 55 | # check if non-preferred arch is supported |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 56 | include $(BUILD_SYSTEM)/module_arch_supported.mk |
| 57 | ifeq ($(my_module_arch_supported),true) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 58 | # non-preferred arch is supported |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 59 | OVERRIDE_BUILT_MODULE_PATH := |
| 60 | LOCAL_BUILT_MODULE := |
| 61 | LOCAL_INSTALLED_MODULE := |
| 62 | LOCAL_MODULE_STEM := |
| 63 | LOCAL_BUILT_MODULE_STEM := |
| 64 | LOCAL_INSTALLED_MODULE_STEM := |
| 65 | LOCAL_INTERMEDIATE_TARGETS := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 66 | include $(BUILD_SYSTEM)/executable_internal.mk |
| 67 | endif |
| 68 | endif # TARGET_2ND_ARCH |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 69 | endif # !my_skip_non_preferred_arch || LOCAL_MULTILIB |
Ying Wang | dd814bf | 2014-01-17 16:17:28 -0800 | [diff] [blame] | 70 | LOCAL_2ND_ARCH_VAR_PREFIX := |
Colin Cross | aee1e77 | 2014-02-04 11:16:16 -0800 | [diff] [blame] | 71 | LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 72 | |
| 73 | my_module_arch_supported := |