bug-make
[Top][All Lists]
Advanced

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

new flag to show executing shell command


From: chenzero
Subject: new flag to show executing shell command
Date: Sat, 09 May 2015 12:02:48 +0800
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

Hello,
I am a new beginner of gnu Make. in some cases, I fell that it will help if Make can print the executing shell command even suppressed, for example, to identify problem more easy.

Since it seems that Make doesn't have this flag, I tried to change code.
the code diff is in below and happy to hear what your idea.

Thanks!
chenzero

code diff
-----------------------
diff --git a/commands.c b/commands.c
index ec5853a..922a807 100644
--- a/commands.c
+++ b/commands.c
@@ -415,18 +415,26 @@ chop_commands (struct commands *cmds)
         const char *p = lines[idx];

         while (isblank (*p) || *p == '-' || *p == '@' || *p == '+')
+        {
             switch (*(p++))
             {
             case '+':
                 flags |= COMMANDS_RECURSE;
                 break;
             case '@':
+                if (!print_cmd_flag) {
                     flags |= COMMANDS_SILENT;
+                }
                 break;
             case '-':
                 flags |= COMMANDS_NOERROR;
                 break;
             }
+        }

/* If no explicit '+' was given, look for MAKE variable references. */
         if (!(flags & COMMANDS_RECURSE)
diff --git a/main.c b/main.c
index c2d4a0c..5991946 100644
--- a/main.c
+++ b/main.c
@@ -184,6 +185,9 @@ int touch_flag;

 int just_print_flag;

+/* print executing commands even surpressed by @ */
+int print_cmd_flag;
+
 /* Print debugging info (--debug).  */

 static struct stringlist *db_flags = 0;
@@ -192,7 +196,6 @@ static int debug_flag = 0;
 int db_level = 0;

 /* Synchronize output (--output-sync).  */
-
 char *output_sync_option = 0;

 #ifdef WINDOWS32
@@ -384,6 +387,10 @@ static const char *const usage[] =
     N_("\
   -n, --just-print, --dry-run, --recon\n\
Don't actually run any recipe; just print them.\n"),
+    N_("\
+  -z, --print-cmd\n\
+ Print executing command even supressed by @.\n"),
     N_("\
   -o FILE, --old-file=FILE, --assume-old=FILE\n\
Consider FILE to be very old and don't remake it.\n"),
@@ -441,6 +448,8 @@ static const struct command_switch switches[] =
{ 'L', flag, &check_symlink_flag, 1, 1, 0, 0, 0, "check-symlink-times" },
     { 'm', ignore, 0, 0, 0, 0, 0, 0, 0 },
     { 'n', flag, &just_print_flag, 1, 1, 1, 0, 0, "just-print" },
+    { 'z', flag, &print_cmd_flag, 1, 1, 1, 0, 0, "print-cmd"},
{ 'p', flag, &print_data_base_flag, 1, 1, 0, 0, 0, "print-data-base" },
     { 'q', flag, &question_flag, 1, 1, 1, 0, 0, "question" },
{ 'r', flag, &no_builtin_rules_flag, 1, 1, 0, 0, 0, "no-builtin-rules" },






reply via email to

[Prev in Thread] Current Thread [Next in Thread]