summaryrefslogtreecommitdiff
path: root/mk/subst.mk
diff options
context:
space:
mode:
authorrillig <rillig>2007-01-23 06:05:39 +0000
committerrillig <rillig>2007-01-23 06:05:39 +0000
commit11b4d2186f1b1d2521189c8d26d81095722ffe46 (patch)
treee8cc8e3afe2a871a9e7cb220fe4d5f9a4f666cb5 /mk/subst.mk
parentb802c0184ff8e8759635482988f3d3c4390c82af (diff)
downloadpkgsrc-11b4d2186f1b1d2521189c8d26d81095722ffe46.tar.gz
Since there are many cases where the string @FOO@ is replaced with the
pkgsrc variable ${FOO}, there is now a shorter variant for it. Instead of defining SUBST_SED.*, just say SUBST_VARS.* = FOO.
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 048dbef9208..460d4054c5d 100644
--- a/mk/subst.mk
+++ b/mk/subst.mk
@@ -1,4 +1,4 @@
-# $NetBSD: subst.mk,v 1.41 2007/01/14 17:05:02 rillig Exp $
+# $NetBSD: subst.mk,v 1.42 2007/01/23 06:05:39 rillig Exp $
#
# This Makefile fragment implements a general text replacement facility.
# Package makefiles define a ``class'', for each of which a particular
@@ -25,6 +25,14 @@
# List of sed(1) arguments to run on the specified files. Multiple
# commands can be specified using the -e option of sed.
#
+# SUBST_VARS.<class>
+# List of variables that are substituted whenever they appear in
+# the form @VARNAME@. This is basically a short-cut for
+#
+# -e 's,@VARNAME@,${VARNAME},g'
+#
+# also taking care of (most) quoting issues.
+#
# SUBST_FILTER_CMD.<class>
# Filter used to perform the actual substitution on the specified
# files. Defaults to ${SED} ${SUBST_SED.<class>}.
@@ -55,7 +63,8 @@ _SUBST_BACKUP_SUFFIX= .subst.sav
.for _class_ in ${SUBST_CLASSES}
_SUBST_COOKIE.${_class_}= ${WRKDIR}/.subst_${_class_}_done
-SUBST_FILTER_CMD.${_class_}?= ${SED} ${SUBST_SED.${_class_}}
+SUBST_VARS.${_class_}?= # none
+SUBST_FILTER_CMD.${_class_}?= ${SED} ${SUBST_SED.${_class_}} ${SUBST_VARS.${_class_}:@v@-e 's,\@${v}\@,'${${v}:Q}',g' @}
SUBST_POSTCMD.${_class_}?= ${RM} -f "$$tmpfile"
SUBST_SKIP_TEXT_CHECK.${_class_}?= no