• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 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.
4# 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
9ifdef LOCAL_IS_HOST_MODULE
10  $(call pretty-error,BUILD_EXECUTABLE is incompatible with LOCAL_IS_HOST_MODULE. Use BUILD_HOST_EXECUTABLE instead.)
11endif
12
13my_skip_this_target :=
14ifneq ($(filter address,$(SANITIZE_TARGET)),)
15  ifeq (true,$(LOCAL_FORCE_STATIC_EXECUTABLE))
16    my_skip_this_target := true
17  else ifeq (false, $(LOCAL_CLANG))
18    my_skip_this_target := true
19  else ifeq (never, $(LOCAL_SANITIZE))
20    my_skip_this_target := true
21  endif
22endif
23
24ifneq (true,$(my_skip_this_target))
25$(call record-module-type,EXECUTABLE)
26
27my_prefix := TARGET_
28include $(BUILD_SYSTEM)/multilib.mk
29
30ifeq ($(my_module_multilib),both)
31ifneq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS)
32ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),)
33$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_32 or LOCAL_MODULE_PATH_32 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
34endif
35ifeq ($(LOCAL_MODULE_PATH_64)$(LOCAL_MODULE_STEM_64),)
36$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_64 or LOCAL_MODULE_PATH_64 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
37endif
38endif
39else #!LOCAL_MULTILIB == both
40LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
41endif
42
43ifdef TARGET_2ND_ARCH
44LOCAL_2ND_ARCH_VAR_PREFIX :=
45endif
46
47my_skip_non_preferred_arch :=
48
49# check if preferred arch is supported
50include $(BUILD_SYSTEM)/module_arch_supported.mk
51ifeq ($(my_module_arch_supported),true)
52# first arch is supported
53include $(BUILD_SYSTEM)/executable_internal.mk
54ifneq ($(my_module_multilib),both)
55my_skip_non_preferred_arch := true
56endif
57endif
58
59# check if preferred arch was not supported or asked to build both
60ifndef my_skip_non_preferred_arch
61ifdef TARGET_2ND_ARCH
62
63LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
64
65# check if non-preferred arch is supported
66include $(BUILD_SYSTEM)/module_arch_supported.mk
67ifeq ($(my_module_arch_supported),true)
68# non-preferred arch is supported
69LOCAL_BUILT_MODULE :=
70LOCAL_INSTALLED_MODULE :=
71LOCAL_INTERMEDIATE_TARGETS :=
72include $(BUILD_SYSTEM)/executable_internal.mk
73endif
74endif # TARGET_2ND_ARCH
75endif # !my_skip_non_preferred_arch || LOCAL_MULTILIB
76LOCAL_2ND_ARCH_VAR_PREFIX :=
77LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
78
79my_module_arch_supported :=
80
81endif
82