1# 2# Copyright (C) 2018 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17# $(1): List of target native files to copy. 18# $(2): Copy destination directory. 19# Evaluates to a list of ":"-separated pairs src:dst. 20define target-native-copy-pairs 21$(foreach m,$(1),\ 22 $(eval _built_files := $(strip $(ALL_MODULES.$(m).BUILT_INSTALLED)\ 23 $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).BUILT_INSTALLED)))\ 24 $(foreach i, $(_built_files),\ 25 $(eval bui_ins := $(subst :,$(space),$(i)))\ 26 $(eval ins := $(word 2,$(bui_ins)))\ 27 $(if $(filter $(TARGET_OUT_ROOT)/%,$(ins)),\ 28 $(eval bui := $(word 1,$(bui_ins)))\ 29 $(eval my_copy_dest := $(patsubst data/%,DATA/%,\ 30 $(patsubst system/%,DATA/%,\ 31 $(patsubst $(PRODUCT_OUT)/%,%,$(ins)))))\ 32 $(bui):$(2)/$(my_copy_dest)))) 33endef 34 35# $(1): List of host native files to copy. 36# $(2): Copy destination directory. 37# Evaluates to a list of ":"-separated pairs src:dst. 38define host-native-copy-pairs 39$(foreach m,$(1),\ 40 $(eval _built_files := $(strip $(ALL_MODULES.$(m).BUILT_INSTALLED)\ 41 $(ALL_MODULES.$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX).BUILT_INSTALLED)))\ 42 $(foreach i, $(_built_files),\ 43 $(eval bui_ins := $(subst :,$(space),$(i)))\ 44 $(eval ins := $(word 2,$(bui_ins)))\ 45 $(if $(filter $(HOST_OUT)/% $(HOST_CROSS_OUT)/%,$(ins)),\ 46 $(eval bui := $(word 1,$(bui_ins)))\ 47 $(eval my_copy_dest := $(patsubst $(HOST_OUT)/%,%,\ 48 $(patsubst $(HOST_CROSS_OUT)/%,%,$(ins))))\ 49 $(bui):$(2)/$(my_copy_dest)))) 50endef 51