blob: 70ef0d989e999683353cf504417566cec25a3ab2 [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
Evgenii Stepanov3632cc32015-06-11 13:57:10 -07009my_skip_this_target :=
Ivan Krasin74b32b82015-09-18 11:54:43 -070010ifneq ($(filter address,$(SANITIZE_TARGET)),)
Evgenii Stepanov3632cc32015-06-11 13:57:10 -070011 ifeq (true,$(LOCAL_FORCE_STATIC_EXECUTABLE))
12 my_skip_this_target := true
13 else ifeq (false, $(LOCAL_CLANG))
14 my_skip_this_target := true
15 endif
16endif
17
18ifneq (true,$(my_skip_this_target))
19
Ying Wang6feb6d52014-04-17 10:03:35 -070020my_prefix := TARGET_
Colin Crosse6e48f62014-03-21 12:29:32 -070021include $(BUILD_SYSTEM)/multilib.mk
The Android Open Source Project88b60792009-03-03 19:28:42 -080022
Colin Crosse6e48f62014-03-21 12:29:32 -070023ifeq ($(my_module_multilib),both)
24ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),)
25$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_32 or LOCAL_MODULE_PATH_32 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
26endif
27ifeq ($(LOCAL_MODULE_PATH_64)$(LOCAL_MODULE_STEM_64),)
28$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_64 or LOCAL_MODULE_PATH_64 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
29endif
30else #!LOCAL_MULTILIB == both
Colin Crossaee1e772014-02-04 11:16:16 -080031LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
Colin Crosse6e48f62014-03-21 12:29:32 -070032endif
Colin Cross8e404122014-02-06 14:45:37 -080033
Colin Crossa3339e92014-04-30 18:09:13 -070034# if TARGET_PREFER_32_BIT_EXECUTABLES is set, try to build 32-bit first
Colin Crossd3624d52014-04-10 12:28:56 -070035ifdef TARGET_2ND_ARCH
Colin Crossa3339e92014-04-30 18:09:13 -070036ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true)
Colin Crossd3624d52014-04-10 12:28:56 -070037LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
38else
39LOCAL_2ND_ARCH_VAR_PREFIX :=
40endif
41endif
Colin Crosse6e48f62014-03-21 12:29:32 -070042
Colin Crossd3624d52014-04-10 12:28:56 -070043my_skip_non_preferred_arch :=
44
45# check if preferred arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080046include $(BUILD_SYSTEM)/module_arch_supported.mk
47ifeq ($(my_module_arch_supported),true)
Colin Crosse6e48f62014-03-21 12:29:32 -070048# first arch is supported
Ying Wangdd814bf2014-01-17 16:17:28 -080049include $(BUILD_SYSTEM)/executable_internal.mk
Colin Crosse6e48f62014-03-21 12:29:32 -070050ifneq ($(my_module_multilib),both)
Colin Crossd3624d52014-04-10 12:28:56 -070051my_skip_non_preferred_arch := true
Colin Crosse6e48f62014-03-21 12:29:32 -070052endif
53endif
54
Colin Crossd3624d52014-04-10 12:28:56 -070055# check if preferred arch was not supported or asked to build both
56ifndef my_skip_non_preferred_arch
Colin Crosse6e48f62014-03-21 12:29:32 -070057ifdef TARGET_2ND_ARCH
Colin Crossd3624d52014-04-10 12:28:56 -070058
59# check if the non-preferred arch is the primary or secondary
Colin Crossa3339e92014-04-30 18:09:13 -070060ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true)
Colin Crossd3624d52014-04-10 12:28:56 -070061LOCAL_2ND_ARCH_VAR_PREFIX :=
62else
Colin Cross8e404122014-02-06 14:45:37 -080063LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
Colin Crossd3624d52014-04-10 12:28:56 -070064endif
65
66# check if non-preferred arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080067include $(BUILD_SYSTEM)/module_arch_supported.mk
68ifeq ($(my_module_arch_supported),true)
Colin Crossd3624d52014-04-10 12:28:56 -070069# non-preferred arch is supported
Colin Crosse6e48f62014-03-21 12:29:32 -070070OVERRIDE_BUILT_MODULE_PATH :=
71LOCAL_BUILT_MODULE :=
72LOCAL_INSTALLED_MODULE :=
73LOCAL_MODULE_STEM :=
74LOCAL_BUILT_MODULE_STEM :=
75LOCAL_INSTALLED_MODULE_STEM :=
76LOCAL_INTERMEDIATE_TARGETS :=
Colin Cross8e404122014-02-06 14:45:37 -080077include $(BUILD_SYSTEM)/executable_internal.mk
78endif
79endif # TARGET_2ND_ARCH
Colin Crossd3624d52014-04-10 12:28:56 -070080endif # !my_skip_non_preferred_arch || LOCAL_MULTILIB
Ying Wangdd814bf2014-01-17 16:17:28 -080081LOCAL_2ND_ARCH_VAR_PREFIX :=
Colin Crossaee1e772014-02-04 11:16:16 -080082LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
Colin Cross8e404122014-02-06 14:45:37 -080083
84my_module_arch_supported :=
Evgenii Stepanov3632cc32015-06-11 13:57:10 -070085
86endif