summaryrefslogtreecommitdiff
path: root/buildlib/copy.mak
blob: 3ae11a7eb9fec54d317881ed62c96cb43f511a6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- make -*-

# This installs arbitrary files into a directory

# Input
# $(SOURCE) - The documents to use
# $(TO)     - The directory to put them in
# $(TARGET) - The global target to add the local target as a dependency
#             to.
# All output is writtin to files in the build/$(TO) directory

# See defaults.mak for information about LOCAL

# Some local definitions
LOCAL := copy-$(firstword $(SOURCE))
$(LOCAL)-LIST := $(addprefix $(TO)/,$(SOURCE))

# Install generation hooks
$(TARGET): $($(LOCAL)-LIST)
veryclean: veryclean/$(LOCAL)

MKDIRS += $(dir $($(LOCAL)-LIST))

$($(LOCAL)-LIST) : $(TO)/% : %
	echo Installing $< to $(@D)
	cp $< $(@D)

# Clean rule
.PHONY: veryclean/$(LOCAL)
veryclean/$(LOCAL):
	-rm -rf $($(@F)-LIST)