blob: 1e8d73a452cbf7bd6a004add39127faf6b0d7a51 [file] [log] [blame]
Ying Wangdd814bf2014-01-17 16:17:28 -08001# We don't automatically set up rules to build executables for both
2# TARGET_ARCH and TARGET_2ND_ARCH.
3# By default, an executable is built for TARGET_ARCH.
Colin Crosse6e48f62014-03-21 12:29:32 -07004# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_MULTILIB := 32"
5# To build it for both set LOCAL_MULTILIB := both and specify
6# LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 or LOCAL_MODULE_STEM_32 and
7# LOCAL_MODULE_STEM_64
8
9include $(BUILD_SYSTEM)/multilib.mk
The Android Open Source Project88b60792009-03-03 19:28:42 -080010
Ying Wang14a6cbd2014-02-10 22:26:23 -080011ifeq ($(TARGET_PREFER_32_BIT),true)
Colin Crosse6e48f62014-03-21 12:29:32 -070012ifeq (,$(filter $(my_module_multilib),first both)
13# if TARGET_PREFER_32_BIT is not explicitly set to "first" or "both"
14# build only for secondary
15my_module_multilib := 32
Ying Wang14a6cbd2014-02-10 22:26:23 -080016endif
17endif
18
Colin Crosse6e48f62014-03-21 12:29:32 -070019ifndef my_module_multilib
20# executables default to building for the first architecture
21my_module_multilib := first
22endif
23
24ifeq ($(my_module_multilib),both)
25ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),)
26$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_32 or LOCAL_MODULE_PATH_32 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
27endif
28ifeq ($(LOCAL_MODULE_PATH_64)$(LOCAL_MODULE_STEM_64),)
29$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_64 or LOCAL_MODULE_PATH_64 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
30endif
31else #!LOCAL_MULTILIB == both
Colin Crossaee1e772014-02-04 11:16:16 -080032LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
Colin Crosse6e48f62014-03-21 12:29:32 -070033endif
Colin Cross8e404122014-02-06 14:45:37 -080034
Colin Crosse6e48f62014-03-21 12:29:32 -070035my_skip_secondary_arch :=
36
37# check if first arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080038include $(BUILD_SYSTEM)/module_arch_supported.mk
39ifeq ($(my_module_arch_supported),true)
Colin Crosse6e48f62014-03-21 12:29:32 -070040# first arch is supported
Ying Wangdd814bf2014-01-17 16:17:28 -080041include $(BUILD_SYSTEM)/executable_internal.mk
Colin Crosse6e48f62014-03-21 12:29:32 -070042ifneq ($(my_module_multilib),both)
43my_skip_secondary_arch := true
44endif
45endif
46
47# check if first arch was not supported or asked to build both
48ifndef my_skip_secondary_arch
49ifdef TARGET_2ND_ARCH
Colin Cross8e404122014-02-06 14:45:37 -080050# check if secondary arch is supported
51LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
52include $(BUILD_SYSTEM)/module_arch_supported.mk
53ifeq ($(my_module_arch_supported),true)
54# secondary arch is supported
Colin Crosse6e48f62014-03-21 12:29:32 -070055OVERRIDE_BUILT_MODULE_PATH :=
56LOCAL_BUILT_MODULE :=
57LOCAL_INSTALLED_MODULE :=
58LOCAL_MODULE_STEM :=
59LOCAL_BUILT_MODULE_STEM :=
60LOCAL_INSTALLED_MODULE_STEM :=
61LOCAL_INTERMEDIATE_TARGETS :=
Colin Cross8e404122014-02-06 14:45:37 -080062include $(BUILD_SYSTEM)/executable_internal.mk
63endif
64endif # TARGET_2ND_ARCH
Colin Crosse6e48f62014-03-21 12:29:32 -070065endif # !my_skip_secondary_arch || LOCAL_MULTILIB
Ying Wangdd814bf2014-01-17 16:17:28 -080066LOCAL_2ND_ARCH_VAR_PREFIX :=
Colin Crossaee1e772014-02-04 11:16:16 -080067LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
Colin Cross8e404122014-02-06 14:45:37 -080068
69my_module_arch_supported :=