blob: 4fe058db45d66bd0558bbfccd8ac5d71a47d9bc8 [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 Willemsen1684b322016-07-25 16:03:53 -07005$(call record-module-type,PACKAGE)
6
Ying Wang277e75a2016-03-16 19:53:19 -07007ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
8LOCAL_MULTILIB := first
9endif
10
Ying Wang6feb6d52014-04-17 10:03:35 -070011my_prefix := TARGET_
Colin Crosse6e48f62014-03-21 12:29:32 -070012include $(BUILD_SYSTEM)/multilib.mk
13
Colin Cross17509442014-04-10 11:29:05 -070014ifeq ($(TARGET_SUPPORTS_32_BIT_APPS)|$(TARGET_SUPPORTS_64_BIT_APPS),true|true)
15 # packages default to building for either architecture,
16 # the preferred if its supported, otherwise the non-preferred.
17else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true)
18 # only 64-bit apps supported
19 ifeq ($(filter $(my_module_multilib),64 both first),$(my_module_multilib))
20 # if my_module_multilib was 64, both, first, or unset, build for 64-bit
21 my_module_multilib := 64
22 else
23 # otherwise don't build this app
24 my_module_multilib := none
25 endif
26else
27 # only 32-bit apps supported
28 ifeq ($(filter $(my_module_multilib),32 both),$(my_module_multilib))
29 # if my_module_multilib was 32, both, or unset, build for 32-bit
30 my_module_multilib := 32
31 else ifeq ($(my_module_multilib),first)
32 ifndef TARGET_IS_64_BIT
33 # if my_module_multilib was first and this is a 32-bit build, build for
34 # 32-bit
35 my_module_multilib := 32
36 else
37 # if my_module_multilib was first and this is a 64-bit build, don't build
38 # this app
39 my_module_multilib := none
40 endif
41 else
42 # my_module_mulitlib was 64 or none, don't build this app
43 my_module_multilib := none
44 endif
45endif
46
Colin Cross58d879f2014-02-04 11:16:16 -080047LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
48
Colin Crossa3339e92014-04-30 18:09:13 -070049# if TARGET_PREFER_32_BIT_APPS is set, try to build 32-bit first
Colin Crossd3624d52014-04-10 12:28:56 -070050ifdef TARGET_2ND_ARCH
Colin Crossa3339e92014-04-30 18:09:13 -070051ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
Colin Crossd3624d52014-04-10 12:28:56 -070052LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
53else
Colin Cross8e404122014-02-06 14:45:37 -080054LOCAL_2ND_ARCH_VAR_PREFIX :=
Colin Crossd3624d52014-04-10 12:28:56 -070055endif
56endif
57
58# check if preferred arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080059include $(BUILD_SYSTEM)/module_arch_supported.mk
60ifeq ($(my_module_arch_supported),true)
Colin Crosse6e48f62014-03-21 12:29:32 -070061# first arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080062include $(BUILD_SYSTEM)/package_internal.mk
63else ifneq (,$(TARGET_2ND_ARCH))
Colin Crossd3624d52014-04-10 12:28:56 -070064# check if the non-preferred arch is the primary or secondary
Colin Crossa3339e92014-04-30 18:09:13 -070065ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
Colin Crossd3624d52014-04-10 12:28:56 -070066LOCAL_2ND_ARCH_VAR_PREFIX :=
67else
Colin Cross8e404122014-02-06 14:45:37 -080068LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
Colin Crossd3624d52014-04-10 12:28:56 -070069endif
70
71# check if non-preferred arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080072include $(BUILD_SYSTEM)/module_arch_supported.mk
73ifeq ($(my_module_arch_supported),true)
74# secondary arch is supported
75include $(BUILD_SYSTEM)/package_internal.mk
Joe Onorato899e62a2010-02-04 17:37:21 -080076endif
Colin Cross8e404122014-02-06 14:45:37 -080077endif # TARGET_2ND_ARCH
Colin Cross58d879f2014-02-04 11:16:16 -080078
Colin Cross2343cfb2014-01-24 13:33:39 -080079LOCAL_2ND_ARCH_VAR_PREFIX :=
Colin Cross8e404122014-02-06 14:45:37 -080080LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
81
82my_module_arch_supported :=