diff options
author | rillig <rillig@pkgsrc.org> | 2007-11-01 13:12:48 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2007-11-01 13:12:48 +0000 |
commit | 9286d58f01cedb8d3da57de68f31477340652a44 (patch) | |
tree | 016dc6693a8e9fe3d22ee5ef46f73f0efc9d480e /mk | |
parent | 2642dfdd0b99dabe6ad8bcbd5a6c35b089f1505e (diff) | |
download | pkgsrc-9286d58f01cedb8d3da57de68f31477340652a44.tar.gz |
Before running _SUBST_IS_TEXT_FILE on a file, make sure that the file
exists.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/subst.mk | 10 |
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; \ |