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 | |
Dan Willemsen | 3bf15e7 | 2016-07-25 16:03:53 -0700 | [diff] [blame] | 5 | $(call record-module-type,PACKAGE) |
| 6 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 7 | my_prefix := TARGET_ |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 8 | include $(BUILD_SYSTEM)/multilib.mk |
| 9 | |
Dan Willemsen | 2e3c3cf | 2017-04-20 10:59:06 -0700 | [diff] [blame] | 10 | ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true) |
Anton Hansson | 133fcb2 | 2018-06-28 13:31:02 +0100 | [diff] [blame] | 11 | ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true) |
| 12 | my_module_multilib := first |
| 13 | else ifneq ($(my_module_multilib),64) |
Dan Willemsen | 2e3c3cf | 2017-04-20 10:59:06 -0700 | [diff] [blame] | 14 | my_module_multilib := first |
| 15 | endif |
| 16 | endif |
| 17 | |
Colin Cross | 1750944 | 2014-04-10 11:29:05 -0700 | [diff] [blame] | 18 | ifeq ($(TARGET_SUPPORTS_32_BIT_APPS)|$(TARGET_SUPPORTS_64_BIT_APPS),true|true) |
| 19 | # packages default to building for either architecture, |
| 20 | # the preferred if its supported, otherwise the non-preferred. |
| 21 | else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true) |
| 22 | # only 64-bit apps supported |
| 23 | ifeq ($(filter $(my_module_multilib),64 both first),$(my_module_multilib)) |
| 24 | # if my_module_multilib was 64, both, first, or unset, build for 64-bit |
| 25 | my_module_multilib := 64 |
| 26 | else |
| 27 | # otherwise don't build this app |
| 28 | my_module_multilib := none |
| 29 | endif |
| 30 | else |
| 31 | # only 32-bit apps supported |
| 32 | ifeq ($(filter $(my_module_multilib),32 both),$(my_module_multilib)) |
| 33 | # if my_module_multilib was 32, both, or unset, build for 32-bit |
| 34 | my_module_multilib := 32 |
| 35 | else ifeq ($(my_module_multilib),first) |
| 36 | ifndef TARGET_IS_64_BIT |
| 37 | # if my_module_multilib was first and this is a 32-bit build, build for |
| 38 | # 32-bit |
| 39 | my_module_multilib := 32 |
| 40 | else |
| 41 | # if my_module_multilib was first and this is a 64-bit build, don't build |
| 42 | # this app |
| 43 | my_module_multilib := none |
| 44 | endif |
| 45 | else |
| 46 | # my_module_mulitlib was 64 or none, don't build this app |
| 47 | my_module_multilib := none |
| 48 | endif |
| 49 | endif |
| 50 | |
Colin Cross | 58d879f | 2014-02-04 11:16:16 -0800 | [diff] [blame] | 51 | LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true |
| 52 | |
Colin Cross | a3339e9 | 2014-04-30 18:09:13 -0700 | [diff] [blame] | 53 | # 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] | 54 | ifdef TARGET_2ND_ARCH |
Colin Cross | a3339e9 | 2014-04-30 18:09:13 -0700 | [diff] [blame] | 55 | ifeq ($(TARGET_PREFER_32_BIT_APPS),true) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 56 | LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) |
| 57 | else |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 58 | LOCAL_2ND_ARCH_VAR_PREFIX := |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 59 | endif |
| 60 | endif |
| 61 | |
| 62 | # check if preferred arch is supported |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 63 | include $(BUILD_SYSTEM)/module_arch_supported.mk |
| 64 | ifeq ($(my_module_arch_supported),true) |
Colin Cross | e6e48f6 | 2014-03-21 12:29:32 -0700 | [diff] [blame] | 65 | # first arch is supported |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 66 | include $(BUILD_SYSTEM)/package_internal.mk |
| 67 | else ifneq (,$(TARGET_2ND_ARCH)) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 68 | # check if the non-preferred arch is the primary or secondary |
Colin Cross | a3339e9 | 2014-04-30 18:09:13 -0700 | [diff] [blame] | 69 | ifeq ($(TARGET_PREFER_32_BIT_APPS),true) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 70 | LOCAL_2ND_ARCH_VAR_PREFIX := |
| 71 | else |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 72 | LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) |
Colin Cross | d3624d5 | 2014-04-10 12:28:56 -0700 | [diff] [blame] | 73 | endif |
| 74 | |
| 75 | # check if non-preferred arch is supported |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 76 | include $(BUILD_SYSTEM)/module_arch_supported.mk |
| 77 | ifeq ($(my_module_arch_supported),true) |
| 78 | # secondary arch is supported |
| 79 | include $(BUILD_SYSTEM)/package_internal.mk |
Joe Onorato | 899e62a | 2010-02-04 17:37:21 -0800 | [diff] [blame] | 80 | endif |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 81 | endif # TARGET_2ND_ARCH |
Colin Cross | 58d879f | 2014-02-04 11:16:16 -0800 | [diff] [blame] | 82 | |
Colin Cross | 2343cfb | 2014-01-24 13:33:39 -0800 | [diff] [blame] | 83 | LOCAL_2ND_ARCH_VAR_PREFIX := |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 84 | LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := |
| 85 | |
| 86 | my_module_arch_supported := |