summaryrefslogtreecommitdiff
path: root/mk/subst.mk
diff options
context:
space:
mode:
authorrillig <rillig>2006-01-08 01:07:35 +0000
committerrillig <rillig>2006-01-08 01:07:35 +0000
commit1069e77b4ad981685b35838f4820130e8996461a (patch)
treedded836aab6e446b6fa9b266f90302744624293d /mk/subst.mk
parent674a54b18da1d54998bd4c0f45a46b6e2f2da3cd (diff)
downloadpkgsrc-1069e77b4ad981685b35838f4820130e8996461a.tar.gz
Reverted the change from 1.29 to 1.30, as it had led to build failures in
the "unwrap" class.
Diffstat (limited to 'mk/subst.mk')
-rw-r--r--mk/subst.mk13
1 files changed, 11 insertions, 2 deletions
diff --git a/mk/subst.mk b/mk/subst.mk
index 73f9cbfeaa0..dd948e0bf86 100644
--- a/mk/subst.mk
+++ b/mk/subst.mk
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.31 2006/01/07 23:27:41 rillig Exp $
+# $NetBSD: subst.mk,v 1.32 2006/01/08 01:07:35 rillig Exp $
#
# This Makefile fragment implements a general text replacement facility.
# Package makefiles define a ``class'', for each of which a particular
@@ -34,6 +34,13 @@
ECHO_SUBST_MSG?= ${ECHO}
+# _SUBST_IS_TEXT_FILE returns 0 if $${file} is a text file.
+_SUBST_IS_TEXT_FILE?= \
+ { ${TEST} -f "$$file" \
+ && ${FILE_CMD} "$$file" \
+ | ${EGREP} "(executable .* script|shell script|text)"; \
+ } >/dev/null 2>&1
+
_SUBST_BACKUP_SUFFIX= .subst.sav
.for _class_ in ${SUBST_CLASSES}
@@ -75,7 +82,7 @@ ${_SUBST_COOKIE.${_class_}}:
for file in $$files; do \
case $$file in /*) ;; *) file="./$$file";; esac; \
tmpfile="$$file"${_SUBST_BACKUP_SUFFIX:Q}; \
- if ${TEST} -f "$$file"; then \
+ if ${_SUBST_IS_TEXT_FILE}; then \
${MV} -f "$$file" "$$tmpfile" || exit 1; \
${SUBST_FILTER_CMD.${_class_}} \
< "$$tmpfile" \
@@ -89,6 +96,8 @@ ${_SUBST_COOKIE.${_class_}}:
${SUBST_POSTCMD.${_class_}}; \
${ECHO} "$$file" >> ${.TARGET}; \
fi; \
+ elif ${TEST} -f "$$file"; then \
+ ${ECHO_SUBST_MSG} "[subst.mk] WARNING: Ignoring non-text file \"$$file\"." 1>&2; \
else \
${ECHO_SUBST_MSG} "[subst.mk] WARNING: Ignoring non-existent file \"$$file\"." 1>&2; \
fi; \