blob: ca639eb68e0ba8867b7551cfe281d3cc00205693 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001###########################################################
2## Standard rules for building a normal shared library.
3##
4## Additional inputs from base_rules.make:
5## None.
6##
7## LOCAL_MODULE_SUFFIX will be set for you.
8###########################################################
9
10ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
11LOCAL_MODULE_CLASS := SHARED_LIBRARIES
12endif
13ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
14LOCAL_MODULE_SUFFIX := $(TARGET_SHLIB_SUFFIX)
15endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080016ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
17$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
18endif
19
20# Put the built targets of all shared libraries in a common directory
21# to simplify the link line.
22OVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
23
24include $(BUILD_SYSTEM)/dynamic_binary.mk
25
Ying Wang1a081002010-07-13 14:55:47 -070026# Define PRIVATE_ variables from global vars
27my_target_global_ld_dirs := $(TARGET_GLOBAL_LD_DIRS)
28my_target_global_ldflags := $(TARGET_GLOBAL_LDFLAGS)
29my_target_fdo_lib := $(TARGET_FDO_LIB)
30my_target_libgcc := $(TARGET_LIBGCC)
31my_target_crtbegin_so_o := $(TARGET_CRTBEGIN_SO_O)
32my_target_crtend_so_o := $(TARGET_CRTEND_SO_O)
33ifdef LOCAL_NDK_VERSION
Ying Wangb934e492011-07-20 15:42:53 -070034# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
35# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
36my_target_global_ld_dirs := \
37 $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
38 $(my_ndk_version_root)/usr/lib) \
39 $(my_target_global_ld_dirs)
Ying Wangcce4c972011-03-03 18:53:53 -080040my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
Ying Wang7ee6c402011-03-04 11:21:38 -080041my_target_crtbegin_so_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_so.o)
42my_target_crtend_so_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtend_so.o)
Ying Wang1a081002010-07-13 14:55:47 -070043endif
44$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
45$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
46$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
47$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
48$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
49$(linked_module): PRIVATE_TARGET_CRTEND_SO_O := $(my_target_crtend_so_o)
50
The Android Open Source Project88b60792009-03-03 19:28:42 -080051$(linked_module): $(all_objects) $(all_libraries) \
52 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
Ying Wang1a081002010-07-13 14:55:47 -070053 $(my_target_crtbegin_so_o) $(my_target_crtend_so_o)
The Android Open Source Project88b60792009-03-03 19:28:42 -080054 $(transform-o-to-shared-lib)