aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2012-10-09 05:06:30 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2012-10-09 05:06:30 +0000
commit03391dab30d5c91e5cae9d148d383718bc4a0782 (patch)
tree20eb8dd8daed6378da5b64ada65b107bd1604a2a /usr.bin
parentd24452d8db55505e4d7ab409e8d472d919267172 (diff)
downloadsrc-03391dab30d5c91e5cae9d148d383718bc4a0782.tar.gz
src-03391dab30d5c91e5cae9d148d383718bc4a0782.zip
MF9: r237100: MFC r236338, r236339, r236346, r236347, r236365, & r236977
* Deprecate the FreeBSD 10's make's ":U" (to-upper case) and ":L" (to-lower case) modifiers for ":tu" and ":tl". * make it easier to test newly-built make. * Add "-V '${VAR}'" variable expansion from Portable Berkeley Make. * regression test for '-V' command line option and the :t[lu] modifiers. MF9: r241364: Update MAKE_VERSION for r237100. MFC: r201225: add missing `void' keyword.
Notes
Notes: svn path=/stable/8/; revision=241368
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/Makefile4
-rw-r--r--usr.bin/make/job.c2
-rw-r--r--usr.bin/make/make.126
-rw-r--r--usr.bin/make/var.c29
4 files changed, 53 insertions, 8 deletions
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile
index deb076f90104..acc449676e63 100644
--- a/usr.bin/make/Makefile
+++ b/usr.bin/make/Makefile
@@ -11,7 +11,9 @@ SRCS= arch.c buf.c cond.c dir.c for.c hash.c hash_tables.c job.c \
WARNS?= 6
NO_SHARED?= YES
-CFLAGS+=-DMAKE_VERSION=\"5200408120\"
+# Version has the RYYYYMMDDX format, where R is from RELENG_<R>
+CFLAGS+=-DMAKE_VERSION=\"8201210080\"
+
# There is no obvious performance improvement currently.
# CFLAGS+=-DUSE_KQUEUE
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index e37c62c621e6..527925a6214a 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -485,7 +485,7 @@ catch_child(int sig __unused)
/**
*/
void
-Proc_Init()
+Proc_Init(void)
{
/*
* Catch SIGCHLD so that we get kicked out of select() when we
diff --git a/usr.bin/make/make.1 b/usr.bin/make/make.1
index 863c337d3c5a..8294af5c7e5b 100644
--- a/usr.bin/make/make.1
+++ b/usr.bin/make/make.1
@@ -32,7 +32,7 @@
.\" @(#)make.1 8.8 (Berkeley) 6/13/95
.\" $FreeBSD$
.\"
-.Dd November 5, 2011
+.Dd May 30, 2012
.Dt MAKE 1
.Os
.Sh NAME
@@ -290,6 +290,11 @@ Do not build any targets.
Multiple instances of this option may be specified;
the variables will be printed one per line,
with a blank line for each null or undefined variable.
+If
+.Ar variable
+contains a
+.Sq Ic $
+then the value will be expanded before printing.
.It Fl v
Be extra verbose.
Print any extra information.
@@ -873,6 +878,7 @@ Replaces each word in the variable with everything but the last component.
.It Cm L
Converts variable to lower-case letters.
.It Cm M Ns Ar pattern
+(deprecated)
Select only those words that match the rest of the modifier.
The standard shell wildcard characters
.Pf ( Ql * ,
@@ -963,8 +969,13 @@ to be replaced in
.Ar new_string .
.It Cm T
Replaces each word in the variable with its last component.
+.It Cm tl
+Converts variable to lower-case letters.
+.It Cm tu
+Converts variable to upper-case letters.
.It Cm U
Converts variable to upper-case letters.
+(deprecated)
.It Cm u
Remove adjacent duplicate words (like
.Xr uniq 1 ) .
@@ -1711,6 +1722,19 @@ is set to the same value as
.Va .MAKE ;
support for this may be removed in the future.
.Pp
+The use of the
+.Cm :L
+and
+.Cm :U
+modifiers will be deprecated
+in
+.Fx 10.0
+and the more portable (among Pmake decedents)
+.Cm :tl
+and
+.Cm :tu
+should be used instead.
+.Pp
Most of the more esoteric features of
.Nm
should probably be avoided for greater compatibility.
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index 983bb2ae7046..671295794dde 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1748,6 +1748,19 @@ ParseModifier(VarParser *vp, char startc, Var *v, Boolean *freeResult)
case 'C':
newStr = modifier_C(vp, value, v);
break;
+ case 't':
+ /* :tl :tu for OSF ODE & NetBSD make compatibility */
+ switch (vp->ptr[1]) {
+ case 'l':
+ vp->ptr++;
+ goto mod_lower;
+ break;
+ case 'u':
+ vp->ptr++;
+ goto mod_upper;
+ break;
+ }
+ /* FALLTHROUGH */
default:
if (vp->ptr[1] != endc && vp->ptr[1] != ':') {
#ifdef SUNSHCMD
@@ -1776,6 +1789,7 @@ ParseModifier(VarParser *vp, char startc, Var *v, Boolean *freeResult)
switch (vp->ptr[0]) {
case 'L':
+ mod_lower:
{
const char *cp;
Buffer *buf;
@@ -1801,6 +1815,7 @@ ParseModifier(VarParser *vp, char startc, Var *v, Boolean *freeResult)
vp->ptr++;
break;
case 'U':
+ mod_upper:
{
const char *cp;
Buffer *buf;
@@ -2580,7 +2595,7 @@ void
Var_Print(Lst *vlist, Boolean expandVars)
{
LstNode *n;
- const char *name;
+ char *name;
LST_FOREACH(n, vlist) {
name = Lst_Datum(n);
@@ -2588,13 +2603,17 @@ Var_Print(Lst *vlist, Boolean expandVars)
char *value;
char *v;
- v = emalloc(strlen(name) + 1 + 3);
- sprintf(v, "${%s}", name);
-
+ if (*name == '$') {
+ v = name;
+ } else {
+ v = emalloc(strlen(name) + 1 + 3);
+ sprintf(v, "${%s}", name);
+ }
value = Buf_Peel(Var_Subst(v, VAR_GLOBAL, FALSE));
printf("%s\n", value);
- free(v);
+ if (v != name)
+ free(v);
free(value);
} else {
const char *value = Var_Value(name, VAR_GLOBAL);