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# From the Android.mk pass:
18DIST_GOAL_OUTPUT_PAIRS :=
19DIST_SRC_DST_PAIRS :=
20include $(KATI_PACKAGE_MK_DIR)/dist.mk
21
22$(foreach pair,$(DIST_GOAL_OUTPUT_PAIRS), \
23  $(eval goal := $(call word-colon,1,$(pair))) \
24  $(eval output := $(call word-colon,2,$(pair))) \
25  $(eval .PHONY: _dist_$$(goal)) \
26  $(if $(call streq,$(DIST),true),\
27    $(eval _dist_$$(goal): $$(DIST_DIR)/$$(output)), \
28    $(eval _dist_$$(goal):)))
29
30define copy-one-dist-file
31$(2): $(1)
32	@echo "Dist: $$@"
33	rm -f $$@
34	cp $$< $$@
35endef
36
37ifeq ($(DIST),true)
38  $(foreach pair,$(DIST_SRC_DST_PAIRS), \
39    $(eval src := $(call word-colon,1,$(pair))) \
40    $(eval dst := $(DIST_DIR)/$(call word-colon,2,$(pair))) \
41    $(eval $(call copy-one-dist-file,$(src),$(dst))))
42endif
43
44copy-one-dist-file :=
45DIST_GOAL_OUTPUT_PAIRS :=
46DIST_SRC_DST_PAIRS :=
47