tree.mk 1.34 KB
Newer Older
1 2
all:

3 4 5 6 7 8 9
TREES_=${TREES}
ROOT_=${ROOT}

.for TARGET in _ ${EXTRA:C/.*/_&/g}

install${TARGET}: force
.for TREE in ${TREES${TARGET}}
10 11
	@REALTARGET=/$$(dirname ${TREE}); \
	mkdir -p ${DESTDIR}${ROOT${TARGET}}$${REALTARGET}; \
12
	cp -vr ${TREE} ${DESTDIR}${ROOT${TARGET}}$${REALTARGET}
13 14 15 16 17
	@(cd ${TREE}; find * -type f) | while read FILE; do \
		if [ $${FILE%%.in} != $${FILE} ]; then \
			sed -i '' \
			    -e "s=%%CORE_PACKAGESITE%%=${CORE_PACKAGESITE}=g" \
			    -e "s=%%CORE_REPOSITORY%%=${CORE_REPOSITORY}=g" \
18 19 20
			    ${DESTDIR}${ROOT${TARGET}}/${TREE}/$${FILE}; \
			mv -v ${DESTDIR}${ROOT${TARGET}}/${TREE}/$${FILE} \
			    ${DESTDIR}${ROOT${TARGET}}/${TREE}/$${FILE%%.in}; \
21 22 23 24 25 26
		fi; \
		FILE="$${FILE%%.in}"; \
		if [ -n "${NO_SAMPLE}" -a $${FILE%%.sample} != $${FILE} ]; then \
			mv -v ${DESTDIR}${ROOT${TARGET}}/${TREE}/$${FILE} \
			    ${DESTDIR}${ROOT${TARGET}}/${TREE}/$${FILE%%.sample}; \
		fi; \
27
	done
28 29
.endfor

30 31
plist${TARGET}: force
.for TREE in ${TREES${TARGET}}
32
	@(cd ${TREE}; find * -type f) | while read FILE; do \
33
		FILE="$${FILE%%.in}"; PREFIX=""; \
34
		if [ -z "${NO_SAMPLE}" -a $${FILE%%.sample} != $${FILE} ]; then \
35
			PREFIX="@sample "; \
36
		fi; \
37 38 39
		if [ -n "${NO_SAMPLE}" ]; then \
			FILE="$${FILE%%.sample}"; \
		fi; \
40
		echo "$${PREFIX}${ROOT${TARGET}}/${TREE}/$${FILE}"; \
41
	done
42 43
.endfor

44 45 46 47 48 49 50
.endfor

install: install_
plist: plist_
force:

.PHONY: force