| Dan Willemsen | 78c40be | 2018-10-17 16:50:49 -0700 | [diff] [blame] | 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: | 
|  | 18 | DIST_GOAL_OUTPUT_PAIRS := | 
|  | 19 | DIST_SRC_DST_PAIRS := | 
|  | 20 | include $(KATI_PACKAGE_MK_DIR)/dist.mk | 
| Jeongik Cha | 05210f9 | 2023-04-27 11:05:22 +0900 | [diff] [blame] | 21 | FILE_NAME_TAG := $(file <$(OUT_DIR)/file_name_tag.txt) | 
|  | 22 | .KATI_READONLY := FILE_NAME_TAG | 
| Dan Willemsen | 78c40be | 2018-10-17 16:50:49 -0700 | [diff] [blame] | 23 |  | 
|  | 24 | $(foreach pair,$(DIST_GOAL_OUTPUT_PAIRS), \ | 
|  | 25 | $(eval goal := $(call word-colon,1,$(pair))) \ | 
| Jeongik Cha | 05210f9 | 2023-04-27 11:05:22 +0900 | [diff] [blame] | 26 | $(eval output := $(subst FILE_NAME_TAG_PLACEHOLDER,$(FILE_NAME_TAG),$(call word-colon,2,$(pair)))) \ | 
| Dan Willemsen | 78c40be | 2018-10-17 16:50:49 -0700 | [diff] [blame] | 27 | $(eval .PHONY: _dist_$$(goal)) \ | 
|  | 28 | $(if $(call streq,$(DIST),true),\ | 
| Dan Willemsen | c2fdc23 | 2018-10-21 08:56:27 -0700 | [diff] [blame] | 29 | $(eval _dist_$$(goal): $$(DIST_DIR)/$$(output)), \ | 
|  | 30 | $(eval _dist_$$(goal):))) | 
| Dan Willemsen | 78c40be | 2018-10-17 16:50:49 -0700 | [diff] [blame] | 31 |  | 
|  | 32 | define copy-one-dist-file | 
| Dan Albert | fd5f1e7 | 2023-06-08 21:09:37 +0000 | [diff] [blame] | 33 | $(2): .KATI_TAGS += ;rule_name=dist-cp | 
| Dan Willemsen | 78c40be | 2018-10-17 16:50:49 -0700 | [diff] [blame] | 34 | $(2): $(1) | 
|  | 35 | @echo "Dist: $$@" | 
|  | 36 | rm -f $$@ | 
|  | 37 | cp $$< $$@ | 
|  | 38 | endef | 
|  | 39 |  | 
|  | 40 | ifeq ($(DIST),true) | 
|  | 41 | $(foreach pair,$(DIST_SRC_DST_PAIRS), \ | 
|  | 42 | $(eval src := $(call word-colon,1,$(pair))) \ | 
| Jeongik Cha | 05210f9 | 2023-04-27 11:05:22 +0900 | [diff] [blame] | 43 | $(eval dst := $(subst FILE_NAME_TAG_PLACEHOLDER,$(FILE_NAME_TAG),$(DIST_DIR)/$(call word-colon,2,$(pair)))) \ | 
| Dan Willemsen | 78c40be | 2018-10-17 16:50:49 -0700 | [diff] [blame] | 44 | $(eval $(call copy-one-dist-file,$(src),$(dst)))) | 
|  | 45 | endif | 
|  | 46 |  | 
|  | 47 | copy-one-dist-file := | 
|  | 48 | DIST_GOAL_OUTPUT_PAIRS := | 
|  | 49 | DIST_SRC_DST_PAIRS := |