blob: 8c2c43502e699351c5251006b2f4b352a48f05de [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
Ying Wang87538e42016-03-16 19:53:19 -07005ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
6LOCAL_MULTILIB := first
7endif
8
Ying Wang6feb6d52014-04-17 10:03:35 -07009my_prefix := TARGET_
Colin Crosse6e48f62014-03-21 12:29:32 -070010include $(BUILD_SYSTEM)/multilib.mk
11
Colin Cross17509442014-04-10 11:29:05 -070012ifeq ($(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.
15else 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
24else
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
43endif
44
Colin Cross58d879f2014-02-04 11:16:16 -080045LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
46
Colin Crossa3339e92014-04-30 18:09:13 -070047# if TARGET_PREFER_32_BIT_APPS is set, try to build 32-bit first
Colin Crossd3624d52014-04-10 12:28:56 -070048ifdef TARGET_2ND_ARCH
Colin Crossa3339e92014-04-30 18:09:13 -070049ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
Colin Crossd3624d52014-04-10 12:28:56 -070050LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
51else
Colin Cross8e404122014-02-06 14:45:37 -080052LOCAL_2ND_ARCH_VAR_PREFIX :=
Colin Crossd3624d52014-04-10 12:28:56 -070053endif
54endif
55
56# check if preferred arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080057include $(BUILD_SYSTEM)/module_arch_supported.mk
58ifeq ($(my_module_arch_supported),true)
Colin Crosse6e48f62014-03-21 12:29:32 -070059# first arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080060include $(BUILD_SYSTEM)/package_internal.mk
61else ifneq (,$(TARGET_2ND_ARCH))
Colin Crossd3624d52014-04-10 12:28:56 -070062# check if the non-preferred arch is the primary or secondary
Colin Crossa3339e92014-04-30 18:09:13 -070063ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
Colin Crossd3624d52014-04-10 12:28:56 -070064LOCAL_2ND_ARCH_VAR_PREFIX :=
65else
Colin Cross8e404122014-02-06 14:45:37 -080066LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
Colin Crossd3624d52014-04-10 12:28:56 -070067endif
68
69# check if non-preferred arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080070include $(BUILD_SYSTEM)/module_arch_supported.mk
71ifeq ($(my_module_arch_supported),true)
72# secondary arch is supported
73include $(BUILD_SYSTEM)/package_internal.mk
Joe Onorato899e62a2010-02-04 17:37:21 -080074endif
Colin Cross8e404122014-02-06 14:45:37 -080075endif # TARGET_2ND_ARCH
Colin Cross58d879f2014-02-04 11:16:16 -080076
Colin Cross2343cfb2014-01-24 13:33:39 -080077LOCAL_2ND_ARCH_VAR_PREFIX :=
Colin Cross8e404122014-02-06 14:45:37 -080078LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
79
80my_module_arch_supported :=