• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1###########################################################
2## Standard rules for building an executable file.
3##
4## Additional inputs from base_rules.make:
5## None.
6###########################################################
7
8ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
9LOCAL_MODULE_CLASS := EXECUTABLES
10endif
11ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
12LOCAL_MODULE_SUFFIX := $($(my_prefix)EXECUTABLE_SUFFIX)
13endif
14
15ifdef host-executable-hook
16$(call host-executable-hook)
17endif
18
19skip_build_from_source :=
20ifdef LOCAL_PREBUILT_MODULE_FILE
21ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
22include $(BUILD_SYSTEM)/prebuilt_internal.mk
23skip_build_from_source := true
24endif
25endif
26
27ifndef skip_build_from_source
28
29include $(BUILD_SYSTEM)/binary.mk
30
31my_host_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT)
32$(LOCAL_BUILT_MODULE): PRIVATE_HOST_LIBPROFILE_RT := $(my_host_libprofile_rt)
33
34my_libdir := $(notdir $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_SHARED_LIBRARIES))
35ifeq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS)
36$(LOCAL_BUILT_MODULE): PRIVATE_RPATHS := ../../$(my_libdir) ../../../$(my_libdir)
37else
38$(LOCAL_BUILT_MODULE): PRIVATE_RPATHS := ../$(my_libdir) $(my_libdir)
39endif
40my_libdir :=
41
42my_crtbegin :=
43my_crtend :=
44my_libcrt_builtins :=
45ifdef USE_HOST_MUSL
46  my_crtbegin := $(SOONG_$(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_OBJECT_libc_musl_crtbegin_dynamic)
47  my_crtend := $(SOONG_$(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_OBJECT_libc_musl_crtend)
48  my_libcrt_builtins := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBCRT_BUILTINS)
49  $(LOCAL_BUILT_MODULE): PRIVATE_LDFLAGS += -Wl,--no-dynamic-linker
50endif
51
52$(LOCAL_BUILT_MODULE): PRIVATE_CRTBEGIN := $(my_crtbegin)
53$(LOCAL_BUILT_MODULE): PRIVATE_CRTEND := $(my_crtend)
54$(LOCAL_BUILT_MODULE): PRIVATE_LIBCRT_BUILTINS := $(my_libcrt_builtins)
55$(LOCAL_BUILT_MODULE): $(my_crtbegin) $(my_crtend) $(my_libcrt_builtins)
56
57$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries) $(CLANG_CXX)
58	$(transform-host-o-to-executable)
59
60endif  # skip_build_from_source
61