summaryrefslogtreecommitdiff
path: root/usr.bin/make/make.1
diff options
context:
space:
mode:
authorsjg <sjg@NetBSD.org>2017-01-30 02:46:20 +0000
committersjg <sjg@NetBSD.org>2017-01-30 02:46:20 +0000
commit4e63770db0aa9deb37dd7a7ffde5886a413a8cc0 (patch)
tree1cd70e2e5d11a68541c039292e5f22e88ebf4c6d /usr.bin/make/make.1
parent44a97d0210b25fc07d55c10591df4ee477b9da14 (diff)
Add :range and :_
:range replaces var value with an integer sequence one per word in the current var value. :_ stores the current var value in $_ so that it can be referred to later in the modifier series. Reviewed by: christos
Diffstat (limited to 'usr.bin/make/make.1')
-rw-r--r--usr.bin/make/make.131
1 files changed, 29 insertions, 2 deletions
diff --git a/usr.bin/make/make.1 b/usr.bin/make/make.1
index 7d0a01c2545..8d6bf431977 100644
--- a/usr.bin/make/make.1
+++ b/usr.bin/make/make.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.264 2017/01/14 22:58:04 sjg Exp $
+.\" $NetBSD: make.1,v 1.265 2017/01/30 02:46:20 sjg Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\"
-.Dd January 14, 2017
+.Dd January 29, 2017
.Dt MAKE 1
.Os
.Sh NAME
@@ -1204,6 +1204,10 @@ safely through recursive invocations of
.Nm .
.It Cm \&:R
Replaces each word in the variable with everything but its suffix.
+.It Cm \&:range[=count]
+The value is an integer sequence representing the words of the original
+value, or the supplied
+.Va count .
.It Cm \&:gmtime[=utc]
The value is a format string for
.Xr strftime 3 ,
@@ -1421,6 +1425,29 @@ For example.
.Pp
However a single character variable is often more readable:
.Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}
+.It Cm \&:_
+Save the current variable value in
+.Ql $_
+for later reference.
+This
+.Ql $_
+is internal to the variable modifier processing and
+will not conflict with any set in a makefile.
+Example usage:
+.Bd -literal -offset indent
+M_cmpv.units = 1 100 10000
+M_cmpv = S,., ,g:_:range:@i@+ $${_:[-$$i]} \&\\
+\\* $${M_cmpv.units:[$$i]}@:S,^,expr 0 ,1:sh
+
+.Dv .if ${VERSION:${M_cmpv}} < ${3.1.12:L:${M_cmpv}}
+
+.Ed
+Here the
+.Ql $_
+is used to save the result of the
+.Ql :S
+modifier which is later referenced using the index values from
+.Ql :range .
.It Cm \&:U Ns Ar newval
If the variable is undefined
.Ar newval