2018-09-07 07:25:22 +08:00
|
|
|
# Native prebuilt coming from Soong.
|
|
|
|
# Extra inputs:
|
|
|
|
# LOCAL_SOONG_LINK_TYPE
|
|
|
|
# LOCAL_SOONG_TOC
|
|
|
|
# LOCAL_SOONG_UNSTRIPPED_BINARY
|
2019-05-14 15:44:52 +08:00
|
|
|
# LOCAL_SOONG_VNDK_VERSION : means the version of VNDK where this module belongs
|
2018-09-07 07:25:22 +08:00
|
|
|
|
|
|
|
ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
|
|
|
|
$(call pretty-error,soong_cc_prebuilt.mk may only be used from Soong)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
ifneq ($(HOST_OS),$(LOCAL_MODULE_HOST_OS))
|
|
|
|
my_prefix := HOST_CROSS_
|
|
|
|
LOCAL_HOST_PREFIX := $(my_prefix)
|
|
|
|
else
|
|
|
|
my_prefix := HOST_
|
|
|
|
LOCAL_HOST_PREFIX :=
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
my_prefix := TARGET_
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($($(my_prefix)ARCH),$(LOCAL_MODULE_$(my_prefix)ARCH))
|
|
|
|
# primary arch
|
|
|
|
LOCAL_2ND_ARCH_VAR_PREFIX :=
|
|
|
|
else ifeq ($($(my_prefix)2ND_ARCH),$(LOCAL_MODULE_$(my_prefix)ARCH))
|
|
|
|
# secondary arch
|
|
|
|
LOCAL_2ND_ARCH_VAR_PREFIX := $($(my_prefix)2ND_ARCH_VAR_PREFIX)
|
|
|
|
else
|
|
|
|
$(call pretty-error,Unsupported LOCAL_MODULE_$(my_prefix)ARCH=$(LOCAL_MODULE_$(my_prefix)ARCH))
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Don't install static libraries by default.
|
|
|
|
ifndef LOCAL_UNINSTALLABLE_MODULE
|
|
|
|
ifeq (STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS))
|
|
|
|
LOCAL_UNINSTALLABLE_MODULE := true
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-05-14 15:44:52 +08:00
|
|
|
# Don't install modules of current VNDK when it is told so
|
|
|
|
ifeq ($(TARGET_SKIP_CURRENT_VNDK),true)
|
|
|
|
ifeq ($(LOCAL_SOONG_VNDK_VERSION),$(PLATFORM_VNDK_VERSION))
|
|
|
|
LOCAL_UNINSTALLABLE_MODULE := true
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2018-09-07 07:25:22 +08:00
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
|
|
|
|
# Soong module is a static or shared library
|
2019-08-01 01:31:20 +08:00
|
|
|
EXPORTS_LIST := $(EXPORTS_LIST) $(intermediates)
|
|
|
|
EXPORTS.$(intermediates).FLAGS := $(LOCAL_EXPORT_CFLAGS)
|
|
|
|
EXPORTS.$(intermediates).DEPS := $(LOCAL_EXPORT_C_INCLUDE_DEPS)
|
2018-09-07 07:25:22 +08:00
|
|
|
|
|
|
|
ifdef LOCAL_SOONG_TOC
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_TOC),$(LOCAL_BUILT_MODULE).toc))
|
|
|
|
$(call add-dependency,$(LOCAL_BUILT_MODULE).toc,$(LOCAL_BUILT_MODULE))
|
|
|
|
$(my_all_targets): $(LOCAL_BUILT_MODULE).toc
|
|
|
|
endif
|
|
|
|
|
|
|
|
SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
|
|
|
|
|
|
|
|
my_link_type := $(LOCAL_SOONG_LINK_TYPE)
|
|
|
|
my_warn_types :=
|
|
|
|
my_allowed_types :=
|
|
|
|
my_link_deps :=
|
|
|
|
my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
|
|
|
|
my_common :=
|
|
|
|
include $(BUILD_SYSTEM)/link_type.mk
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef LOCAL_USE_VNDK
|
2018-11-13 12:16:26 +08:00
|
|
|
ifneq ($(LOCAL_VNDK_DEPEND_ON_CORE_VARIANT),true)
|
|
|
|
name_without_suffix := $(patsubst %.vendor,%,$(LOCAL_MODULE))
|
2020-01-20 17:57:01 +08:00
|
|
|
ifneq ($(name_without_suffix),$(LOCAL_MODULE))
|
2018-11-13 12:16:26 +08:00
|
|
|
SPLIT_VENDOR.$(LOCAL_MODULE_CLASS).$(name_without_suffix) := 1
|
2020-01-20 17:57:01 +08:00
|
|
|
else
|
|
|
|
name_without_suffix := $(patsubst %.product,%,$(LOCAL_MODULE))
|
|
|
|
ifneq ($(name_without_suffix),$(LOCAL_MODULE))
|
|
|
|
SPLIT_PRODUCT.$(LOCAL_MODULE_CLASS).$(name_without_suffix) := 1
|
|
|
|
endif
|
2018-11-13 12:16:26 +08:00
|
|
|
endif
|
|
|
|
name_without_suffix :=
|
2018-09-07 07:25:22 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2018-11-06 17:32:40 +08:00
|
|
|
# Check prebuilt ELF binaries.
|
2019-04-03 03:54:35 +08:00
|
|
|
ifdef LOCAL_INSTALLED_MODULE
|
|
|
|
ifneq ($(LOCAL_CHECK_ELF_FILES),)
|
|
|
|
my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE)
|
|
|
|
include $(BUILD_SYSTEM)/check_elf_file.mk
|
|
|
|
endif
|
2018-11-06 17:32:40 +08:00
|
|
|
endif
|
|
|
|
|
2018-09-07 07:25:22 +08:00
|
|
|
# The real dependency will be added after all Android.mks are loaded and the install paths
|
|
|
|
# of the shared libraries are determined.
|
|
|
|
ifdef LOCAL_INSTALLED_MODULE
|
|
|
|
ifdef LOCAL_SHARED_LIBRARIES
|
|
|
|
my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
|
|
|
|
ifdef LOCAL_USE_VNDK
|
|
|
|
my_shared_libraries := $(foreach l,$(my_shared_libraries),\
|
|
|
|
$(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
|
|
|
|
endif
|
|
|
|
$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
|
|
|
|
$(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(my_shared_libraries))
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-01-09 06:39:10 +08:00
|
|
|
my_check_same_vndk_variants :=
|
|
|
|
ifeq ($(LOCAL_CHECK_SAME_VNDK_VARIANTS),true)
|
2020-01-18 07:30:44 +08:00
|
|
|
ifeq ($(filter hwaddress address, $(SANITIZE_TARGET)),)
|
2020-02-25 07:18:45 +08:00
|
|
|
ifneq ($(CLANG_COVERAGE),true)
|
|
|
|
my_check_same_vndk_variants := true
|
|
|
|
endif
|
2020-01-09 06:39:10 +08:00
|
|
|
endif
|
|
|
|
endif
|
2018-11-13 12:16:26 +08:00
|
|
|
|
2020-01-09 06:39:10 +08:00
|
|
|
ifeq ($(my_check_same_vndk_variants),true)
|
|
|
|
same_vndk_variants_stamp := $(intermediates)/same_vndk_variants.timestamp
|
|
|
|
|
|
|
|
my_core_register_name := $(subst .vendor,,$(subst .product,,$(my_register_name)))
|
2018-11-13 12:16:26 +08:00
|
|
|
my_core_variant_files := $(call module-target-built-files,$(my_core_register_name))
|
|
|
|
my_core_shared_lib := $(sort $(filter %.so,$(my_core_variant_files)))
|
|
|
|
|
2020-01-09 06:39:10 +08:00
|
|
|
$(same_vndk_variants_stamp): PRIVATE_CORE_VARIANT := $(my_core_shared_lib)
|
|
|
|
$(same_vndk_variants_stamp): PRIVATE_VENDOR_VARIANT := $(LOCAL_PREBUILT_MODULE_FILE)
|
|
|
|
$(same_vndk_variants_stamp): PRIVATE_TOOLS_PREFIX := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)TOOLS_PREFIX)
|
|
|
|
|
|
|
|
$(same_vndk_variants_stamp): $(my_core_shared_lib) $(LOCAL_PREBUILT_MODULE_FILE)
|
2020-02-21 08:17:01 +08:00
|
|
|
$(call verify-vndk-libs-identical,\
|
|
|
|
$(PRIVATE_CORE_VARIANT),\
|
|
|
|
$(PRIVATE_VENDOR_VARIANT),\
|
|
|
|
$(PRIVATE_TOOLS_PREFIX))
|
|
|
|
touch $@
|
2020-01-09 06:39:10 +08:00
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): $(same_vndk_variants_stamp)
|
2018-11-13 12:16:26 +08:00
|
|
|
endif
|
|
|
|
|
2018-09-07 07:25:22 +08:00
|
|
|
$(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
|
|
|
|
$(transform-prebuilt-to-target)
|
|
|
|
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
|
|
|
|
$(hide) chmod +x $@
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
ifdef LOCAL_SOONG_UNSTRIPPED_BINARY
|
2019-10-07 21:01:58 +08:00
|
|
|
ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true)
|
2018-11-13 12:16:26 +08:00
|
|
|
my_symbol_path := $(if $(LOCAL_SOONG_SYMBOL_PATH),$(LOCAL_SOONG_SYMBOL_PATH),$(my_module_path))
|
|
|
|
# Store a copy with symbols for symbolic debugging
|
|
|
|
my_unstripped_path := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_symbol_path))
|
|
|
|
# drop /root as /root is mounted as /
|
|
|
|
my_unstripped_path := $(patsubst $(TARGET_OUT_UNSTRIPPED)/root/%,$(TARGET_OUT_UNSTRIPPED)/%, $(my_unstripped_path))
|
|
|
|
symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem)
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_SOONG_UNSTRIPPED_BINARY),$(symbolic_output)))
|
|
|
|
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(symbolic_output))
|
|
|
|
|
|
|
|
ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
|
|
|
|
my_breakpad_path := $(TARGET_OUT_BREAKPAD)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_symbol_path))
|
|
|
|
breakpad_output := $(my_breakpad_path)/$(my_installed_module_stem).sym
|
|
|
|
$(breakpad_output) : $(LOCAL_SOONG_UNSTRIPPED_BINARY) | $(BREAKPAD_DUMP_SYMS) $(PRIVATE_READELF)
|
2018-09-07 07:25:22 +08:00
|
|
|
@echo "target breakpad: $(PRIVATE_MODULE) ($@)"
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) if $(PRIVATE_READELF) -S $< > /dev/null 2>&1 ; then \
|
|
|
|
$(BREAKPAD_DUMP_SYMS) -c $< > $@ ; \
|
|
|
|
else \
|
|
|
|
echo "skipped for non-elf file."; \
|
|
|
|
touch $@; \
|
|
|
|
fi
|
2018-11-13 12:16:26 +08:00
|
|
|
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(breakpad_output))
|
|
|
|
endif
|
2018-09-07 07:25:22 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(NATIVE_COVERAGE),true)
|
|
|
|
ifneq (,$(strip $(LOCAL_PREBUILT_COVERAGE_ARCHIVE)))
|
2019-05-01 06:14:44 +08:00
|
|
|
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(intermediates)/$(LOCAL_MODULE).zip))
|
2018-09-07 07:25:22 +08:00
|
|
|
ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true)
|
|
|
|
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
|
2019-05-01 06:14:44 +08:00
|
|
|
my_coverage_path := $(my_coverage_path)/$(patsubst %.so,%,$(my_installed_module_stem)).zip
|
2018-09-07 07:25:22 +08:00
|
|
|
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(my_coverage_path)))
|
|
|
|
$(LOCAL_BUILT_MODULE): $(my_coverage_path)
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
# Coverage information is needed when static lib is a dependency of another
|
|
|
|
# coverage-enabled module.
|
|
|
|
ifeq (STATIC_LIBRARIES, $(LOCAL_MODULE_CLASS))
|
2019-05-01 06:14:44 +08:00
|
|
|
GCNO_ARCHIVE := $(LOCAL_MODULE).zip
|
|
|
|
$(intermediates)/$(GCNO_ARCHIVE) : $(SOONG_ZIP) $(MERGE_ZIPS)
|
2018-09-07 07:25:22 +08:00
|
|
|
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS :=
|
|
|
|
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES :=
|
|
|
|
$(intermediates)/$(GCNO_ARCHIVE) :
|
2019-05-01 06:14:44 +08:00
|
|
|
$(package-coverage-files)
|
2018-09-07 07:25:22 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# A product may be configured to strip everything in some build variants.
|
|
|
|
# We do the stripping as a post-install command so that LOCAL_BUILT_MODULE
|
|
|
|
# is still with the symbols and we don't need to clean it (and relink) when
|
|
|
|
# you switch build variant.
|
|
|
|
ifneq ($(filter $(STRIP_EVERYTHING_BUILD_VARIANTS),$(TARGET_BUILD_VARIANT)),)
|
|
|
|
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := \
|
|
|
|
$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP) --strip-all $(LOCAL_INSTALLED_MODULE)
|
|
|
|
endif
|
|
|
|
|
2018-10-11 11:19:31 +08:00
|
|
|
$(LOCAL_BUILT_MODULE): $(LOCAL_ADDITIONAL_DEPENDENCIES)
|
|
|
|
|
2018-11-02 06:02:25 +08:00
|
|
|
# We don't care about installed static libraries, since the libraries have
|
|
|
|
# already been linked into the module at that point. We do, however, care
|
|
|
|
# about the NOTICE files for any static libraries that we use.
|
|
|
|
# (see notice_files.mk)
|
|
|
|
#
|
|
|
|
# Filter out some NDK libraries that are not being exported.
|
|
|
|
my_static_libraries := \
|
2019-05-09 22:32:02 +08:00
|
|
|
$(filter-out ndk_libc++_static ndk_libc++abi ndk_libandroid_support ndk_libunwind \
|
|
|
|
ndk_libc++_static.native_bridge ndk_libc++abi.native_bridge \
|
|
|
|
ndk_libandroid_support.native_bridge ndk_libunwind.native_bridge, \
|
2018-11-02 06:02:25 +08:00
|
|
|
$(LOCAL_STATIC_LIBRARIES))
|
|
|
|
installed_static_library_notice_file_targets := \
|
|
|
|
$(foreach lib,$(my_static_libraries) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
|
2018-11-09 08:53:02 +08:00
|
|
|
NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST$(if $(my_host_cross),_CROSS,),TARGET)-STATIC_LIBRARIES-$(lib))
|
2018-11-02 06:02:25 +08:00
|
|
|
|
|
|
|
$(notice_target): | $(installed_static_library_notice_file_targets)
|
|
|
|
$(LOCAL_INSTALLED_MODULE): | $(notice_target)
|
2019-10-18 10:24:46 +08:00
|
|
|
|
|
|
|
# Reinstall shared library dependencies of fuzz targets to /data/fuzz/ (for
|
|
|
|
# target) or /data/ (for host).
|
|
|
|
ifdef LOCAL_IS_FUZZ_TARGET
|
|
|
|
$(LOCAL_INSTALLED_MODULE): $(LOCAL_FUZZ_INSTALLED_SHARED_DEPS)
|
|
|
|
endif
|