2009-03-04 04:28:42 +01: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
|
2011-11-08 18:31:21 +01:00
|
|
|
ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
|
2012-10-02 01:36:23 +02:00
|
|
|
$(error $(LOCAL_PATH): Cannot set module stem for a library)
|
2011-11-08 18:31:21 +01:00
|
|
|
endif
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2013-01-16 00:28:08 +01:00
|
|
|
$(call target-shared-library-hook)
|
|
|
|
|
|
|
|
skip_build_from_source :=
|
|
|
|
ifdef LOCAL_PREBUILT_MODULE_FILE
|
|
|
|
ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
|
|
|
|
include $(BUILD_PREBUILT)
|
|
|
|
skip_build_from_source := true
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef skip_build_from_source
|
2012-06-15 09:15:50 +02:00
|
|
|
####################################################
|
|
|
|
## Add profiling libraries if aprof is turned
|
|
|
|
####################################################
|
|
|
|
ifeq ($(strip $(LOCAL_ENABLE_APROF_JNI)),true)
|
|
|
|
LOCAL_ENABLE_APROF := true
|
|
|
|
LOCAL_WHOLE_STATIC_LIBRARIES += libaprof_jni
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
|
|
|
|
LOCAL_SHARED_LIBRARIES += libaprof libaprof_runtime
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
# Put the built targets of all shared libraries in a common directory
|
|
|
|
# to simplify the link line.
|
|
|
|
OVERRIDE_BUILT_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/dynamic_binary.mk
|
|
|
|
|
2012-06-15 09:15:50 +02:00
|
|
|
|
2010-07-13 23:55:47 +02:00
|
|
|
# Define PRIVATE_ variables from global vars
|
|
|
|
my_target_global_ld_dirs := $(TARGET_GLOBAL_LD_DIRS)
|
|
|
|
my_target_global_ldflags := $(TARGET_GLOBAL_LDFLAGS)
|
|
|
|
my_target_fdo_lib := $(TARGET_FDO_LIB)
|
|
|
|
my_target_libgcc := $(TARGET_LIBGCC)
|
|
|
|
my_target_crtbegin_so_o := $(TARGET_CRTBEGIN_SO_O)
|
|
|
|
my_target_crtend_so_o := $(TARGET_CRTEND_SO_O)
|
2012-08-14 19:13:16 +02:00
|
|
|
ifdef LOCAL_SDK_VERSION
|
2011-07-21 00:42:53 +02:00
|
|
|
# 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))) \
|
|
|
|
$(my_ndk_version_root)/usr/lib) \
|
|
|
|
$(my_target_global_ld_dirs)
|
2011-03-04 03:53:53 +01:00
|
|
|
my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
|
2011-03-04 20:21:38 +01:00
|
|
|
my_target_crtbegin_so_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_so.o)
|
|
|
|
my_target_crtend_so_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtend_so.o)
|
2010-07-13 23:55:47 +02:00
|
|
|
endif
|
|
|
|
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
|
|
|
|
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
|
|
|
|
$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
|
|
|
|
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
|
|
|
|
$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
|
|
|
|
$(linked_module): PRIVATE_TARGET_CRTEND_SO_O := $(my_target_crtend_so_o)
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
$(linked_module): $(all_objects) $(all_libraries) \
|
|
|
|
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
|
2010-07-13 23:55:47 +02:00
|
|
|
$(my_target_crtbegin_so_o) $(my_target_crtend_so_o)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-o-to-shared-lib)
|
2013-01-16 00:28:08 +01:00
|
|
|
|
|
|
|
endif # skip_build_from_source
|