summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2005-05-20 18:40:42 +0000
committerjlam <jlam@pkgsrc.org>2005-05-20 18:40:42 +0000
commita95ee342544a96881cf6ef222cc955136893f767 (patch)
tree5a545b341a916aa23c9127ae694f3b0422696000 /mk
parentb91bc4b5184aaa73e943ef6f88962a47a8cf094a (diff)
downloadpkgsrc-a95ee342544a96881cf6ef222cc955136893f767.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')
-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