summaryrefslogtreecommitdiff
path: root/mk/subst.mk
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-06-17 22:42:00 +0000
committerrillig <rillig@pkgsrc.org>2006-06-17 22:42:00 +0000
commit56d01034de24c2fc9a82dc1901bff9d5220e25b0 (patch)
treeaca062d09168c67306138988ab7a6cde55af2d6d /mk/subst.mk
parentd47b6923998dbcbe4f33c2d9dc73046e7a622ac9 (diff)
downloadpkgsrc-56d01034de24c2fc9a82dc1901bff9d5220e25b0.tar.gz
Simplified the code by reducing the number of different targets that are
evaluated. Now the SUBST_MESSAGE is only printed once when the substitution is actually done. Before this change it had been printed also when the subst-<class> target had been invoked a second time, but the substitution didn't take place again, which had confused me. Also, converted the code to use ${WARNING_MSG} and ${STEP_MSG}.
Diffstat (limited to 'mk/subst.mk')
-rw-r--r--mk/subst.mk31
1 files changed, 11 insertions, 20 deletions
diff --git a/mk/subst.mk b/mk/subst.mk
index dd948e0bf86..179614d774d 100644
--- a/mk/subst.mk
+++ b/mk/subst.mk
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.32 2006/01/08 01:07:35 rillig Exp $
+# $NetBSD: subst.mk,v 1.33 2006/06/17 22:42:00 rillig Exp $
#
# This Makefile fragment implements a general text replacement facility.
# Package makefiles define a ``class'', for each of which a particular
@@ -32,7 +32,7 @@
# Command to clean up after sed(1). Defaults to ${RM} -f
# $$file${_SUBST_BACKUP_SUFFIX}. For debugging, set it to ${DO_NADA}.
-ECHO_SUBST_MSG?= ${ECHO}
+ECHO_SUBST_MSG?= ${STEP_MSG}
# _SUBST_IS_TEXT_FILE returns 0 if $${file} is a text file.
_SUBST_IS_TEXT_FILE?= \
@@ -50,32 +50,21 @@ SUBST_FILTER_CMD.${_class_}?= ${SED} ${SUBST_SED.${_class_}}
SUBST_POSTCMD.${_class_}?= ${RM} -f "$$tmpfile"
SUBST_TARGETS+= subst-${_class_}
-_SUBST_TARGETS.${_class_}= subst-${_class_}-message
-_SUBST_TARGETS.${_class_}+= ${_SUBST_COOKIE.${_class_}}
-_SUBST_TARGETS.${_class_}+= subst-${_class_}-cookie
-
-.ORDER: ${_SUBST_TARGETS.${_class_}}
. if defined(SUBST_STAGE.${_class_})
${SUBST_STAGE.${_class_}}: subst-${_class_}
+. else
+PKG_FAIL_REASON+= "SUBST_STAGE missing for ${_class_}."
. endif
.PHONY: subst-${_class_}
-subst-${_class_}: ${_SUBST_TARGETS.${_class_}}
+subst-${_class_}: ${_SUBST_COOKIE.${_class_}}
-.PHONY: subst-${_class_}-message
-subst-${_class_}-message:
+${_SUBST_COOKIE.${_class_}}:
. if defined(SUBST_MESSAGE.${_class_})
${_PKG_SILENT}${_PKG_DEBUG} \
- ${ECHO_SUBST_MSG} "=> "${SUBST_MESSAGE.${_class_}:Q}
+ ${ECHO_SUBST_MSG} ${SUBST_MESSAGE.${_class_}:Q}
. endif
-
-.PHONY: subst-${_class_}-cookie
-subst-${_class_}-cookie:
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${TOUCH} ${TOUCH_FLAGS} ${_SUBST_COOKIE.${_class_}:Q}
-
-${_SUBST_COOKIE.${_class_}}:
${_PKG_SILENT}${_PKG_DEBUG} set -e; \
cd ${WRKSRC:Q}; \
files=${SUBST_FILES.${_class_}:Q}; \
@@ -97,9 +86,11 @@ ${_SUBST_COOKIE.${_class_}}:
${ECHO} "$$file" >> ${.TARGET}; \
fi; \
elif ${TEST} -f "$$file"; then \
- ${ECHO_SUBST_MSG} "[subst.mk] WARNING: Ignoring non-text file \"$$file\"." 1>&2; \
+ ${WARNING_MSG} "[subst.mk] Ignoring non-text file \"$$file\"." 1>&2; \
else \
- ${ECHO_SUBST_MSG} "[subst.mk] WARNING: Ignoring non-existent file \"$$file\"." 1>&2; \
+ ${WARNING_MSG} "[subst.mk] Ignoring non-existent file \"$$file\"." 1>&2; \
fi; \
done
+ ${_PKG_SILENT}${_PKG_DEBUG} set -e; \
+ ${TOUCH} ${TOUCH_FLAGS} ${.TARGET:Q}
.endfor