1########################################################### 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 16ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),) 17$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH) 18endif 19ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)$(LOCAL_MODULE_STEM_32)$(LOCAL_MODULE_STEM_64)),) 20$(error $(LOCAL_PATH): Cannot set module stem for a library) 21endif 22 23$(call target-shared-library-hook) 24 25skip_build_from_source := 26ifdef LOCAL_PREBUILT_MODULE_FILE 27ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH))) 28include $(BUILD_SYSTEM)/prebuilt_internal.mk 29skip_build_from_source := true 30endif 31endif 32 33ifndef skip_build_from_source 34 35# Put the built targets of all shared libraries in a common directory 36# to simplify the link line. 37OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES) 38 39include $(BUILD_SYSTEM)/dynamic_binary.mk 40 41# Define PRIVATE_ variables from global vars 42my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS) 43my_target_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBPROFILE_RT) 44my_target_libgcov := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCOV) 45ifeq ($(LOCAL_NO_LIBGCC),true) 46my_target_libgcc := 47else 48my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC) 49endif 50my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC) 51my_target_crtbegin_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_SO_O) 52my_target_crtend_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTEND_SO_O) 53ifdef LOCAL_SDK_VERSION 54# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS, 55# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree. 56my_target_global_ld_dirs := \ 57 $(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \ 58 $(my_ndk_sysroot_lib)) \ 59 $(my_target_global_ld_dirs) 60my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags) 61my_target_crtbegin_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_so.o) 62my_target_crtend_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_so.o) 63endif 64$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs) 65$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags) 66$(linked_module): PRIVATE_TARGET_LIBPROFILE_RT := $(my_target_libprofile_rt) 67$(linked_module): PRIVATE_TARGET_LIBGCOV := $(my_target_libgcov) 68$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc) 69$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic) 70$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o) 71$(linked_module): PRIVATE_TARGET_CRTEND_SO_O := $(my_target_crtend_so_o) 72 73$(linked_module): \ 74 $(all_objects) \ 75 $(all_libraries) \ 76 $(my_target_crtbegin_so_o) \ 77 $(my_target_crtend_so_o) \ 78 $(LOCAL_MODULE_MAKEFILE) \ 79 $(LOCAL_ADDITIONAL_DEPENDENCIES) 80 $(transform-o-to-shared-lib) 81 82endif # skip_build_from_source 83