2014-01-16 21:36:34 +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
|
2014-03-21 20:27:37 +01:00
|
|
|
ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)$(LOCAL_MODULE_STEM_32)$(LOCAL_MODULE_STEM_64)),)
|
2014-01-16 21:36:34 +01:00
|
|
|
$(error $(LOCAL_PATH): Cannot set module stem for a library)
|
|
|
|
endif
|
|
|
|
|
2018-01-30 01:18:40 +01:00
|
|
|
ifdef target-shared-library-hook
|
2014-01-16 21:36:34 +01:00
|
|
|
$(call target-shared-library-hook)
|
2018-01-30 01:18:40 +01:00
|
|
|
endif
|
2014-01-16 21:36:34 +01:00
|
|
|
|
|
|
|
skip_build_from_source :=
|
|
|
|
ifdef LOCAL_PREBUILT_MODULE_FILE
|
|
|
|
ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
|
2014-02-26 03:26:29 +01:00
|
|
|
include $(BUILD_SYSTEM)/prebuilt_internal.mk
|
2014-01-16 21:36:34 +01:00
|
|
|
skip_build_from_source := true
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef skip_build_from_source
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/dynamic_binary.mk
|
|
|
|
|
|
|
|
# Define PRIVATE_ variables from global vars
|
2018-11-06 21:59:32 +01:00
|
|
|
ifeq ($(LOCAL_NO_LIBCRT_BUILTINS),true)
|
|
|
|
my_target_libcrt_builtins :=
|
|
|
|
else
|
2018-10-13 01:58:57 +02:00
|
|
|
my_target_libcrt_builtins := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBCRT_BUILTINS)
|
2018-11-06 21:59:32 +01:00
|
|
|
endif
|
2015-07-03 00:57:45 +02:00
|
|
|
ifeq ($(LOCAL_NO_CRT),true)
|
|
|
|
my_target_crtbegin_so_o :=
|
|
|
|
my_target_crtend_so_o :=
|
2024-02-05 02:22:04 +01:00
|
|
|
else ifeq ($(call module-in-vendor-or-product),true)
|
2018-09-05 20:01:12 +02:00
|
|
|
my_target_crtbegin_so_o := $(SOONG_$(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJECT_crtbegin_so.vendor)
|
|
|
|
my_target_crtend_so_o := $(SOONG_$(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJECT_crtend_so.vendor)
|
2015-07-03 00:57:45 +02:00
|
|
|
else
|
2018-09-05 20:01:12 +02:00
|
|
|
my_target_crtbegin_so_o := $(SOONG_$(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJECT_crtbegin_so)
|
|
|
|
my_target_crtend_so_o := $(SOONG_$(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJECT_crtend_so)
|
2015-07-03 00:57:45 +02:00
|
|
|
endif
|
2017-04-08 05:58:43 +02:00
|
|
|
ifneq ($(LOCAL_SDK_VERSION),)
|
2020-07-17 02:12:07 +02:00
|
|
|
my_target_crtbegin_so_o := $(SOONG_$(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJECT_crtbegin_so.sdk.$(my_ndk_crt_version))
|
|
|
|
my_target_crtend_so_o := $(SOONG_$(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJECT_crtend_so.sdk.$(my_ndk_crt_version))
|
2014-01-16 21:36:34 +01:00
|
|
|
endif
|
2018-10-13 01:58:57 +02:00
|
|
|
$(linked_module): PRIVATE_TARGET_LIBCRT_BUILTINS := $(my_target_libcrt_builtins)
|
2014-01-16 21:36:34 +01: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 07:20:03 +01:00
|
|
|
$(linked_module): \
|
|
|
|
$(all_objects) \
|
|
|
|
$(all_libraries) \
|
|
|
|
$(my_target_crtbegin_so_o) \
|
|
|
|
$(my_target_crtend_so_o) \
|
2018-10-13 01:58:57 +02:00
|
|
|
$(my_target_libcrt_builtins) \
|
2019-06-12 07:59:53 +02:00
|
|
|
$(LOCAL_ADDITIONAL_DEPENDENCIES) $(CLANG_CXX)
|
2014-01-16 21:36:34 +01:00
|
|
|
$(transform-o-to-shared-lib)
|
|
|
|
|
2016-09-12 22:56:50 +02:00
|
|
|
ifeq ($(my_native_coverage),true)
|
2019-05-01 00:14:44 +02:00
|
|
|
gcno_suffix := .zip
|
2016-09-12 22:56:50 +02:00
|
|
|
|
|
|
|
built_whole_gcno_libraries := \
|
|
|
|
$(foreach lib,$(my_whole_static_libraries), \
|
|
|
|
$(call intermediates-dir-for, \
|
|
|
|
STATIC_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX), \
|
|
|
|
$(my_host_cross))/$(lib)$(gcno_suffix))
|
|
|
|
|
|
|
|
built_static_gcno_libraries := \
|
|
|
|
$(foreach lib,$(my_static_libraries), \
|
|
|
|
$(call intermediates-dir-for, \
|
|
|
|
STATIC_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX), \
|
|
|
|
$(my_host_cross))/$(lib)$(gcno_suffix))
|
|
|
|
|
2016-10-03 20:23:40 +02:00
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
my_coverage_path := $($(my_prefix)OUT_COVERAGE)/$(patsubst $($(my_prefix)OUT)/%,%,$(my_module_path))
|
|
|
|
else
|
|
|
|
my_coverage_path := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
|
|
|
|
endif
|
|
|
|
|
|
|
|
GCNO_ARCHIVE := $(basename $(my_installed_module_stem))$(gcno_suffix)
|
2016-09-12 22:56:50 +02:00
|
|
|
|
2019-05-01 00:14:44 +02:00
|
|
|
$(intermediates)/$(GCNO_ARCHIVE) : $(SOONG_ZIP) $(MERGE_ZIPS)
|
2016-09-12 22:56:50 +02:00
|
|
|
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := $(strip $(LOCAL_GCNO_FILES))
|
|
|
|
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries)) $(strip $(built_static_gcno_libraries))
|
|
|
|
$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries) $(built_static_gcno_libraries)
|
2019-05-01 00:14:44 +02:00
|
|
|
$(package-coverage-files)
|
2016-09-12 22:56:50 +02:00
|
|
|
|
2016-10-03 20:23:40 +02:00
|
|
|
$(my_coverage_path)/$(GCNO_ARCHIVE) : $(intermediates)/$(GCNO_ARCHIVE)
|
2016-09-12 22:56:50 +02:00
|
|
|
$(copy-file-to-target)
|
|
|
|
|
2016-10-03 20:23:40 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): $(my_coverage_path)/$(GCNO_ARCHIVE)
|
2016-09-12 22:56:50 +02:00
|
|
|
endif
|
|
|
|
|
2014-01-16 21:36:34 +01:00
|
|
|
endif # skip_build_from_source
|