Hi all,

Some time ago I was complaining about how there is no way to force make(1)
to display the commands executed by @-prefixed commands in Makefiles.  So I
went around and talked to a few people and one guy clued me in on how I
would add something like this (sorry, I don't remember the name right now
as this was a few weeks ago..).

This option is useful for people with complex Makefile hierarchies who
cannot simply insert a `@${ECHO} "SOMEVAR = ${SOMEVAR}"` as needed in their
Makefiles or remove all the @'s in their Makefiles. In particular, I would
use this feature to debug ports.

Attached is the patch.  If I can get permission, I'd like to commit this to
code on -current, with a possible MFC in a few weeks (?).  I'd like to hear
any complaints about this code, including any style(9) mistakes, whether
this option would be considered bloat, and whether the variable name
``beLoud'' is appropriate in this context.  ;-)

Thanks,
-- 
Will Andrews <[EMAIL PROTECTED]>
GCS/E/S @d- s+:+>+:- a--->+++ C++ UB++++ P+ L- E--- W+++ !N !o ?K w---
?O M+ V-- PS+ PE++ Y+ PGP+>+++ t++ 5 X++ R+ tv+ b++>++++ DI+++ D+ 
G++>+++ e->++++ h! r-->+++ y?
Index: compat.c
===================================================================
RCS file: /extra/cvsroot/src/usr.bin/make/compat.c,v
retrieving revision 1.17
diff -u -r1.17 compat.c
--- compat.c    2000/04/14 06:39:10     1.17
+++ compat.c    2000/05/13 17:38:22
@@ -241,6 +241,8 @@
     while ((*cmd == '@') || (*cmd == '-')) {
        if (*cmd == '@') {
            silent = TRUE;
+           if (beLoud)
+                   silent = FALSE;
        } else {
            errCheck = FALSE;
        }
Index: job.c
===================================================================
RCS file: /extra/cvsroot/src/usr.bin/make/job.c,v
retrieving revision 1.17
diff -u -r1.17 job.c
--- job.c       2000/01/17 06:43:40     1.17
+++ job.c       2000/05/13 17:38:12
@@ -556,6 +556,8 @@
     while (*cmd == '@' || *cmd == '-') {
        if (*cmd == '@') {
            shutUp = TRUE;
+           if (beLoud)
+                   shutUp = FALSE;
        } else {
            errOff = TRUE;
        }
Index: main.c
===================================================================
RCS file: /extra/cvsroot/src/usr.bin/make/main.c,v
retrieving revision 1.35
diff -u -r1.35 main.c
--- main.c      1999/11/23 10:35:24     1.35
+++ main.c      2000/05/13 17:47:35
@@ -138,6 +138,7 @@
 Boolean                        beVerbose;      /* -v flag */
 Boolean                        oldVars;        /* variable substitution style */
 Boolean                        checkEnvFirst;  /* -e flag */
+Boolean                        beLoud;         /* -l flag */
 Lst                    envFirstVars;   /* (-E) vars to override from env */
 static Boolean         jobsRunning;    /* TRUE if the jobs might be running */
 
@@ -175,9 +176,9 @@
 
        optind = 1;     /* since we're called more than once */
 #ifdef REMOTE
-# define OPTFLAGS "BD:E:I:L:PSV:d:ef:ij:km:nqrstv"
+# define OPTFLAGS "BD:E:I:L:PSV:d:ef:ij:klm:nqrstv"
 #else
-# define OPTFLAGS "BD:E:I:PSV:d:ef:ij:km:nqrstv"
+# define OPTFLAGS "BD:E:I:PSV:d:ef:ij:klm:nqrstv"
 #endif
 rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) {
                switch(c) {
@@ -322,6 +323,10 @@
                case 'k':
                        keepgoing = TRUE;
                        Var_Append(MAKEFLAGS, "-k", VAR_GLOBAL);
+                       break;
+               case 'l':
+                       beLoud = TRUE;
+                       Var_Append(MAKEFLAGS, "-l", VAR_GLOBAL);
                        break;
                case 'm':
                        Dir_AddDir(sysIncPath, optarg);
Index: make.h
===================================================================
RCS file: /extra/cvsroot/src/usr.bin/make/make.h,v
retrieving revision 1.12
diff -u -r1.12 make.h
--- make.h      1999/09/11 13:17:35     1.12
+++ make.h      2000/05/13 17:41:09
@@ -322,6 +322,8 @@
 
 extern Boolean checkEnvFirst;  /* TRUE if environment should be searched for
                                 * all variables before the global context */
+extern Boolean beLoud;         /* Force all commands to be outputted; ignores
+                                * @-prefixes, etc. */
 extern Lst     envFirstVars;   /* List of specific variables for which the
                                 * environment should be searched before the
                                 * global context */

Reply via email to