2014-01-17 04:36:34 +08:00
|
|
|
###########################################################
|
|
|
|
## Standard rules for building a normal shared library.
|
|
|
|
##
|
|
|
|
## Additional inputs from base_rules.make:
|
|
|
|
## None.
|
|
|
|
##
|
|
|
|
## LOCAL_MODULE_SUFFIX will be set for you.
|
|
|
|
###########################################################
|
|
|
|
|
|
|
|
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
|
|
|
|
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
|
|
|
|
endif
|
|
|
|
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
|
|
|
|
LOCAL_MODULE_SUFFIX := $(TARGET_SHLIB_SUFFIX)
|
|
|
|
endif
|
|
|
|
ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
|
|
|
|
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
|
|
|
|
endif
|
2014-03-22 03:27:37 +08:00
|
|
|
ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)$(LOCAL_MODULE_STEM_32)$(LOCAL_MODULE_STEM_64)),)
|
2014-01-17 04:36:34 +08:00
|
|
|
$(error $(LOCAL_PATH): Cannot set module stem for a library)
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(call target-shared-library-hook)
|
|
|
|
|
|
|
|
skip_build_from_source :=
|
|
|
|
ifdef LOCAL_PREBUILT_MODULE_FILE
|
|
|
|
ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
|
2014-02-26 10:26:29 +08:00
|
|
|
include $(BUILD_SYSTEM)/prebuilt_internal.mk
|
2014-01-17 04:36:34 +08:00
|
|
|
skip_build_from_source := true
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef skip_build_from_source
|
|
|
|
|
|
|
|
# Put the built targets of all shared libraries in a common directory
|
|
|
|
# to simplify the link line.
|
|
|
|
OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/dynamic_binary.mk
|
|
|
|
|
|
|
|
# Define PRIVATE_ variables from global vars
|
|
|
|
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
|
2015-01-26 08:20:57 +08:00
|
|
|
my_target_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBPROFILE_RT)
|
2014-09-20 05:25:57 +08:00
|
|
|
my_target_libgcov := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCOV)
|
2014-01-17 04:36:34 +08:00
|
|
|
my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
|
2014-05-29 17:47:27 +08:00
|
|
|
my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC)
|
2014-01-17 04:36:34 +08:00
|
|
|
my_target_crtbegin_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_SO_O)
|
|
|
|
my_target_crtend_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTEND_SO_O)
|
|
|
|
ifdef LOCAL_SDK_VERSION
|
|
|
|
# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
|
|
|
|
# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
|
|
|
|
my_target_global_ld_dirs := \
|
|
|
|
$(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
|
2014-04-26 14:47:10 +08:00
|
|
|
$(my_ndk_sysroot_lib)) \
|
2014-01-17 04:36:34 +08:00
|
|
|
$(my_target_global_ld_dirs)
|
|
|
|
my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
|
2014-04-26 14:47:10 +08:00
|
|
|
my_target_crtbegin_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_so.o)
|
|
|
|
my_target_crtend_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_so.o)
|
2014-01-17 04:36:34 +08:00
|
|
|
endif
|
|
|
|
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
|
|
|
|
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
|
2015-01-26 08:20:57 +08:00
|
|
|
$(linked_module): PRIVATE_TARGET_LIBPROFILE_RT := $(my_target_libprofile_rt)
|
2014-09-20 05:25:57 +08:00
|
|
|
$(linked_module): PRIVATE_TARGET_LIBGCOV := $(my_target_libgcov)
|
2014-01-17 04:36:34 +08:00
|
|
|
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
|
2014-05-29 17:47:27 +08:00
|
|
|
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
|
2014-01-17 04:36:34 +08:00
|
|
|
$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
|
|
|
|
$(linked_module): PRIVATE_TARGET_CRTEND_SO_O := $(my_target_crtend_so_o)
|
|
|
|
|
2014-11-09 14:20:03 +08:00
|
|
|
$(linked_module): \
|
|
|
|
$(all_objects) \
|
|
|
|
$(all_libraries) \
|
|
|
|
$(my_target_crtbegin_so_o) \
|
|
|
|
$(my_target_crtend_so_o) \
|
|
|
|
$(LOCAL_MODULE_MAKEFILE) \
|
|
|
|
$(LOCAL_ADDITIONAL_DEPENDENCIES)
|
2014-01-17 04:36:34 +08:00
|
|
|
$(transform-o-to-shared-lib)
|
|
|
|
|
|
|
|
endif # skip_build_from_source
|