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 | |
| 9 | include $(BUILD_SYSTEM)/multilib.mk |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 10 | |
Ying Wang | 14a6cbd | 2014-02-10 22:26:23 -0800 | [diff] [blame] | 11 | ifeq ($(TARGET_PREFER_32_BIT),true) |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame^] | 12 | ifeq (,$(filter $(my_module_multilib),first both) |
| 13 | # if TARGET_PREFER_32_BIT is not explicitly set to "first" or "both" |
| 14 | # build only for secondary |
| 15 | my_module_multilib := 32 |
Ying Wang | 14a6cbd | 2014-02-10 22:26:23 -0800 | [diff] [blame] | 16 | endif |
| 17 | endif |
| 18 | |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame^] | 19 | ifndef my_module_multilib |
| 20 | # executables default to building for the first architecture |
| 21 | my_module_multilib := first |
| 22 | endif |
| 23 | |
| 24 | ifeq ($(my_module_multilib),both) |
| 25 | ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),) |
| 26 | $(error $(LOCAL_PATH): LOCAL_MODULE_STEM_32 or LOCAL_MODULE_PATH_32 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE)) |
| 27 | endif |
| 28 | ifeq ($(LOCAL_MODULE_PATH_64)$(LOCAL_MODULE_STEM_64),) |
| 29 | $(error $(LOCAL_PATH): LOCAL_MODULE_STEM_64 or LOCAL_MODULE_PATH_64 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE)) |
| 30 | endif |
| 31 | else #!LOCAL_MULTILIB == both |
Colin Cross | aee1e77 | 2014-02-04 11:16:16 -0800 | [diff] [blame] | 32 | LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame^] | 33 | endif |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 34 | |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame^] | 35 | my_skip_secondary_arch := |
| 36 | |
| 37 | # check if first arch is supported |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 38 | include $(BUILD_SYSTEM)/module_arch_supported.mk |
| 39 | ifeq ($(my_module_arch_supported),true) |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame^] | 40 | # first arch is supported |
Ying Wang | dd814bf | 2014-01-17 16:17:28 -0800 | [diff] [blame] | 41 | include $(BUILD_SYSTEM)/executable_internal.mk |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame^] | 42 | ifneq ($(my_module_multilib),both) |
| 43 | my_skip_secondary_arch := true |
| 44 | endif |
| 45 | endif |
| 46 | |
| 47 | # check if first arch was not supported or asked to build both |
| 48 | ifndef my_skip_secondary_arch |
| 49 | ifdef TARGET_2ND_ARCH |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 50 | # check if secondary arch is supported |
| 51 | LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) |
| 52 | include $(BUILD_SYSTEM)/module_arch_supported.mk |
| 53 | ifeq ($(my_module_arch_supported),true) |
| 54 | # secondary arch is supported |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame^] | 55 | OVERRIDE_BUILT_MODULE_PATH := |
| 56 | LOCAL_BUILT_MODULE := |
| 57 | LOCAL_INSTALLED_MODULE := |
| 58 | LOCAL_MODULE_STEM := |
| 59 | LOCAL_BUILT_MODULE_STEM := |
| 60 | LOCAL_INSTALLED_MODULE_STEM := |
| 61 | LOCAL_INTERMEDIATE_TARGETS := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 62 | include $(BUILD_SYSTEM)/executable_internal.mk |
| 63 | endif |
| 64 | endif # TARGET_2ND_ARCH |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame^] | 65 | endif # !my_skip_secondary_arch || LOCAL_MULTILIB |
Ying Wang | dd814bf | 2014-01-17 16:17:28 -0800 | [diff] [blame] | 66 | LOCAL_2ND_ARCH_VAR_PREFIX := |
Colin Cross | aee1e77 | 2014-02-04 11:16:16 -0800 | [diff] [blame] | 67 | LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 68 | |
| 69 | my_module_arch_supported := |