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 | |
Evgenii Stepanov | 3632cc3 | 2015-06-11 13:57:10 -0700 | [diff] [blame] | 9 | my_skip_this_target := |
Ivan Krasin | 74b32b8 | 2015-09-18 11:54:43 -0700 | [diff] [blame] | 10 | ifneq ($(filter address,$(SANITIZE_TARGET)),) |
Evgenii Stepanov | 3632cc3 | 2015-06-11 13:57:10 -0700 | [diff] [blame] | 11 | ifeq (true,$(LOCAL_FORCE_STATIC_EXECUTABLE)) |
| 12 | my_skip_this_target := true |
| 13 | else ifeq (false, $(LOCAL_CLANG)) |
| 14 | my_skip_this_target := true |
| 15 | endif |
| 16 | endif |
| 17 | |
| 18 | ifneq (true,$(my_skip_this_target)) |
Dan Willemsen | 1684b32 | 2016-07-25 16:03:53 -0700 | [diff] [blame] | 19 | $(call record-module-type,EXECUTABLE) |
Evgenii Stepanov | 3632cc3 | 2015-06-11 13:57:10 -0700 | [diff] [blame] | 20 | |
Ying Wang | 87538e4 | 2016-03-16 19:53:19 -0700 | [diff] [blame] | 21 | ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true) |
Ying Wang | 6263022 | 2016-04-20 11:53:39 -0700 | [diff] [blame] | 22 | # If a native test explicity specifies to build only for the translation arch, |
| 23 | # we'll still need LOCAL_MULTILIB=both and let module_arch_supported.mk choose |
| 24 | # to build only for TARGET_2ND_ARCH. |
| 25 | ifneq (1,$(words $(LOCAL_MODULE_TARGET_ARCH))) |
Ying Wang | 87538e4 | 2016-03-16 19:53:19 -0700 | [diff] [blame] | 26 | LOCAL_MULTILIB := first |
| 27 | endif |
Ying Wang | 6263022 | 2016-04-20 11:53:39 -0700 | [diff] [blame] | 28 | endif |
Ying Wang | 87538e4 | 2016-03-16 19:53:19 -0700 | [diff] [blame] | 29 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 30 | my_prefix := TARGET_ |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 31 | include $(BUILD_SYSTEM)/multilib.mk |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 32 | |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 33 | ifeq ($(my_module_multilib),both) |
Dan Willemsen | 7fe992c | 2016-03-02 13:54:51 -0800 | [diff] [blame] | 34 | ifneq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS) |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 35 | ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),) |
| 36 | $(error $(LOCAL_PATH): LOCAL_MODULE_STEM_32 or LOCAL_MODULE_PATH_32 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE)) |
| 37 | endif |
| 38 | ifeq ($(LOCAL_MODULE_PATH_64)$(LOCAL_MODULE_STEM_64),) |
| 39 | $(error $(LOCAL_PATH): LOCAL_MODULE_STEM_64 or LOCAL_MODULE_PATH_64 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE)) |
| 40 | endif |
Dan Willemsen | 7fe992c | 2016-03-02 13:54:51 -0800 | [diff] [blame] | 41 | endif |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 42 | else #!LOCAL_MULTILIB == both |
Colin Cross | aee1e77 | 2014-02-04 11:16:16 -0800 | [diff] [blame] | 43 | LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 44 | endif |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 45 | |
Colin Cross | a3339e9 | 2014-04-30 18:09:13 -0700 | [diff] [blame] | 46 | # 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] | 47 | ifdef TARGET_2ND_ARCH |
Colin Cross | a3339e9 | 2014-04-30 18:09:13 -0700 | [diff] [blame] | 48 | ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 49 | LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) |
| 50 | else |
| 51 | LOCAL_2ND_ARCH_VAR_PREFIX := |
| 52 | endif |
| 53 | endif |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 54 | |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 55 | my_skip_non_preferred_arch := |
| 56 | |
| 57 | # check if preferred arch is supported |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 58 | include $(BUILD_SYSTEM)/module_arch_supported.mk |
| 59 | ifeq ($(my_module_arch_supported),true) |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 60 | # first arch is supported |
Ying Wang | dd814bf | 2014-01-17 16:17:28 -0800 | [diff] [blame] | 61 | include $(BUILD_SYSTEM)/executable_internal.mk |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 62 | ifneq ($(my_module_multilib),both) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 63 | my_skip_non_preferred_arch := true |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 64 | endif |
| 65 | endif |
| 66 | |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 67 | # check if preferred arch was not supported or asked to build both |
| 68 | ifndef my_skip_non_preferred_arch |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 69 | ifdef TARGET_2ND_ARCH |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 70 | |
| 71 | # check if the non-preferred arch is the primary or secondary |
Colin Cross | a3339e9 | 2014-04-30 18:09:13 -0700 | [diff] [blame] | 72 | ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 73 | LOCAL_2ND_ARCH_VAR_PREFIX := |
| 74 | else |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 75 | LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 76 | endif |
| 77 | |
| 78 | # check if non-preferred arch is supported |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 79 | include $(BUILD_SYSTEM)/module_arch_supported.mk |
| 80 | ifeq ($(my_module_arch_supported),true) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 81 | # non-preferred arch is supported |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 82 | OVERRIDE_BUILT_MODULE_PATH := |
| 83 | LOCAL_BUILT_MODULE := |
| 84 | LOCAL_INSTALLED_MODULE := |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 85 | LOCAL_INTERMEDIATE_TARGETS := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 86 | include $(BUILD_SYSTEM)/executable_internal.mk |
| 87 | endif |
| 88 | endif # TARGET_2ND_ARCH |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 89 | endif # !my_skip_non_preferred_arch || LOCAL_MULTILIB |
Ying Wang | dd814bf | 2014-01-17 16:17:28 -0800 | [diff] [blame] | 90 | LOCAL_2ND_ARCH_VAR_PREFIX := |
Colin Cross | aee1e77 | 2014-02-04 11:16:16 -0800 | [diff] [blame] | 91 | LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 92 | |
| 93 | my_module_arch_supported := |
Evgenii Stepanov | 3632cc3 | 2015-06-11 13:57:10 -0700 | [diff] [blame] | 94 | |
| 95 | endif |