blob: 27c033d1c2430d5a591cc7da979623c10f70f221 [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 Wang87538e42016-03-16 19:53:19 -070020ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
Ying Wang62630222016-04-20 11:53:39 -070021# If a native test explicity specifies to build only for the translation arch,
22# we'll still need LOCAL_MULTILIB=both and let module_arch_supported.mk choose
23# to build only for TARGET_2ND_ARCH.
24ifneq (1,$(words $(LOCAL_MODULE_TARGET_ARCH)))
Ying Wang87538e42016-03-16 19:53:19 -070025LOCAL_MULTILIB := first
26endif
Ying Wang62630222016-04-20 11:53:39 -070027endif
Ying Wang87538e42016-03-16 19:53:19 -070028
Ying Wang6feb6d52014-04-17 10:03:35 -070029my_prefix := TARGET_
Colin Crosse6e48f62014-03-21 12:29:32 -070030include $(BUILD_SYSTEM)/multilib.mk
The Android Open Source Project88b60792009-03-03 19:28:42 -080031
Colin Crosse6e48f62014-03-21 12:29:32 -070032ifeq ($(my_module_multilib),both)
33ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),)
34$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_32 or LOCAL_MODULE_PATH_32 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
35endif
36ifeq ($(LOCAL_MODULE_PATH_64)$(LOCAL_MODULE_STEM_64),)
37$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_64 or LOCAL_MODULE_PATH_64 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
38endif
39else #!LOCAL_MULTILIB == both
Colin Crossaee1e772014-02-04 11:16:16 -080040LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
Colin Crosse6e48f62014-03-21 12:29:32 -070041endif
Colin Cross8e404122014-02-06 14:45:37 -080042
Colin Crossa3339e92014-04-30 18:09:13 -070043# if TARGET_PREFER_32_BIT_EXECUTABLES is set, try to build 32-bit first
Colin Crossd3624d52014-04-10 12:28:56 -070044ifdef TARGET_2ND_ARCH
Colin Crossa3339e92014-04-30 18:09:13 -070045ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true)
Colin Crossd3624d52014-04-10 12:28:56 -070046LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
47else
48LOCAL_2ND_ARCH_VAR_PREFIX :=
49endif
50endif
Colin Crosse6e48f62014-03-21 12:29:32 -070051
Colin Crossd3624d52014-04-10 12:28:56 -070052my_skip_non_preferred_arch :=
53
54# check if preferred arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080055include $(BUILD_SYSTEM)/module_arch_supported.mk
56ifeq ($(my_module_arch_supported),true)
Colin Crosse6e48f62014-03-21 12:29:32 -070057# first arch is supported
Ying Wangdd814bf2014-01-17 16:17:28 -080058include $(BUILD_SYSTEM)/executable_internal.mk
Colin Crosse6e48f62014-03-21 12:29:32 -070059ifneq ($(my_module_multilib),both)
Colin Crossd3624d52014-04-10 12:28:56 -070060my_skip_non_preferred_arch := true
Colin Crosse6e48f62014-03-21 12:29:32 -070061endif
62endif
63
Colin Crossd3624d52014-04-10 12:28:56 -070064# check if preferred arch was not supported or asked to build both
65ifndef my_skip_non_preferred_arch
Colin Crosse6e48f62014-03-21 12:29:32 -070066ifdef TARGET_2ND_ARCH
Colin Crossd3624d52014-04-10 12:28:56 -070067
68# check if the non-preferred arch is the primary or secondary
Colin Crossa3339e92014-04-30 18:09:13 -070069ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true)
Colin Crossd3624d52014-04-10 12:28:56 -070070LOCAL_2ND_ARCH_VAR_PREFIX :=
71else
Colin Cross8e404122014-02-06 14:45:37 -080072LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
Colin Crossd3624d52014-04-10 12:28:56 -070073endif
74
75# check if non-preferred arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080076include $(BUILD_SYSTEM)/module_arch_supported.mk
77ifeq ($(my_module_arch_supported),true)
Colin Crossd3624d52014-04-10 12:28:56 -070078# non-preferred arch is supported
Colin Crosse6e48f62014-03-21 12:29:32 -070079OVERRIDE_BUILT_MODULE_PATH :=
80LOCAL_BUILT_MODULE :=
81LOCAL_INSTALLED_MODULE :=
Colin Crosse6e48f62014-03-21 12:29:32 -070082LOCAL_INTERMEDIATE_TARGETS :=
Colin Cross8e404122014-02-06 14:45:37 -080083include $(BUILD_SYSTEM)/executable_internal.mk
84endif
85endif # TARGET_2ND_ARCH
Colin Crossd3624d52014-04-10 12:28:56 -070086endif # !my_skip_non_preferred_arch || LOCAL_MULTILIB
Ying Wangdd814bf2014-01-17 16:17:28 -080087LOCAL_2ND_ARCH_VAR_PREFIX :=
Colin Crossaee1e772014-02-04 11:16:16 -080088LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
Colin Cross8e404122014-02-06 14:45:37 -080089
90my_module_arch_supported :=
Evgenii Stepanov3632cc32015-06-11 13:57:10 -070091
92endif