svn commit: r186713 - head/usr.bin/make

David E. O'Brien obrien at FreeBSD.org
Sat Jan 3 02:14:02 PST 2009


Author: obrien
Date: Sat Jan  3 10:14:01 2009
New Revision: 186713
URL: http://svn.freebsd.org/changeset/base/186713

Log:
  + Add the -Q be-quiet flag for parallel jobs.
  - Enable -Q by default for the moment - there is something weird
    going on in the rescue build.

Modified:
  head/usr.bin/make/globals.h
  head/usr.bin/make/job.c
  head/usr.bin/make/main.c
  head/usr.bin/make/make.1
  head/usr.bin/make/var.c

Modified: head/usr.bin/make/globals.h
==============================================================================
--- head/usr.bin/make/globals.h	Sat Jan  3 05:32:37 2009	(r186712)
+++ head/usr.bin/make/globals.h	Sat Jan  3 10:14:01 2009	(r186713)
@@ -76,6 +76,7 @@ extern Boolean	compatMake;	/* True if we
 extern Boolean	ignoreErrors;	/* True if should ignore all errors */
 extern Boolean	beSilent;	/* True if should print no commands */
 extern Boolean	beVerbose;	/* True if should print extra cruft */
+extern Boolean	beQuiet;	/* True if want quiet headers with -j */
 extern Boolean	noExecute;	/* True if should execute nothing */
 extern Boolean	allPrecious;	/* True if every target is precious */
 extern Boolean	is_posix;	/* .POSIX target seen */

Modified: head/usr.bin/make/job.c
==============================================================================
--- head/usr.bin/make/job.c	Sat Jan  3 05:32:37 2009	(r186712)
+++ head/usr.bin/make/job.c	Sat Jan  3 10:14:01 2009	(r186713)
@@ -2363,7 +2363,7 @@ Job_Init(int maxproc)
 
 	lastNode = NULL;
 
-	if (maxJobs == 1 && fifoFd < 0) {
+	if ((maxJobs == 1 && fifoFd < 0) || beQuiet || beVerbose == 0) {
 		/*
 		 * If only one job can run at a time, there's no need for a
 		 * banner, no is there?

Modified: head/usr.bin/make/main.c
==============================================================================
--- head/usr.bin/make/main.c	Sat Jan  3 05:32:37 2009	(r186712)
+++ head/usr.bin/make/main.c	Sat Jan  3 10:14:01 2009	(r186713)
@@ -126,6 +126,7 @@ Boolean		is_posix;	/* .POSIX target seen
 Boolean		mfAutoDeps;	/* .MAKEFILEDEPS target seen */
 Boolean		beSilent;	/* -s flag */
 Boolean		beVerbose;	/* -v flag */
+Boolean		beQuiet = TRUE;	/* -Q flag */
 Boolean		compatMake;	/* -B argument */
 int		debug;		/* -d flag */
 Boolean		ignoreErrors;	/* -i flag */
@@ -370,7 +371,7 @@ MainParseArgs(int argc, char **argv)
 rearg:
 	optind = 1;	/* since we're called more than once */
 	optreset = 1;
-#define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:npqrstvx:"
+#define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nQpqrstvx:"
 	for (;;) {
 		if ((optind < argc) && strcmp(argv[optind], "--") == 0) {
 			found_dd = TRUE;
@@ -516,6 +517,10 @@ rearg:
 			printGraphOnly = TRUE;
 			debug |= DEBUG_GRAPH1;
 			break;
+		case 'Q':
+			beQuiet = TRUE;
+			MFLAGS_append("-Q", NULL);
+			break;
 		case 'q':
 			queryFlag = TRUE;
 			/* Kind of nonsensical, wot? */
@@ -535,6 +540,7 @@ rearg:
 			break;
 		case 'v':
 			beVerbose = TRUE;
+			beQuiet = FALSE;
 			MFLAGS_append("-v", NULL);
 			break;
 		case 'x':

Modified: head/usr.bin/make/make.1
==============================================================================
--- head/usr.bin/make/make.1	Sat Jan  3 05:32:37 2009	(r186712)
+++ head/usr.bin/make/make.1	Sat Jan  3 10:14:01 2009	(r186713)
@@ -258,6 +258,9 @@ When combined with
 only the builtin rules of
 .Nm
 are displayed.
+.It Fl Q
+Be extra quiet.
+For multi-job makes, this will cause file banners not to be generated.
 .It Fl q
 Do not execute any commands, but exit 0 if the specified targets are
 up-to-date and 1, otherwise.
@@ -289,7 +292,7 @@ the variables will be printed one per li
 with a blank line for each null or undefined variable.
 .It Fl v
 Be extra verbose.
-For multi-job makes, this will cause file banners to be generated.
+Print any extra information.
 .It Fl X
 When using the
 .Fl V

Modified: head/usr.bin/make/var.c
==============================================================================
--- head/usr.bin/make/var.c	Sat Jan  3 05:32:37 2009	(r186712)
+++ head/usr.bin/make/var.c	Sat Jan  3 10:14:01 2009	(r186713)
@@ -946,12 +946,14 @@ VarFindAny(const char name[], GNode *ctx
  *	The name and val arguments are duplicated so they may
  *	safely be freed.
  */
-static void
+static Var *
 VarAdd(const char *name, const char *val, GNode *ctxt)
 {
+	Var *v;
 
-	Lst_AtFront(&ctxt->context, VarCreate(name, val, 0));
+	Lst_AtFront(&ctxt->context, v = VarCreate(name, val, 0));
 	DEBUGF(VAR, ("%s:%s = %s\n", ctxt->name, name, val));
+	return (v);
 }
 
 /**
@@ -1004,30 +1006,22 @@ Var_Set(const char *name, const char *va
 	n = VarPossiblyExpand(name, ctxt);
 	v = VarFindOnly(n, ctxt);
 	if (v == NULL) {
-		VarAdd(n, val, ctxt);
-		if (ctxt == VAR_CMD) {
-			/*
-			 * Any variables given on the command line
-			 * are automatically exported to the
-			 * environment (as per POSIX standard)
-			 */
-			setenv(n, val, 1);
-		}
+		v = VarAdd(n, val, ctxt);
 	} else {
 		Buf_Clear(v->val);
 		Buf_Append(v->val, val);
-
-		if (ctxt == VAR_CMD || (v->flags & VAR_TO_ENV)) {
-			/*
-			 * Any variables given on the command line
-			 * are automatically exported to the
-			 * environment (as per POSIX standard)
-			 */
-			setenv(n, val, 1);
-		}
 		DEBUGF(VAR, ("%s:%s = %s\n", ctxt->name, n, val));
 	}
 
+	if (ctxt == VAR_CMD || (v->flags & VAR_TO_ENV)) {
+		/*
+		 * Any variables given on the command line
+		 * are automatically exported to the
+		 * environment (as per POSIX standard)
+		 */
+		setenv(n, val, 1);
+	}
+
 	free(n);
 }
 
@@ -2325,7 +2319,8 @@ match_var(const char str[], const char v
  *	None. The old string must be freed by the caller
  */
 Buffer *
-Var_Subst(const char *str, GNode *ctxt, Boolean err)
+//Var_Subst(const char *var, const char *str, GNode *ctxt, Boolean undefErr)
+Var_Subst(                   const char *str, GNode *ctxt, Boolean err)
 {
 	Boolean	errorReported;
 	Buffer *buf;		/* Buffer for forming things */


More information about the svn-src-head mailing list