core/Mk/tree.mk
Franco Fichtner d5cd97a492 pkg: generalise packaging magic; add .in suffix awareness
o Makes live-mounting easier as the package config samples won't
  be clobbered anymore.

o Automatically picks up ".in" files, runs replace and moves them
  to their permanent location.

o Refactored src directory install while at it.
2015-07-29 17:00:13 +02:00

31 lines
777 B
Makefile

all:
install:
.for TREE in ${TREES}
@mkdir -p ${DESTDIR}${ROOT}
@cp -vr ${TREE} ${DESTDIR}${ROOT}
@(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" \
${DESTDIR}${ROOT}/${TREE}/$${FILE}; \
mv -v ${DESTDIR}${ROOT}/${TREE}/$${FILE} \
${DESTDIR}${ROOT}/${TREE}/$${FILE%%.in}; \
fi \
done
.endfor
plist:
.for TREE in ${TREES}
@(cd ${TREE}; find * -type f) | while read FILE; do \
FILE="$${FILE%%.in}"; PREFIX=""; \
if [ $${FILE%%.sample} != $${FILE} ]; then \
PREFIX="@sample "; \
fi; \
echo "${PREFIX} ${ROOT}/${TREE}/$${FILE}"; \
done
.endfor
.PHONY: install plist