Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jun 2012 20:44:57 +0000 (UTC)
From:      "David E. O'Brien" <obrien@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r237100 - in stable/9: tools/regression/usr.bin/make tools/regression/usr.bin/make/variables/modifier_t tools/regression/usr.bin/make/variables/opt_V usr.bin/make
Message-ID:  <201206142044.q5EKivWa018281@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: obrien
Date: Thu Jun 14 20:44:56 2012
New Revision: 237100
URL: http://svn.freebsd.org/changeset/base/237100

Log:
  MFC: r236338, r236339, r236346, r236347, r236365, & r236977
    * Deprecate the FreeBSD 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.

Added:
  stable/9/tools/regression/usr.bin/make/test-new.mk
     - copied unchanged from r236339, head/tools/regression/usr.bin/make/test-new.mk
  stable/9/tools/regression/usr.bin/make/variables/modifier_t/
     - copied from r236977, head/tools/regression/usr.bin/make/variables/modifier_t/
  stable/9/tools/regression/usr.bin/make/variables/opt_V/
     - copied from r236347, head/tools/regression/usr.bin/make/variables/opt_V/
Modified:
  stable/9/usr.bin/make/Makefile
  stable/9/usr.bin/make/make.1
  stable/9/usr.bin/make/var.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/tools/   (props changed)
  stable/9/tools/regression/usr.bin/make/all.sh   (props changed)
  stable/9/usr.bin/   (props changed)
  stable/9/usr.bin/make/   (props changed)

Copied: stable/9/tools/regression/usr.bin/make/test-new.mk (from r236339, head/tools/regression/usr.bin/make/test-new.mk)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/9/tools/regression/usr.bin/make/test-new.mk	Thu Jun 14 20:44:56 2012	(r237100, copy of r236339, head/tools/regression/usr.bin/make/test-new.mk)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+NEW_DIR!=	make -C ${.CURDIR}/../../../../usr.bin/make -V .OBJDIR
+
+all:
+	rm -rf /tmp/${USER}.make.test
+	env MAKE_PROG=${NEW_DIR}/make ${.SHELL} ./all.sh
+
+.include <bsd.obj.mk>

Modified: stable/9/usr.bin/make/Makefile
==============================================================================
--- stable/9/usr.bin/make/Makefile	Thu Jun 14 20:29:49 2012	(r237099)
+++ stable/9/usr.bin/make/Makefile	Thu Jun 14 20:44:56 2012	(r237100)
@@ -14,7 +14,9 @@ SRCS=	arch.c buf.c cond.c dir.c for.c ha
 NO_SHARED?=	YES
 .endif
 
-CFLAGS+=-DMAKE_VERSION=\"5200408120\"
+# Version has the RYYYYMMDDX format, where R is from RELENG_<R>
+CFLAGS+=-DMAKE_VERSION=\"9201120530\"
+
 # There is no obvious performance improvement currently.
 # CFLAGS+=-DUSE_KQUEUE
 

Modified: stable/9/usr.bin/make/make.1
==============================================================================
--- stable/9/usr.bin/make/make.1	Thu Jun 14 20:29:49 2012	(r237099)
+++ stable/9/usr.bin/make/make.1	Thu Jun 14 20:44:56 2012	(r237100)
@@ -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
@@ -320,6 +320,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.
@@ -902,6 +907,7 @@ Replaces each word in the variable with 
 Replaces each word in the variable with everything but the last component.
 .It Cm :L
 Converts variable to lower-case letters.
+(deprecated)
 .It Cm :M Ns Ar pattern
 Select only those words that match the rest of the modifier.
 The standard shell wildcard characters
@@ -993,8 +999,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 ) .
@@ -1742,6 +1753,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.

Modified: stable/9/usr.bin/make/var.c
==============================================================================
--- stable/9/usr.bin/make/var.c	Thu Jun 14 20:29:49 2012	(r237099)
+++ stable/9/usr.bin/make/var.c	Thu Jun 14 20:44:56 2012	(r237100)
@@ -1746,6 +1746,19 @@ ParseModifier(VarParser *vp, char startc
 		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
@@ -1774,6 +1787,7 @@ ParseModifier(VarParser *vp, char startc
 
 			switch (vp->ptr[0]) {
 			case 'L':
+			mod_lower:
 				{
 				const char	*cp;
 				Buffer		*buf;
@@ -1799,6 +1813,7 @@ ParseModifier(VarParser *vp, char startc
 				vp->ptr++;
 				break;
 			case 'U':
+			mod_upper:
 				{
 				const char	*cp;
 				Buffer		*buf;
@@ -2578,7 +2593,7 @@ void
 Var_Print(Lst *vlist, Boolean expandVars)
 {
 	LstNode		*n;
-	const char	*name;
+	char		*name;
 
 	LST_FOREACH(n, vlist) {
 		name = Lst_Datum(n);
@@ -2586,13 +2601,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206142044.q5EKivWa018281>