summaryrefslogtreecommitdiff
path: root/mk/subst.mk
diff options
context:
space:
mode:
authorjlam <jlam>2005-05-20 18:40:42 +0000
committerjlam <jlam>2005-05-20 18:40:42 +0000
commita73fcd80581ec26f4bbfd213f4d251c217138a95 (patch)
tree5a545b341a916aa23c9127ae694f3b0422696000 /mk/subst.mk
parent365c3ea1c8b898d99aa0312f4990801a24bda409 (diff)
downloadpkgsrc-a73fcd80581ec26f4bbfd213f4d251c217138a95.tar.gz
Revert part of revision 1.18. The new quoting was breaking some
assumptions being made by the USE_PKGLOCALEDIR code and the wrapper framework since it added backtick expressions to the SUBST_FILES.* variables, which were being mangled by the :Q modifier. This is evident when running "make regress" in regress/buildlink-unwrap. Mea culpa.
Diffstat (limited to 'mk/subst.mk')
-rw-r--r--mk/subst.mk45
1 files changed, 23 insertions, 22 deletions
diff --git a/mk/subst.mk b/mk/subst.mk
index 7f13cf8f552..8d0f993a0ca 100644
--- a/mk/subst.mk
+++ b/mk/subst.mk
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.19 2005/05/18 03:33:51 rillig Exp $
+# $NetBSD: subst.mk,v 1.20 2005/05/20 18:40:42 jlam Exp $
#
# This Makefile fragment implements a general text replacement facility.
# Package makefiles define a ``class'', for each of which a paricular
@@ -47,7 +47,7 @@ _SUBST_BACKUP_SUFFIX= .subst.sav
_SUBST_COOKIE.${_class_}= ${WRKDIR}/.subst_${_class_}_done
SUBST_FILTER_CMD.${_class_}?= ${SED} ${SUBST_SED.${_class_}}
-SUBST_POSTCMD.${_class_}?= ${RM} -f "$$tmpfile"
+SUBST_POSTCMD.${_class_}?= ${RM} -f $$file${_SUBST_BACKUP_SUFFIX}
SUBST_TARGETS+= subst-${_class_}
_SUBST_TARGETS.${_class_}= subst-${_class_}-message
@@ -77,25 +77,26 @@ subst-${_class_}: ${_SUBST_TARGETS.${_class_}}
${_SUBST_COOKIE.${_class_}}:
${_PKG_SILENT}${_PKG_DEBUG} \
- cd ${WRKSRC:Q}; \
- files=${SUBST_FILES.${_class_}:Q}; \
- for file in $$files; do \
- file="./$$file"; \
- tmpfile="$$file"${_SUBST_BACKUP_SUFFIX:Q}; \
- if ${_SUBST_IS_TEXT_FILE}; then \
- ${MV} -f "$$file" "$$tmpfile" || exit 1; \
- ${CAT} "$$tmpfile" \
- | ${SUBST_FILTER_CMD.${_class_}} \
- > "$$file"; \
- if ${TEST} -x "$$tmpfile"; then \
- ${CHMOD} +x "$$file"; \
+ cd ${WRKSRC}; \
+ files="${SUBST_FILES.${_class_}}"; \
+ case "$$files" in \
+ "") ;; \
+ *) for file in $${files}; do \
+ if ${_SUBST_IS_TEXT_FILE}; then \
+ ${MV} -f $$file $$file${_SUBST_BACKUP_SUFFIX} || exit 1; \
+ ${CAT} $$file${_SUBST_BACKUP_SUFFIX} \
+ | ${SUBST_FILTER_CMD.${_class_}} \
+ > $$file; \
+ if [ -x $$file${_SUBST_BACKUP_SUFFIX} ]; then \
+ ${CHMOD} +x $$file; \
+ fi; \
+ if ${CMP} -s $$file${_SUBST_BACKUP_SUFFIX} $$file; then \
+ ${MV} -f $$file${_SUBST_BACKUP_SUFFIX} $$file; \
+ else \
+ ${SUBST_POSTCMD.${_class_}}; \
+ ${ECHO} $$file >> ${.TARGET}; \
+ fi; \
fi; \
- if ${CMP} -s "$$tmpfile" "$$file"; then \
- ${MV} -f "$$tmpfile" "$$file"; \
- else \
- ${SUBST_POSTCMD.${_class_}}; \
- ${ECHO} "$$file" >> ${.TARGET}; \
- fi; \
- fi; \
- done
+ done ;; \
+ esac
.endfor