2017-10-20 16:46:46 +08:00
|
|
|
# Copyright (C) 2017 The Android Open Source Project
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
current_makefile := $(lastword $(MAKEFILE_LIST))
|
|
|
|
|
|
|
|
# BOARD_VNDK_VERSION must be set to 'current' in order to generate a VNDK snapshot.
|
|
|
|
ifeq ($(BOARD_VNDK_VERSION),current)
|
|
|
|
|
2017-12-21 18:04:13 +08:00
|
|
|
# PLATFORM_VNDK_VERSION must be set.
|
|
|
|
ifneq (,$(PLATFORM_VNDK_VERSION))
|
|
|
|
|
2018-01-04 09:51:16 +08:00
|
|
|
# BOARD_VNDK_RUNTIME_DISABLE must not be set to 'true'.
|
|
|
|
ifneq ($(BOARD_VNDK_RUNTIME_DISABLE),true)
|
|
|
|
|
2018-06-18 12:47:18 +08:00
|
|
|
# Returns list of src:dest paths of the intermediate objs
|
2017-11-22 18:25:36 +08:00
|
|
|
#
|
2017-10-20 16:46:46 +08:00
|
|
|
# Args:
|
2017-12-22 10:24:00 +08:00
|
|
|
# $(1): list of module and filename pairs (e.g., ld.config.txt:ld.config.27.txt ...)
|
2018-06-18 12:47:18 +08:00
|
|
|
# $(2): if not empty, evaluates for TARGET_2ND_ARCH
|
2017-10-20 16:46:46 +08:00
|
|
|
define paths-of-intermediates
|
2017-11-22 18:25:36 +08:00
|
|
|
$(strip \
|
2017-12-22 10:24:00 +08:00
|
|
|
$(foreach pair,$(1), \
|
2018-06-18 12:47:18 +08:00
|
|
|
$(eval module := $(call word-colon,1,$(pair))$(if $(2),$(TARGET_2ND_ARCH_MODULE_SUFFIX))) \
|
|
|
|
$(eval built := $(ALL_MODULES.$(module).BUILT_INSTALLED)) \
|
|
|
|
$(eval filename := $(call word-colon,2,$(pair))) \
|
|
|
|
$(if $(wordlist 2,100,$(built)), \
|
|
|
|
$(error Unable to handle multiple built files ($(module)): $(built))) \
|
|
|
|
$(if $(built),$(call word-colon,1,$(built)):$(filename)) \
|
2017-11-22 18:25:36 +08:00
|
|
|
) \
|
|
|
|
)
|
2017-10-20 16:46:46 +08:00
|
|
|
endef
|
|
|
|
|
2018-06-18 12:47:18 +08:00
|
|
|
# Returns src:dest list of notice files
|
2017-12-15 18:35:16 +08:00
|
|
|
#
|
|
|
|
# Args:
|
|
|
|
# $(1): list of lib names (e.g., libfoo.vendor)
|
|
|
|
define paths-of-notice-files
|
|
|
|
$(strip \
|
|
|
|
$(foreach lib,$(1), \
|
2018-06-18 12:47:18 +08:00
|
|
|
$(eval notice := $(sort \
|
|
|
|
$(ALL_MODULES.$(lib).NOTICES) \
|
|
|
|
$(if $(TARGET_2ND_ARCH),
|
|
|
|
$(ALL_MODULES.$(lib)$(TARGET_2ND_ARCH_MODULE_SUFFIX).NOTICES)))) \
|
|
|
|
$(if $(wordlist 2,100,$(notice)), \
|
|
|
|
$(error Unable to handle multiple notice files ($(lib)): $(notice))) \
|
|
|
|
$(if $(notice),$(notice):$(subst .vendor,,$(lib)).so.txt)))
|
2017-12-15 18:35:16 +08:00
|
|
|
endef
|
|
|
|
|
2018-07-26 11:04:31 +08:00
|
|
|
vndk_core_libs := $(addsuffix .vendor,$(VNDK_CORE_LIBRARIES))
|
2017-11-22 18:25:36 +08:00
|
|
|
vndk_sp_libs := $(addsuffix .vendor,$(VNDK_SAMEPROCESS_LIBRARIES))
|
|
|
|
vndk_private_libs := $(addsuffix .vendor,$(VNDK_PRIVATE_LIBRARIES))
|
2017-10-20 16:46:46 +08:00
|
|
|
|
2017-11-22 18:25:36 +08:00
|
|
|
vndk_snapshot_libs := \
|
|
|
|
$(vndk_core_libs) \
|
|
|
|
$(vndk_sp_libs)
|
|
|
|
|
|
|
|
vndk_prebuilt_txts := \
|
|
|
|
ld.config.txt \
|
|
|
|
vndksp.libraries.txt \
|
|
|
|
llndk.libraries.txt
|
|
|
|
|
|
|
|
vndk_snapshot_top := $(call intermediates-dir-for,PACKAGING,vndk-snapshot)
|
|
|
|
vndk_snapshot_out := $(vndk_snapshot_top)/vndk-snapshot
|
|
|
|
vndk_snapshot_configs_out := $(vndk_snapshot_top)/configs
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
# vndkcore.libraries.txt
|
|
|
|
vndkcore.libraries.txt := $(vndk_snapshot_configs_out)/vndkcore.libraries.txt
|
2018-06-18 12:47:18 +08:00
|
|
|
$(vndkcore.libraries.txt): PRIVATE_LIBS := $(vndk_core_libs)
|
|
|
|
$(vndkcore.libraries.txt):
|
2017-11-22 18:25:36 +08:00
|
|
|
@echo 'Generating: $@'
|
|
|
|
@rm -f $@
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) echo -n > $@
|
2018-06-18 12:47:18 +08:00
|
|
|
$(hide) $(foreach lib,$(PRIVATE_LIBS),echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
|
2017-11-22 18:25:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
# vndkprivate.libraries.txt
|
|
|
|
vndkprivate.libraries.txt := $(vndk_snapshot_configs_out)/vndkprivate.libraries.txt
|
2018-06-18 12:47:18 +08:00
|
|
|
$(vndkprivate.libraries.txt): PRIVATE_LIBS := $(vndk_private_libs)
|
|
|
|
$(vndkprivate.libraries.txt):
|
2017-11-22 18:25:36 +08:00
|
|
|
@echo 'Generating: $@'
|
|
|
|
@rm -f $@
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) echo -n > $@
|
2018-06-18 12:47:18 +08:00
|
|
|
$(hide) $(foreach lib,$(PRIVATE_LIBS),echo $(patsubst %.vendor,%,$(lib)).so >> $@;)
|
2017-10-20 16:46:46 +08:00
|
|
|
|
2017-11-22 18:25:36 +08:00
|
|
|
|
2017-12-15 18:35:16 +08:00
|
|
|
#######################################
|
|
|
|
# module_paths.txt
|
|
|
|
module_paths.txt := $(vndk_snapshot_configs_out)/module_paths.txt
|
2018-06-18 12:47:18 +08:00
|
|
|
$(module_paths.txt): PRIVATE_LIBS := $(vndk_snapshot_libs)
|
|
|
|
$(module_paths.txt):
|
2017-12-15 18:35:16 +08:00
|
|
|
@echo 'Generating: $@'
|
|
|
|
@rm -f $@
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) echo -n > $@
|
2018-06-18 12:47:18 +08:00
|
|
|
$(hide) $(foreach lib,$(PRIVATE_LIBS),echo $(patsubst %.vendor,%,$(lib)).so $(ALL_MODULES.$(lib).PATH) >> $@;)
|
2017-12-15 18:35:16 +08:00
|
|
|
|
|
|
|
|
2017-11-22 18:25:36 +08:00
|
|
|
vndk_snapshot_configs := \
|
|
|
|
$(vndkcore.libraries.txt) \
|
2017-12-15 18:35:16 +08:00
|
|
|
$(vndkprivate.libraries.txt) \
|
|
|
|
$(module_paths.txt)
|
2017-11-22 18:25:36 +08:00
|
|
|
|
|
|
|
#######################################
|
|
|
|
# vndk_snapshot_zip
|
2017-12-28 15:00:10 +08:00
|
|
|
vndk_snapshot_variant := $(vndk_snapshot_out)/$(TARGET_ARCH)
|
2018-05-30 20:01:29 +08:00
|
|
|
binder :=
|
2018-07-24 15:12:42 +08:00
|
|
|
ifneq ($(TARGET_IS_64_BIT), true)
|
|
|
|
ifneq ($(TARGET_USES_64_BIT_BINDER), true)
|
|
|
|
binder := binder32
|
|
|
|
endif
|
2018-05-30 20:01:29 +08:00
|
|
|
endif
|
|
|
|
vndk_lib_dir := $(subst $(space),/,$(strip $(vndk_snapshot_variant) $(binder) arch-$(TARGET_ARCH)-$(TARGET_ARCH_VARIANT)))
|
|
|
|
vndk_lib_dir_2nd := $(subst $(space),/,$(strip $(vndk_snapshot_variant) $(binder) arch-$(TARGET_2ND_ARCH)-$(TARGET_2ND_ARCH_VARIANT)))
|
|
|
|
vndk_snapshot_zip := $(PRODUCT_OUT)/android-vndk-$(TARGET_PRODUCT).zip
|
2017-11-22 18:25:36 +08:00
|
|
|
|
2017-10-20 16:46:46 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_VNDK_SNAPSHOT_OUT := $(vndk_snapshot_out)
|
|
|
|
|
2018-06-18 12:47:18 +08:00
|
|
|
deps := $(call paths-of-intermediates,$(foreach lib,$(vndk_core_libs),$(lib):$(subst .vendor,,$(lib)).so))
|
2017-12-28 15:00:10 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_OUT := $(vndk_lib_dir)/shared/vndk-core
|
2018-06-18 12:47:18 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES := $(deps)
|
|
|
|
$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
|
|
|
|
deps :=
|
2017-11-22 18:25:36 +08:00
|
|
|
|
2018-06-18 12:47:18 +08:00
|
|
|
deps := $(call paths-of-intermediates,$(foreach lib,$(vndk_sp_libs),$(lib):$(subst .vendor,,$(lib)).so))
|
2017-12-28 15:00:10 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_OUT := $(vndk_lib_dir)/shared/vndk-sp
|
2018-06-18 12:47:18 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES := $(deps)
|
|
|
|
$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
|
|
|
|
deps :=
|
2017-11-22 18:25:36 +08:00
|
|
|
|
2018-06-18 12:47:18 +08:00
|
|
|
deps := $(call paths-of-intermediates,$(foreach txt,$(vndk_prebuilt_txts), \
|
|
|
|
$(txt):$(patsubst %.txt,%.$(PLATFORM_VNDK_VERSION).txt,$(txt)))) \
|
|
|
|
$(foreach config,$(vndk_snapshot_configs),$(config):$(notdir $(config)))
|
2017-12-28 15:00:10 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_CONFIGS_OUT := $(vndk_snapshot_variant)/configs
|
2018-06-18 12:47:18 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_CONFIGS_INTERMEDIATES := $(deps)
|
|
|
|
$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
|
|
|
|
deps :=
|
2017-11-22 18:25:36 +08:00
|
|
|
|
2018-06-18 12:47:18 +08:00
|
|
|
notices := $(call paths-of-notice-files,$(vndk_core_libs) $(vndk_sp_libs))
|
2017-12-28 15:00:10 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_NOTICE_FILES_OUT := $(vndk_snapshot_variant)/NOTICE_FILES
|
2018-06-18 12:47:18 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_NOTICE_FILES_INTERMEDIATES := $(notices)
|
|
|
|
$(vndk_snapshot_zip): $(foreach n,$(notices),$(call word-colon,1,$(n)))
|
|
|
|
notices :=
|
2017-12-15 18:35:16 +08:00
|
|
|
|
2017-12-28 15:00:10 +08:00
|
|
|
ifdef TARGET_2ND_ARCH
|
2018-06-18 12:47:18 +08:00
|
|
|
deps := $(call paths-of-intermediates,$(foreach lib,$(vndk_core_libs),$(lib):$(subst .vendor,,$(lib)).so),true)
|
2017-12-28 15:00:10 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_OUT_2ND := $(vndk_lib_dir_2nd)/shared/vndk-core
|
2018-06-18 12:47:18 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_VNDK_CORE_INTERMEDIATES_2ND := $(deps)
|
|
|
|
$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
|
|
|
|
deps :=
|
2017-12-28 15:00:10 +08:00
|
|
|
|
2018-06-18 12:47:18 +08:00
|
|
|
deps := $(call paths-of-intermediates,$(foreach lib,$(vndk_sp_libs),$(lib):$(subst .vendor,,$(lib)).so),true)
|
2017-12-28 15:00:10 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_OUT_2ND := $(vndk_lib_dir_2nd)/shared/vndk-sp
|
2018-06-18 12:47:18 +08:00
|
|
|
$(vndk_snapshot_zip): PRIVATE_VNDK_SP_INTERMEDIATES_2ND := $(deps)
|
|
|
|
$(vndk_snapshot_zip): $(foreach d,$(deps),$(call word-colon,1,$(d)))
|
|
|
|
deps :=
|
2017-12-28 15:00:10 +08:00
|
|
|
endif
|
2017-10-20 16:46:46 +08:00
|
|
|
|
|
|
|
# Args
|
|
|
|
# $(1): destination directory
|
2018-06-18 12:47:18 +08:00
|
|
|
# $(2): list of files (src:dest) to copy
|
|
|
|
$(vndk_snapshot_zip): private-copy-intermediates = \
|
2017-11-22 18:25:36 +08:00
|
|
|
$(if $(2),$(strip \
|
2018-06-18 12:47:18 +08:00
|
|
|
@mkdir -p $(1) && \
|
2017-11-22 18:25:36 +08:00
|
|
|
$(foreach file,$(2), \
|
2018-06-18 12:47:18 +08:00
|
|
|
cp $(call word-colon,1,$(file)) $(call append-path,$(1),$(call word-colon,2,$(file))) && \
|
2017-11-22 18:25:36 +08:00
|
|
|
) \
|
2018-06-18 12:47:18 +08:00
|
|
|
true \
|
2017-11-22 18:25:36 +08:00
|
|
|
))
|
|
|
|
|
2017-10-20 16:46:46 +08:00
|
|
|
|
2018-06-18 12:47:18 +08:00
|
|
|
$(vndk_snapshot_zip): $(SOONG_ZIP)
|
2017-10-20 16:46:46 +08:00
|
|
|
@echo 'Generating VNDK snapshot: $@'
|
|
|
|
@rm -f $@
|
|
|
|
@rm -rf $(PRIVATE_VNDK_SNAPSHOT_OUT)
|
|
|
|
@mkdir -p $(PRIVATE_VNDK_SNAPSHOT_OUT)
|
2018-06-18 12:47:18 +08:00
|
|
|
$(call private-copy-intermediates, \
|
2017-11-22 18:25:36 +08:00
|
|
|
$(PRIVATE_VNDK_CORE_OUT),$(PRIVATE_VNDK_CORE_INTERMEDIATES))
|
2018-06-18 12:47:18 +08:00
|
|
|
$(call private-copy-intermediates, \
|
2017-12-04 12:16:21 +08:00
|
|
|
$(PRIVATE_VNDK_SP_OUT),$(PRIVATE_VNDK_SP_INTERMEDIATES))
|
2018-06-18 12:47:18 +08:00
|
|
|
$(call private-copy-intermediates, \
|
2017-11-22 18:25:36 +08:00
|
|
|
$(PRIVATE_CONFIGS_OUT),$(PRIVATE_CONFIGS_INTERMEDIATES))
|
2018-06-18 12:47:18 +08:00
|
|
|
$(call private-copy-intermediates, \
|
2017-12-15 18:35:16 +08:00
|
|
|
$(PRIVATE_NOTICE_FILES_OUT),$(PRIVATE_NOTICE_FILES_INTERMEDIATES))
|
2017-12-28 15:00:10 +08:00
|
|
|
ifdef TARGET_2ND_ARCH
|
2018-06-18 12:47:18 +08:00
|
|
|
$(call private-copy-intermediates, \
|
2017-12-28 15:00:10 +08:00
|
|
|
$(PRIVATE_VNDK_CORE_OUT_2ND),$(PRIVATE_VNDK_CORE_INTERMEDIATES_2ND))
|
2018-06-18 12:47:18 +08:00
|
|
|
$(call private-copy-intermediates, \
|
2017-12-28 15:00:10 +08:00
|
|
|
$(PRIVATE_VNDK_SP_OUT_2ND),$(PRIVATE_VNDK_SP_INTERMEDIATES_2ND))
|
|
|
|
endif
|
2017-12-04 12:16:21 +08:00
|
|
|
$(hide) $(SOONG_ZIP) -o $@ -C $(PRIVATE_VNDK_SNAPSHOT_OUT) -D $(PRIVATE_VNDK_SNAPSHOT_OUT)
|
2017-10-20 16:46:46 +08:00
|
|
|
|
|
|
|
.PHONY: vndk
|
|
|
|
vndk: $(vndk_snapshot_zip)
|
|
|
|
|
|
|
|
$(call dist-for-goals, vndk, $(vndk_snapshot_zip))
|
|
|
|
|
2017-11-22 18:25:36 +08:00
|
|
|
# clear global vars
|
|
|
|
clang-ubsan-vndk-core :=
|
|
|
|
paths-of-intermediates :=
|
2017-12-15 18:35:16 +08:00
|
|
|
paths-of-notice-files :=
|
2017-11-22 18:25:36 +08:00
|
|
|
vndk_core_libs :=
|
|
|
|
vndk_sp_libs :=
|
|
|
|
vndk_snapshot_libs :=
|
|
|
|
vndk_prebuilt_txts :=
|
|
|
|
vndk_snapshot_configs :=
|
|
|
|
vndk_snapshot_top :=
|
|
|
|
vndk_snapshot_out :=
|
|
|
|
vndk_snapshot_configs_out :=
|
2017-12-28 15:00:10 +08:00
|
|
|
vndk_snapshot_variant :=
|
2018-05-30 20:01:29 +08:00
|
|
|
binder :=
|
2017-12-28 15:00:10 +08:00
|
|
|
vndk_lib_dir :=
|
|
|
|
vndk_lib_dir_2nd :=
|
2017-11-22 18:25:36 +08:00
|
|
|
|
2018-01-04 09:51:16 +08:00
|
|
|
else # BOARD_VNDK_RUNTIME_DISABLE is set to 'true'
|
|
|
|
error_msg := "CANNOT generate VNDK snapshot. BOARD_VNDK_RUNTIME_DISABLE must not be set to 'true'."
|
|
|
|
endif # BOARD_VNDK_RUNTIME_DISABLE
|
2017-12-21 18:04:13 +08:00
|
|
|
|
2018-01-04 09:51:16 +08:00
|
|
|
else # PLATFORM_VNDK_VERSION is NOT set
|
|
|
|
error_msg := "CANNOT generate VNDK snapshot. PLATFORM_VNDK_VERSION must be set."
|
2017-12-21 18:04:13 +08:00
|
|
|
endif # PLATFORM_VNDK_VERSION
|
|
|
|
|
2017-10-20 16:46:46 +08:00
|
|
|
else # BOARD_VNDK_VERSION is NOT set to 'current'
|
2018-01-04 09:51:16 +08:00
|
|
|
error_msg := "CANNOT generate VNDK snapshot. BOARD_VNDK_VERSION must be set to 'current'."
|
|
|
|
endif # BOARD_VNDK_VERSION
|
|
|
|
|
|
|
|
ifneq (,$(error_msg))
|
2017-10-20 16:46:46 +08:00
|
|
|
|
|
|
|
.PHONY: vndk
|
|
|
|
vndk:
|
2018-01-04 09:51:16 +08:00
|
|
|
$(call echo-error,$(current_makefile),$(error_msg))
|
2017-10-20 16:46:46 +08:00
|
|
|
exit 1
|
|
|
|
|
2018-01-04 09:51:16 +08:00
|
|
|
endif
|