blob: 4dd9a2349aae00a321de79403b9035fe42fb1f74 [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
Ying Wang6feb6d52014-04-17 10:03:35 -07009my_prefix := TARGET_
Colin Crosse6e48f62014-03-21 12:29:32 -070010include $(BUILD_SYSTEM)/multilib.mk
The Android Open Source Project88b60792009-03-03 19:28:42 -080011
Colin Crosse6e48f62014-03-21 12:29:32 -070012ifeq ($(my_module_multilib),both)
13ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),)
14$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_32 or LOCAL_MODULE_PATH_32 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
15endif
16ifeq ($(LOCAL_MODULE_PATH_64)$(LOCAL_MODULE_STEM_64),)
17$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_64 or LOCAL_MODULE_PATH_64 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
18endif
19else #!LOCAL_MULTILIB == both
Colin Crossaee1e772014-02-04 11:16:16 -080020LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
Colin Crosse6e48f62014-03-21 12:29:32 -070021endif
Colin Cross8e404122014-02-06 14:45:37 -080022
Colin Crossa3339e92014-04-30 18:09:13 -070023# if TARGET_PREFER_32_BIT_EXECUTABLES is set, try to build 32-bit first
Colin Crossd3624d52014-04-10 12:28:56 -070024ifdef TARGET_2ND_ARCH
Colin Crossa3339e92014-04-30 18:09:13 -070025ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true)
Colin Crossd3624d52014-04-10 12:28:56 -070026LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
27else
28LOCAL_2ND_ARCH_VAR_PREFIX :=
29endif
30endif
Colin Crosse6e48f62014-03-21 12:29:32 -070031
Colin Crossd3624d52014-04-10 12:28:56 -070032my_skip_non_preferred_arch :=
33
34# check if preferred arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080035include $(BUILD_SYSTEM)/module_arch_supported.mk
36ifeq ($(my_module_arch_supported),true)
Colin Crosse6e48f62014-03-21 12:29:32 -070037# first arch is supported
Ying Wangdd814bf2014-01-17 16:17:28 -080038include $(BUILD_SYSTEM)/executable_internal.mk
Colin Crosse6e48f62014-03-21 12:29:32 -070039ifneq ($(my_module_multilib),both)
Colin Crossd3624d52014-04-10 12:28:56 -070040my_skip_non_preferred_arch := true
Colin Crosse6e48f62014-03-21 12:29:32 -070041endif
42endif
43
Colin Crossd3624d52014-04-10 12:28:56 -070044# check if preferred arch was not supported or asked to build both
45ifndef my_skip_non_preferred_arch
Colin Crosse6e48f62014-03-21 12:29:32 -070046ifdef TARGET_2ND_ARCH
Colin Crossd3624d52014-04-10 12:28:56 -070047
48# check if the non-preferred arch is the primary or secondary
Colin Crossa3339e92014-04-30 18:09:13 -070049ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true)
Colin Crossd3624d52014-04-10 12:28:56 -070050LOCAL_2ND_ARCH_VAR_PREFIX :=
51else
Colin Cross8e404122014-02-06 14:45:37 -080052LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
Colin Crossd3624d52014-04-10 12:28:56 -070053endif
54
55# check if non-preferred arch is supported
Colin Cross8e404122014-02-06 14:45:37 -080056include $(BUILD_SYSTEM)/module_arch_supported.mk
57ifeq ($(my_module_arch_supported),true)
Colin Crossd3624d52014-04-10 12:28:56 -070058# non-preferred arch is supported
Colin Crosse6e48f62014-03-21 12:29:32 -070059OVERRIDE_BUILT_MODULE_PATH :=
60LOCAL_BUILT_MODULE :=
61LOCAL_INSTALLED_MODULE :=
62LOCAL_MODULE_STEM :=
63LOCAL_BUILT_MODULE_STEM :=
64LOCAL_INSTALLED_MODULE_STEM :=
65LOCAL_INTERMEDIATE_TARGETS :=
Colin Cross8e404122014-02-06 14:45:37 -080066include $(BUILD_SYSTEM)/executable_internal.mk
67endif
68endif # TARGET_2ND_ARCH
Colin Crossd3624d52014-04-10 12:28:56 -070069endif # !my_skip_non_preferred_arch || LOCAL_MULTILIB
Ying Wangdd814bf2014-01-17 16:17:28 -080070LOCAL_2ND_ARCH_VAR_PREFIX :=
Colin Crossaee1e772014-02-04 11:16:16 -080071LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
Colin Cross8e404122014-02-06 14:45:37 -080072
73my_module_arch_supported :=