Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 1 | # We don't automatically set up rules to build packages for both |
| 2 | # TARGET_ARCH and TARGET_2ND_ARCH. |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 3 | # To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_MULTILIB := 32". |
| 4 | |
Ying Wang | 87538e4 | 2016-03-16 19:53:19 -0700 | [diff] [blame] | 5 | ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true) |
| 6 | LOCAL_MULTILIB := first |
| 7 | endif |
| 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 |
| 11 | |
Colin Cross | 1750944 | 2014-04-10 11:29:05 -0700 | [diff] [blame] | 12 | ifeq ($(TARGET_SUPPORTS_32_BIT_APPS)|$(TARGET_SUPPORTS_64_BIT_APPS),true|true) |
| 13 | # packages default to building for either architecture, |
| 14 | # the preferred if its supported, otherwise the non-preferred. |
| 15 | else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true) |
| 16 | # only 64-bit apps supported |
| 17 | ifeq ($(filter $(my_module_multilib),64 both first),$(my_module_multilib)) |
| 18 | # if my_module_multilib was 64, both, first, or unset, build for 64-bit |
| 19 | my_module_multilib := 64 |
| 20 | else |
| 21 | # otherwise don't build this app |
| 22 | my_module_multilib := none |
| 23 | endif |
| 24 | else |
| 25 | # only 32-bit apps supported |
| 26 | ifeq ($(filter $(my_module_multilib),32 both),$(my_module_multilib)) |
| 27 | # if my_module_multilib was 32, both, or unset, build for 32-bit |
| 28 | my_module_multilib := 32 |
| 29 | else ifeq ($(my_module_multilib),first) |
| 30 | ifndef TARGET_IS_64_BIT |
| 31 | # if my_module_multilib was first and this is a 32-bit build, build for |
| 32 | # 32-bit |
| 33 | my_module_multilib := 32 |
| 34 | else |
| 35 | # if my_module_multilib was first and this is a 64-bit build, don't build |
| 36 | # this app |
| 37 | my_module_multilib := none |
| 38 | endif |
| 39 | else |
| 40 | # my_module_mulitlib was 64 or none, don't build this app |
| 41 | my_module_multilib := none |
| 42 | endif |
| 43 | endif |
| 44 | |
Colin Cross | 58d879f | 2014-02-04 11:16:16 -0800 | [diff] [blame] | 45 | LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true |
| 46 | |
Colin Cross | a3339e9 | 2014-04-30 18:09:13 -0700 | [diff] [blame] | 47 | # if TARGET_PREFER_32_BIT_APPS is set, try to build 32-bit first |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 48 | ifdef TARGET_2ND_ARCH |
Colin Cross | a3339e9 | 2014-04-30 18:09:13 -0700 | [diff] [blame] | 49 | ifeq ($(TARGET_PREFER_32_BIT_APPS),true) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 50 | LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) |
| 51 | else |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 52 | LOCAL_2ND_ARCH_VAR_PREFIX := |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 53 | endif |
| 54 | endif |
| 55 | |
| 56 | # check if preferred arch is supported |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 57 | include $(BUILD_SYSTEM)/module_arch_supported.mk |
| 58 | ifeq ($(my_module_arch_supported),true) |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 59 | # first arch is supported |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 60 | include $(BUILD_SYSTEM)/package_internal.mk |
| 61 | else ifneq (,$(TARGET_2ND_ARCH)) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 62 | # check if the non-preferred arch is the primary or secondary |
Colin Cross | a3339e9 | 2014-04-30 18:09:13 -0700 | [diff] [blame] | 63 | ifeq ($(TARGET_PREFER_32_BIT_APPS),true) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 64 | LOCAL_2ND_ARCH_VAR_PREFIX := |
| 65 | else |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 66 | LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 67 | endif |
| 68 | |
| 69 | # check if non-preferred arch is supported |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 70 | include $(BUILD_SYSTEM)/module_arch_supported.mk |
| 71 | ifeq ($(my_module_arch_supported),true) |
| 72 | # secondary arch is supported |
| 73 | include $(BUILD_SYSTEM)/package_internal.mk |
Joe Onorato | 899e62a | 2010-02-04 17:37:21 -0800 | [diff] [blame] | 74 | endif |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 75 | endif # TARGET_2ND_ARCH |
Colin Cross | 58d879f | 2014-02-04 11:16:16 -0800 | [diff] [blame] | 76 | |
Colin Cross | 2343cfb | 2014-01-24 13:33:39 -0800 | [diff] [blame] | 77 | LOCAL_2ND_ARCH_VAR_PREFIX := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 78 | LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := |
| 79 | |
| 80 | my_module_arch_supported := |