blob: f3713fcf75f921a4eab55d271843a4ef7493e48b [file] [log] [blame]
Colin Cross8e404122014-02-06 14:45:37 -08001# We don't automatically set up rules to build packages for both
2# TARGET_ARCH and TARGET_2ND_ARCH.
Colin Crosse6e48f62014-03-21 12:29:32 -07003# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_MULTILIB := 32".
4
Dan Willemsen3bf15e72016-07-25 16:03:53 -07005$(call record-module-type,PACKAGE)
6
Ying Wang6feb6d52014-04-17 10:03:35 -07007my_prefix := TARGET_
Colin Crosse6e48f62014-03-21 12:29:32 -07008include $(BUILD_SYSTEM)/multilib.mk
9
Dan Willemsen2e3c3cf2017-04-20 10:59:06 -070010ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
11 ifneq ($(TARGET_SUPPORTS_64_BIT_APPS)|$(my_module_multilib),|64)
12 my_module_multilib := first
13 endif
14endif
15
Colin Cross17509442014-04-10 11:29:05 -070016ifeq ($(TARGET_SUPPORTS_32_BIT_APPS)|$(TARGET_SUPPORTS_64_BIT_APPS),true|true)
17 # packages default to building for either architecture,
18 # the preferred if its supported, otherwise the non-preferred.
19else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true)
20 # only 64-bit apps supported
21 ifeq ($(filter $(my_module_multilib),64 both first),$(my_module_multilib))
22 # if my_module_multilib was 64, both, first, or unset, build for 64-bit
23 my_module_multilib := 64
24 else
25 # otherwise don't build this app
26 my_module_multilib := none
27 endif
28else
29 # only 32-bit apps supported
30 ifeq ($(filter $(my_module_multilib),32 both),$(my_module_multilib))
31 # if my_module_multilib was 32, both, or unset, build for 32-bit
32 my_module_multilib := 32
33 else ifeq ($(my_module_multilib),first)
34 ifndef TARGET_IS_64_BIT
35 # if my_module_multilib was first and this is a 32-bit build, build for
36 # 32-bit
37 my_module_multilib := 32
38 else
39 # if my_module_multilib was first and this is a 64-bit build, don't build
40 # this app
41 my_module_multilib := none
42 endif
43 else
44 # my_module_mulitlib was 64 or none, don't build this app
45 my_module_multilib := none
46 endif
47endif
48
Colin Cross58d879f2014-02-04 11:16:16 -080049LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
50
Colin Crossa3339e92014-04-30 18:09:13 -070051# if TARGET_PREFER_32_BIT_APPS is set, try to build 32-bit first
Colin Crossd3624d52014-04-10 12:28:56 -070052ifdef TARGET_2ND_ARCH
Colin Crossa3339e92014-04-30 18:09:13 -070053ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
Colin Crossd3624d52014-04-10 12:28:56 -070054LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
55else
Colin Cross8e404122014-02-06 14:45:37 -080056LOCAL_2ND_ARCH_VAR_PREFIX :=
Colin Crossd3624d52014-04-10 12:28:56 -070057endif
58endif
59
60# check if preferred arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080061include $(BUILD_SYSTEM)/module_arch_supported.mk
62ifeq ($(my_module_arch_supported),true)
Colin Crosse6e48f62014-03-21 12:29:32 -070063# first arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080064include $(BUILD_SYSTEM)/package_internal.mk
65else ifneq (,$(TARGET_2ND_ARCH))
Colin Crossd3624d52014-04-10 12:28:56 -070066# check if the non-preferred arch is the primary or secondary
Colin Crossa3339e92014-04-30 18:09:13 -070067ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
Colin Crossd3624d52014-04-10 12:28:56 -070068LOCAL_2ND_ARCH_VAR_PREFIX :=
69else
Colin Cross8e404122014-02-06 14:45:37 -080070LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
Colin Crossd3624d52014-04-10 12:28:56 -070071endif
72
73# check if non-preferred arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080074include $(BUILD_SYSTEM)/module_arch_supported.mk
75ifeq ($(my_module_arch_supported),true)
76# secondary arch is supported
77include $(BUILD_SYSTEM)/package_internal.mk
Joe Onorato899e62a2010-02-04 17:37:21 -080078endif
Colin Cross8e404122014-02-06 14:45:37 -080079endif # TARGET_2ND_ARCH
Colin Cross58d879f2014-02-04 11:16:16 -080080
Colin Cross2343cfb2014-01-24 13:33:39 -080081LOCAL_2ND_ARCH_VAR_PREFIX :=
Colin Cross8e404122014-02-06 14:45:37 -080082LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
83
84my_module_arch_supported :=