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 $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)$(LOCAL_MODULE_STEM_32)$(LOCAL_MODULE_STEM_64)),) 17$(error $(LOCAL_PATH): Cannot set module stem for a library) 18endif 19 20ifdef target-shared-library-hook 21$(call target-shared-library-hook) 22endif 23 24skip_build_from_source := 25ifdef LOCAL_PREBUILT_MODULE_FILE 26ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH))) 27include $(BUILD_SYSTEM)/prebuilt_internal.mk 28skip_build_from_source := true 29endif 30endif 31 32ifndef skip_build_from_source 33 34include $(BUILD_SYSTEM)/dynamic_binary.mk 35 36# Define PRIVATE_ variables from global vars 37ifeq ($(LOCAL_NO_LIBCRT_BUILTINS),true) 38my_target_libcrt_builtins := 39else 40my_target_libcrt_builtins := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBCRT_BUILTINS) 41endif 42ifeq ($(LOCAL_NO_LIBGCC),true) 43my_target_libgcc := 44else 45my_target_libgcc := $(call intermediates-dir-for,STATIC_LIBRARIES,libgcc,,,$(LOCAL_2ND_ARCH_VAR_PREFIX))/libgcc.a 46endif 47my_target_libatomic := $(call intermediates-dir-for,STATIC_LIBRARIES,libatomic,,,$(LOCAL_2ND_ARCH_VAR_PREFIX))/libatomic.a 48ifeq ($(LOCAL_NO_CRT),true) 49my_target_crtbegin_so_o := 50my_target_crtend_so_o := 51else ifdef LOCAL_USE_VNDK 52my_target_crtbegin_so_o := $(SOONG_$(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJECT_crtbegin_so.vendor) 53my_target_crtend_so_o := $(SOONG_$(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJECT_crtend_so.vendor) 54else 55my_target_crtbegin_so_o := $(SOONG_$(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJECT_crtbegin_so) 56my_target_crtend_so_o := $(SOONG_$(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJECT_crtend_so) 57endif 58ifneq ($(LOCAL_SDK_VERSION),) 59my_target_crtbegin_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_so.o) 60my_target_crtend_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_so.o) 61endif 62$(linked_module): PRIVATE_TARGET_LIBCRT_BUILTINS := $(my_target_libcrt_builtins) 63$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc) 64$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic) 65$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o) 66$(linked_module): PRIVATE_TARGET_CRTEND_SO_O := $(my_target_crtend_so_o) 67 68$(linked_module): \ 69 $(all_objects) \ 70 $(all_libraries) \ 71 $(my_target_crtbegin_so_o) \ 72 $(my_target_crtend_so_o) \ 73 $(my_target_libcrt_builtins) \ 74 $(my_target_libgcc) \ 75 $(my_target_libatomic) \ 76 $(LOCAL_ADDITIONAL_DEPENDENCIES) 77 $(transform-o-to-shared-lib) 78 79ifeq ($(my_native_coverage),true) 80gcno_suffix := .gcnodir 81 82built_whole_gcno_libraries := \ 83 $(foreach lib,$(my_whole_static_libraries), \ 84 $(call intermediates-dir-for, \ 85 STATIC_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX), \ 86 $(my_host_cross))/$(lib)$(gcno_suffix)) 87 88built_static_gcno_libraries := \ 89 $(foreach lib,$(my_static_libraries), \ 90 $(call intermediates-dir-for, \ 91 STATIC_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX), \ 92 $(my_host_cross))/$(lib)$(gcno_suffix)) 93 94ifdef LOCAL_IS_HOST_MODULE 95my_coverage_path := $($(my_prefix)OUT_COVERAGE)/$(patsubst $($(my_prefix)OUT)/%,%,$(my_module_path)) 96else 97my_coverage_path := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path)) 98endif 99 100GCNO_ARCHIVE := $(basename $(my_installed_module_stem))$(gcno_suffix) 101 102$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := $(strip $(LOCAL_GCNO_FILES)) 103$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries)) $(strip $(built_static_gcno_libraries)) 104$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_INTERMEDIATES_DIR := $(intermediates) 105$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries) $(built_static_gcno_libraries) 106 $(transform-o-to-static-lib) 107 108$(my_coverage_path)/$(GCNO_ARCHIVE) : $(intermediates)/$(GCNO_ARCHIVE) 109 $(copy-file-to-target) 110 111$(LOCAL_BUILT_MODULE): $(my_coverage_path)/$(GCNO_ARCHIVE) 112endif 113 114endif # skip_build_from_source 115