OSDN Git Service

am 1cccea9b: am cdf32e84: am e892c86e: am 7e447edf: docs: update search suggest with...
[android-x86/build.git] / core / executable.mk
1 ###########################################################
2 ## Standard rules for building an executable file.
3 ##
4 ## Additional inputs from base_rules.make:
5 ## None.
6 ###########################################################
7
8 ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
9 LOCAL_MODULE_CLASS := EXECUTABLES
10 endif
11 ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
12 LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
13 endif
14
15 ####################################################
16 ## Add profiling libraries if aprof is turned
17 ####################################################
18 ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
19   ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE), true)
20     LOCAL_STATIC_LIBRARIES += libaprof libaprof_static libc libcutils
21   else
22     LOCAL_SHARED_LIBRARIES += libaprof libaprof_runtime libc
23   endif
24   LOCAL_WHOLE_STATIC_LIBRARIES += libaprof_aux
25 endif
26
27 include $(BUILD_SYSTEM)/dynamic_binary.mk
28
29 # Define PRIVATE_ variables from global vars
30 my_target_global_ld_dirs := $(TARGET_GLOBAL_LD_DIRS)
31 my_target_global_ldflags := $(TARGET_GLOBAL_LDFLAGS)
32 my_target_fdo_lib := $(TARGET_FDO_LIB)
33 my_target_libgcc := $(TARGET_LIBGCC)
34 my_target_crtbegin_dynamic_o := $(TARGET_CRTBEGIN_DYNAMIC_O)
35 my_target_crtbegin_static_o := $(TARGET_CRTBEGIN_STATIC_O)
36 my_target_crtend_o := $(TARGET_CRTEND_O)
37 ifdef LOCAL_SDK_VERSION
38 # Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
39 # so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
40 my_target_global_ld_dirs := \
41     $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
42     $(my_ndk_version_root)/usr/lib) \
43     $(my_target_global_ld_dirs)
44 my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
45 my_target_crtbegin_dynamic_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_dynamic.o)
46 my_target_crtbegin_static_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_static.o)
47 my_target_crtend_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtend_android.o)
48 endif
49 $(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
50 $(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
51 $(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
52 $(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
53 $(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
54 $(linked_module): PRIVATE_TARGET_CRTBEGIN_STATIC_O := $(my_target_crtbegin_static_o)
55 $(linked_module): PRIVATE_TARGET_CRTEND_O := $(my_target_crtend_o)
56
57 ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
58 $(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
59         $(transform-o-to-static-executable)
60 else
61 $(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
62         $(transform-o-to-executable)
63 endif