tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

make: meta mode silent=yes



The patch below allows better control over the amount of log data
produced.

Basically, if we run in meta mode, and a .meta file is created 
we do not need to see all the associated commands in the log file,
since they (and lots more) are in the .meta file for that target.

--------------------8<--------------------
In meta mode, we create .meta files for most targets.
These capture all the interesting data - useful for debugging.
In such cases there is no need to replicate command in the build log.
Rather than run the entire build .SILENT, allow meta mode to set that flag
per target iff a .meta file is created.
Normal behavior is retained for targets where no .meta file is created,
ensuring that no build data is lost.

Index: compat.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/compat.c,v
retrieving revision 1.83
diff -u -p -r1.83 compat.c
--- compat.c    14 Aug 2011 13:06:09 -0000      1.83
+++ compat.c    26 Aug 2011 00:20:41 -0000
@@ -225,7 +225,7 @@ CompatRunCommand(void *cmdp, void *gnp)
     char         * volatile cmd = (char *)cmdp;
     GNode        *gn = (GNode *)gnp;
 
-    silent = gn->type & OP_SILENT;
+    silent = ((gn->type & (OP_SILENT|OP_NOSILENT)) == OP_SILENT);
     errCheck = !(gn->type & OP_IGNORE);
     doIt = FALSE;
     
Index: make.1
===================================================================
RCS file: /cvsroot/src/usr.bin/make/make.1,v
retrieving revision 1.194
diff -u -p -r1.194 make.1
--- make.1      18 Aug 2011 15:36:51 -0000      1.194
+++ make.1      26 Aug 2011 00:20:41 -0000
@@ -29,7 +29,7 @@
 .\"
 .\"    from: @(#)make.1        8.4 (Berkeley) 3/19/94
 .\"
-.Dd August 18, 2011
+.Dd August 25, 2011
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -799,6 +799,13 @@ This keyword causes them to be ignored f
 determining whether a target is out of date in "meta" mode.
 See also
 .Ic .NOMETA_CMP .
+.It Pa silent= Ar bf
+If
+.Va bf
+is True, when a .meta file is created, mark the target
+.Ic .SILENT
+unless it is already flagged
+.Ic .NOSILENT .
 .El
 .It Va .MAKE.META.BAILIWICK
 In "meta" mode, provides a list of prefixes which
@@ -1709,6 +1716,11 @@ If the number of commands change, though
 .It Ic .NOPATH
 Do not search for the target in the directories specified by
 .Ic .PATH .
+.It Ic .NOSILENT
+The opposite of
+.Ic .SILENT ,
+but does not override
+.Pq Ql @ .
 .It Ic .NOTMAIN
 Normally
 .Nm
Index: make.h
===================================================================
RCS file: /cvsroot/src/usr.bin/make/make.h,v
retrieving revision 1.86
diff -u -p -r1.86 make.h
--- make.h      4 May 2011 20:38:32 -0000       1.86
+++ make.h      26 Aug 2011 00:20:42 -0000
@@ -262,6 +262,8 @@ typedef struct GNode {
 #define OP_NOMETA      0x00080000  /* .NOMETA do not create a .meta file */
 #define OP_META                0x00100000  /* .META we _do_ want a .meta file 
*/
 #define OP_NOMETA_CMP  0x00200000  /* Do not compare commands in .meta file */
+#define OP_NOSILENT    0x00400000  /* Override .SILENT */
+
 /* Attributes applied by PMake */
 #define OP_TRANSFORM   0x80000000  /* The node is a transformation rule */
 #define OP_MEMBER      0x40000000  /* Target is a member of an archive */
Index: meta.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/meta.c,v
retrieving revision 1.21
diff -u -p -r1.21 meta.c
--- meta.c      18 Aug 2011 00:00:21 -0000      1.21
+++ meta.c      26 Aug 2011 00:20:42 -0000
@@ -64,6 +64,7 @@ static Boolean metaEnv = FALSE;               /* don'
 static Boolean metaVerbose = FALSE;
 static Boolean metaIgnoreCMDs = FALSE; /* ignore CMDs in .meta files */
 static Boolean metaCurdirOk = FALSE;   /* write .meta in .CURDIR Ok? */
+static Boolean metaSilent = FALSE;     /* if we have a .meta be SILENT */
 
 extern Boolean forceJobs;
 extern Boolean comatMake;
@@ -510,7 +511,10 @@ meta_create(BuildMon *pbm, GNode *gn)
 
     Var_Append(".MAKE.META.FILES", fname, VAR_GLOBAL);
     Var_Append(".MAKE.META.CREATED", fname, VAR_GLOBAL);
-    
+
+    if (metaSilent && !(gn->type & OP_NOSILENT)) {
+       gn->type |= OP_SILENT;
+    }
  out:
     for (i--; i >= 0; i--) {
        if (p[i])
@@ -556,6 +560,9 @@ meta_init(const char *make_mode)
        if ((cp = strstr(make_mode, "curdirok="))) {
            metaCurdirOk = boolValue(&cp[9]);
        }
+       if ((cp = strstr(make_mode, "silent="))) {
+           metaSilent = boolValue(&cp[7]);
+       }
        if (strstr(make_mode, "ignore-cmd"))
            metaIgnoreCMDs = TRUE;
        /* for backwards compatability */
Index: parse.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/parse.c,v
retrieving revision 1.178
diff -u -p -r1.178 parse.c
--- parse.c     17 May 2011 21:56:51 -0000      1.178
+++ parse.c     26 Aug 2011 00:20:43 -0000
@@ -197,6 +197,7 @@ typedef enum {
     NoPath,        /* .NOPATH */
     Not,           /* Not special */
     NotParallel,    /* .NOTPARALLEL */
+    NoSilent,      /* .NOSILENT */
     Null,          /* .NULL */
     ExObjdir,      /* .OBJDIR */
     Order,         /* .ORDER */
@@ -315,6 +316,7 @@ static const struct {
 { ".NOMETA",     NoMeta,       OP_NOMETA },
 { ".NOMETA_CMP",  NoMetaCmp,   OP_NOMETA_CMP },
 { ".NOPATH",     NoPath,       OP_NOPATH },
+{ ".NOSILENT",   NoSilent,     OP_NOSILENT },
 { ".NOTMAIN",    Attribute,    OP_NOTMAIN },
 { ".NOTPARALLEL", NotParallel, 0 },
 { ".NO_PARALLEL", NotParallel, 0 },
@@ -1502,6 +1504,9 @@ ParseDoDependency(char *line)
            case Silent:
                beSilent = TRUE;
                break;
+           case NoSilent:
+               beSilent = FALSE;
+               break;
            case ExPath:
                Lst_ForEach(paths, ParseClearPath, NULL);
                Dir_SetPATH();
Index: targ.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/targ.c,v
retrieving revision 1.56
diff -u -p -r1.56 targ.c
--- targ.c      25 Nov 2010 21:31:09 -0000      1.56
+++ targ.c      26 Aug 2011 00:20:43 -0000
@@ -454,7 +454,9 @@ Targ_Ignore(GNode *gn)
 Boolean
 Targ_Silent(GNode *gn)
 {
-    if (beSilent || gn->type & OP_SILENT) {
+    if (gn->type & OP_NOSILENT) {
+       return (FALSE);
+    } else if (beSilent || gn->type & OP_SILENT) {
        return (TRUE);
     } else {
        return (FALSE);


Home | Main Index | Thread Index | Old Index