diff options
author | schmonz <schmonz@pkgsrc.org> | 2004-06-06 04:22:23 +0000 |
---|---|---|
committer | schmonz <schmonz@pkgsrc.org> | 2004-06-06 04:22:23 +0000 |
commit | 105997fbc4f2995a3b463a4cfe8eaf88127ac6ba (patch) | |
tree | 0a7e4305289d496f268f25a4447701602a49dca9 /mk | |
parent | 2c170153bccf129c5893d41733e454b307968380 (diff) | |
download | pkgsrc-105997fbc4f2995a3b463a4cfe8eaf88127ac6ba.tar.gz |
Usually there's no need to keep the original version of a file
"foo" as "foo.subst.sav". Implement SUBST_POSTCMD, which by default
cleans up these leftovers. If you need to keep them around, e.g.
while debugging, set it to ${DO_NADA}.
Remove superfluous whitespace in a comment.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/subst.mk | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mk/subst.mk b/mk/subst.mk index c56e9c1afe2..6531c799a99 100644 --- a/mk/subst.mk +++ b/mk/subst.mk @@ -1,4 +1,4 @@ -# $NetBSD: subst.mk,v 1.11 2004/03/07 09:29:25 grant Exp $ +# $NetBSD: subst.mk,v 1.12 2004/06/06 04:22:23 schmonz Exp $ # # This Makefile fragment implements a general text replacement facility. # Package makefiles define a ``class'', for each of which a paricular @@ -16,7 +16,7 @@ # # SUBST_MESSAGE.<class> # message to display, noting what is being substituted -# +# # SUBST_FILES.<class> # files on which to run the substitution; these are relative to # ${WRKSRC} @@ -27,6 +27,10 @@ # SUBST_FILTER_CMD.<class> # filter used to perform the actual substitution on the specified # files. Defaults to ${SED} ${SUBST_SED.<class>}. +# +# SUBST_POSTCMD.<class> +# command to clean up after sed(1). Defaults to ${RM} -f +# $$file.subst.sav. For debugging, set it to ${DO_NADA}. ECHO_SUBST_MSG?= ${ECHO} @@ -39,6 +43,7 @@ _SUBST_COOKIE.${_class_}= ${WRKDIR}/.subst_${_class_}_done . if defined(SUBST_SED.${_class_}) && !empty(SUBST_SED.${_class_}) SUBST_FILTER_CMD.${_class_}?= ${SED} ${SUBST_SED.${_class_}} +SUBST_POSTCMD.${_class_}?= ${RM} -f $$file.subst.sav . else SUBST_FILTER_CMD.${_class_}?= # empty . endif @@ -88,6 +93,7 @@ ${_SUBST_COOKIE.${_class_}}: if ${CMP} -s $$file.subst.sav $$file; then \ ${MV} -f $$file.subst.sav $$file; \ else \ + ${SUBST_POSTCMD.${_class_}}; \ ${ECHO} $$file >> ${.TARGET}; \ fi; \ fi; \ |