xref: /aosp_15_r20/build/make/core/executable.mk (revision 9e94795a3d4ef5c1d47486f9a02bb378756cea8a)
1*9e94795aSAndroid Build Coastguard Worker# We don't automatically set up rules to build executables for both
2*9e94795aSAndroid Build Coastguard Worker# TARGET_ARCH and TARGET_2ND_ARCH.
3*9e94795aSAndroid Build Coastguard Worker# By default, an executable is built for TARGET_ARCH.
4*9e94795aSAndroid Build Coastguard Worker# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_MULTILIB := 32"
5*9e94795aSAndroid Build Coastguard Worker# To build it for both set LOCAL_MULTILIB := both and specify
6*9e94795aSAndroid Build Coastguard Worker# LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 or LOCAL_MODULE_STEM_32 and
7*9e94795aSAndroid Build Coastguard Worker# LOCAL_MODULE_STEM_64
8*9e94795aSAndroid Build Coastguard Worker
9*9e94795aSAndroid Build Coastguard Workerifdef LOCAL_IS_HOST_MODULE
10*9e94795aSAndroid Build Coastguard Worker  $(call pretty-error,BUILD_EXECUTABLE is incompatible with LOCAL_IS_HOST_MODULE. Use BUILD_HOST_EXECUTABLE instead.)
11*9e94795aSAndroid Build Coastguard Workerendif
12*9e94795aSAndroid Build Coastguard Worker
13*9e94795aSAndroid Build Coastguard Workermy_skip_this_target :=
14*9e94795aSAndroid Build Coastguard Workerifneq ($(filter address,$(SANITIZE_TARGET)),)
15*9e94795aSAndroid Build Coastguard Worker  ifeq (true,$(LOCAL_FORCE_STATIC_EXECUTABLE))
16*9e94795aSAndroid Build Coastguard Worker    my_skip_this_target := true
17*9e94795aSAndroid Build Coastguard Worker  else ifeq (false, $(LOCAL_CLANG))
18*9e94795aSAndroid Build Coastguard Worker    my_skip_this_target := true
19*9e94795aSAndroid Build Coastguard Worker  else ifeq (never, $(LOCAL_SANITIZE))
20*9e94795aSAndroid Build Coastguard Worker    my_skip_this_target := true
21*9e94795aSAndroid Build Coastguard Worker  endif
22*9e94795aSAndroid Build Coastguard Workerendif
23*9e94795aSAndroid Build Coastguard Worker
24*9e94795aSAndroid Build Coastguard Workerifneq (true,$(my_skip_this_target))
25*9e94795aSAndroid Build Coastguard Worker$(call record-module-type,EXECUTABLE)
26*9e94795aSAndroid Build Coastguard Worker
27*9e94795aSAndroid Build Coastguard Workermy_prefix := TARGET_
28*9e94795aSAndroid Build Coastguard Workerinclude $(BUILD_SYSTEM)/multilib.mk
29*9e94795aSAndroid Build Coastguard Worker
30*9e94795aSAndroid Build Coastguard Workerifeq ($(my_module_multilib),both)
31*9e94795aSAndroid Build Coastguard Workerifneq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS)
32*9e94795aSAndroid Build Coastguard Workerifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),)
33*9e94795aSAndroid Build Coastguard Worker$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_32 or LOCAL_MODULE_PATH_32 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
34*9e94795aSAndroid Build Coastguard Workerendif
35*9e94795aSAndroid Build Coastguard Workerifeq ($(LOCAL_MODULE_PATH_64)$(LOCAL_MODULE_STEM_64),)
36*9e94795aSAndroid Build Coastguard Worker$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_64 or LOCAL_MODULE_PATH_64 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
37*9e94795aSAndroid Build Coastguard Workerendif
38*9e94795aSAndroid Build Coastguard Workerendif
39*9e94795aSAndroid Build Coastguard Workerelse #!LOCAL_MULTILIB == both
40*9e94795aSAndroid Build Coastguard WorkerLOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
41*9e94795aSAndroid Build Coastguard Workerendif
42*9e94795aSAndroid Build Coastguard Worker
43*9e94795aSAndroid Build Coastguard Workerifdef TARGET_2ND_ARCH
44*9e94795aSAndroid Build Coastguard WorkerLOCAL_2ND_ARCH_VAR_PREFIX :=
45*9e94795aSAndroid Build Coastguard Workerendif
46*9e94795aSAndroid Build Coastguard Worker
47*9e94795aSAndroid Build Coastguard Workermy_skip_non_preferred_arch :=
48*9e94795aSAndroid Build Coastguard Worker
49*9e94795aSAndroid Build Coastguard Worker# check if preferred arch is supported
50*9e94795aSAndroid Build Coastguard Workerinclude $(BUILD_SYSTEM)/module_arch_supported.mk
51*9e94795aSAndroid Build Coastguard Workerifeq ($(my_module_arch_supported),true)
52*9e94795aSAndroid Build Coastguard Worker# first arch is supported
53*9e94795aSAndroid Build Coastguard Workerinclude $(BUILD_SYSTEM)/executable_internal.mk
54*9e94795aSAndroid Build Coastguard Workerifneq ($(my_module_multilib),both)
55*9e94795aSAndroid Build Coastguard Workermy_skip_non_preferred_arch := true
56*9e94795aSAndroid Build Coastguard Workerendif
57*9e94795aSAndroid Build Coastguard Workerendif
58*9e94795aSAndroid Build Coastguard Worker
59*9e94795aSAndroid Build Coastguard Worker# check if preferred arch was not supported or asked to build both
60*9e94795aSAndroid Build Coastguard Workerifndef my_skip_non_preferred_arch
61*9e94795aSAndroid Build Coastguard Workerifdef TARGET_2ND_ARCH
62*9e94795aSAndroid Build Coastguard Worker
63*9e94795aSAndroid Build Coastguard WorkerLOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
64*9e94795aSAndroid Build Coastguard Worker
65*9e94795aSAndroid Build Coastguard Worker# check if non-preferred arch is supported
66*9e94795aSAndroid Build Coastguard Workerinclude $(BUILD_SYSTEM)/module_arch_supported.mk
67*9e94795aSAndroid Build Coastguard Workerifeq ($(my_module_arch_supported),true)
68*9e94795aSAndroid Build Coastguard Worker# non-preferred arch is supported
69*9e94795aSAndroid Build Coastguard WorkerLOCAL_BUILT_MODULE :=
70*9e94795aSAndroid Build Coastguard WorkerLOCAL_INSTALLED_MODULE :=
71*9e94795aSAndroid Build Coastguard WorkerLOCAL_INTERMEDIATE_TARGETS :=
72*9e94795aSAndroid Build Coastguard Workerinclude $(BUILD_SYSTEM)/executable_internal.mk
73*9e94795aSAndroid Build Coastguard Workerendif
74*9e94795aSAndroid Build Coastguard Workerendif # TARGET_2ND_ARCH
75*9e94795aSAndroid Build Coastguard Workerendif # !my_skip_non_preferred_arch || LOCAL_MULTILIB
76*9e94795aSAndroid Build Coastguard WorkerLOCAL_2ND_ARCH_VAR_PREFIX :=
77*9e94795aSAndroid Build Coastguard WorkerLOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
78*9e94795aSAndroid Build Coastguard Worker
79*9e94795aSAndroid Build Coastguard Workermy_module_arch_supported :=
80*9e94795aSAndroid Build Coastguard Worker
81*9e94795aSAndroid Build Coastguard Workerendif
82