summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig>2007-11-01 13:12:48 +0000
committerrillig <rillig>2007-11-01 13:12:48 +0000
commitf6c7aaf8b4378d49047813a207cc8db91980c164 (patch)
tree016dc6693a8e9fe3d22ee5ef46f73f0efc9d480e
parente4e488cf69361f6fd7c01c6daa424f467bc1f69e (diff)
downloadpkgsrc-f6c7aaf8b4378d49047813a207cc8db91980c164.tar.gz
Before running _SUBST_IS_TEXT_FILE on a file, make sure that the file
exists.
-rw-r--r--mk/subst.mk10
1 files changed, 5 insertions, 5 deletions
diff --git a/mk/subst.mk b/mk/subst.mk
index 00e4667b1e4..60e174762e9 100644
--- a/mk/subst.mk
+++ b/mk/subst.mk
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.46 2007/04/05 18:33:09 wiz Exp $
+# $NetBSD: subst.mk,v 1.47 2007/11/01 13:12:48 rillig Exp $
#
# This Makefile fragment implements a general text replacement facility.
# Package makefiles define a ``class'', for each of which a particular
@@ -109,7 +109,9 @@ ${_SUBST_COOKIE.${_class_}}:
for file in $$files; do \
case $$file in /*) ;; *) file="./$$file";; esac; \
tmpfile="$$file"${_SUBST_BACKUP_SUFFIX:Q}; \
- if ${_SUBST_IS_TEXT_FILE.${_class_}}; then \
+ if [ ! -f "$$file" ]; then \
+ ${WARNING_MSG} "[subst.mk:${_class_}] Ignoring non-existent file \"$$file\"."; \
+ elif ${_SUBST_IS_TEXT_FILE.${_class_}}; then \
${MV} -f "$$file" "$$tmpfile" || exit 1; \
${SUBST_FILTER_CMD.${_class_}} \
< "$$tmpfile" \
@@ -124,10 +126,8 @@ ${_SUBST_COOKIE.${_class_}}:
${SUBST_POSTCMD.${_class_}}; \
${ECHO} "$$file" >> ${.TARGET}; \
fi; \
- elif ${TEST} -f "$$file"; then \
- ${WARNING_MSG} "[subst.mk:${_class_}] Ignoring non-text file \"$$file\"."; \
else \
- ${WARNING_MSG} "[subst.mk:${_class_}] Ignoring non-existent file \"$$file\"."; \
+ ${WARNING_MSG} "[subst.mk:${_class_}] Ignoring non-text file \"$$file\"."; \
fi; \
done
${_PKG_SILENT}${_PKG_DEBUG} set -e; \