• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2017 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  $(eval _module_class_folder := $($(strip MODULE_CLASS_$(word 1, $(strip $(ALL_MODULES.$(m).CLASS)\
25    $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS))))))\
26  $(foreach i, $(_built_files),\
27    $(eval bui_ins := $(subst :,$(space),$(i)))\
28    $(eval ins := $(word 2,$(bui_ins)))\
29    $(if $(filter $(TARGET_OUT_ROOT)/%,$(ins)),\
30      $(eval bui := $(word 1,$(bui_ins)))\
31      $(if $(filter $(_module_class_folder), nativetest benchmarktest),\
32        $(eval module_class_folder_stem := $(_module_class_folder)$(findstring 64, $(patsubst $(PRODUCT_OUT)/%,%,$(ins)))),\
33        $(eval module_class_folder_stem := $(_module_class_folder)))\
34      $(eval my_copy_dest := $(patsubst data/%,DATA/%,\
35                               $(patsubst testcases/%,DATA/$(module_class_folder_stem)/%,\
36                                 $(patsubst testcases/$(m)/$(TARGET_ARCH)/%,DATA/$(module_class_folder_stem)/$(m)/%,\
37                                   $(patsubst testcases/$(m)/$(TARGET_2ND_ARCH)/%,DATA/$(module_class_folder_stem)/$(m)/%,\
38                                     $(patsubst system/%,DATA/%,\
39                                       $(patsubst $(PRODUCT_OUT)/%,%,$(ins))))))))\
40      $(bui):$(2)/$(my_copy_dest))))
41endef
42
43# $(1): List of host native files to copy.
44# $(2): Copy destination directory.
45# Evaluates to a list of ":"-separated pairs src:dst.
46define host-native-copy-pairs
47$(foreach m,$(1),\
48  $(eval _built_files := $(strip $(ALL_MODULES.$(m).BUILT_INSTALLED)\
49  $(ALL_MODULES.$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX).BUILT_INSTALLED)))\
50  $(foreach i, $(_built_files),\
51    $(eval bui_ins := $(subst :,$(space),$(i)))\
52    $(eval ins := $(word 2,$(bui_ins)))\
53    $(if $(filter $(HOST_OUT)/% $(HOST_CROSS_OUT)/%,$(ins)),\
54      $(eval bui := $(word 1,$(bui_ins)))\
55      $(eval my_copy_dest := $(patsubst $(HOST_OUT)/%,%,\
56                               $(patsubst $(HOST_CROSS_OUT)/%,%,$(ins))))\
57      $(bui):$(2)/host/$(my_copy_dest))))
58endef
59
60# $(1): The path to the lsdump.
61# $(2): The path to the output dump.
62define lsdump-to-dump
63$(2) : $(1) $(HOST_OUT_EXECUTABLES)/extract_lsdump
64	@echo "Generate:" $(notdir $(2))
65	@mkdir -p $(dir $(2))
66	@rm -f $(2)
67	$(HOST_OUT_EXECUTABLES)/extract_lsdump $(1) $(2)
68endef
69
70# $(1): The target tuple. e.g., arm:arm:armv7-a-neon:32
71# $(2): The output directory. e.g., $(VTS_TESTCASES_OUT)/vts/testcases/vndk/golden.
72# Evaluates to a list of destination files. (i.e. suitable for dependency list)
73define create-vndk-abi-dump-from-target
74$(strip \
75  $(eval target_tuple := $(subst :, ,$(1))) \
76  $(eval primary_arch := $(word 1, $(target_tuple))) \
77  $(eval arch := $(word 2, $(target_tuple))) \
78  $(eval arch_variant := $(word 3, $(target_tuple))) \
79  $(eval binder_bitness := $(word 4, $(target_tuple))) \
80  $(eval target_arch_variant := \
81    $(arch)$(if $(filter $(arch_variant),$(arch)),,_$(arch_variant))) \
82  $(eval lsdump_dir := \
83    prebuilts/abi-dumps/vndk/$(PLATFORM_VNDK_VERSION)/$(binder_bitness)/$(target_arch_variant)/source-based) \
84  $(if $(wildcard $(lsdump_dir)),\
85    $(eval lsdump_names := \
86      $(call find-files-in-subdirs,$(lsdump_dir),"*.lsdump" -and -type f,.)) \
87    $(eval abi_dump_dir := \
88      $(2)/$(PLATFORM_VNDK_VERSION)/binder$(binder_bitness)/$(primary_arch)/$(if $(findstring 64,$(arch)),lib64,lib)) \
89    $(foreach f,$(lsdump_names),\
90      $(eval copy_src := $(lsdump_dir)/$(f)) \
91      $(eval copy_dst := $(abi_dump_dir)/$(f:%.lsdump=%.dump)) \
92      $(eval $(call lsdump-to-dump,$(copy_src),$(copy_dst))) \
93      $(copy_dst))))
94endef
95