Blame SOURCES/make-3.82-trace.patch

71dafe
71dafe
This patch add the support for --debug=c and --debug=e to make
71dafe
this option when activated will trace in stdout the activity of $(call and $(eval in the Makefile
71dafe
71dafe
The trace use the format:
71dafe
 ### xxx -->
71dafe
 ### xxx <--
71dafe
the number of space before ### is at least 1 and increase with the nesting of eval/call
71dafe
71dafe
usage: make --debug=c,e
71dafe
71dafe
diff -r -u make-3.82/debug.h make-3.82-lo_trace/debug.h
71dafe
--- make-3.82/debug.h	2010-07-12 20:20:38.000000000 -0500
71dafe
+++ make-3.82-lo_trace/debug.h	2011-06-22 12:06:37.000000000 -0500
71dafe
@@ -21,6 +21,8 @@
71dafe
 #define DB_JOBS         (0x004)
71dafe
 #define DB_IMPLICIT     (0x008)
71dafe
 #define DB_MAKEFILES    (0x100)
71dafe
+#define DB_CALL       (0x01000)
71dafe
+#define DB_EVAL       (0x02000)
71dafe
 
71dafe
 #define DB_ALL          (0xfff)
71dafe
 
71dafe
diff -r -u make-3.82/function.c make-3.82-lo_trace/function.c
71dafe
--- make-3.82/function.c	2011-06-23 01:01:35.000000000 -0500
71dafe
+++ make-3.82-lo_trace/function.c	2011-06-23 01:40:05.000000000 -0500
71dafe
@@ -28,6 +28,8 @@
71dafe
 #include "amiga.h"
71dafe
 #endif
71dafe
 
71dafe
+static int depth = 0;
71dafe
+
71dafe
 
71dafe
 struct function_table_entry
71dafe
   {
71dafe
@@ -1371,7 +1373,12 @@
71dafe
 
71dafe
   install_variable_buffer (&buf, &len;;
71dafe
 
71dafe
+  depth += 1;
71dafe
+  DBS( DB_EVAL, ("### eval -->\n"));
71dafe
+  DB( DB_EVAL, ("%s\n", argv[0]));
71dafe
   eval_buffer (argv[0]);
71dafe
+  DBS( DB_EVAL, ("### eval <--\n"));
71dafe
+  depth -= 1;
71dafe
 
71dafe
   restore_variable_buffer (buf, len);
71dafe
 
71dafe
@@ -2338,6 +2345,7 @@
71dafe
   if (v == 0 || *v->value == '\0')
71dafe
     return o;
71dafe
 
71dafe
+  depth += 1;
71dafe
   body = alloca (flen + 4);
71dafe
   body[0] = '$';
71dafe
   body[1] = '(';
71dafe
@@ -2345,6 +2353,7 @@
71dafe
   body[flen+2] = ')';
71dafe
   body[flen+3] = '\0';
71dafe
 
71dafe
+  DBS(DB_CALL, ("### call %s -->\n", body));
71dafe
   /* Set up arguments $(1) .. $(N).  $(0) is the function name.  */
71dafe
 
71dafe
   push_new_variable_scope ();
71dafe
@@ -2354,6 +2363,7 @@
71dafe
       char num[11];
71dafe
 
71dafe
       sprintf (num, "%d", i);
71dafe
+      DBS(DB_CALL, ("### arg %i for call %s is '%s'\n", i, body, *argv));
71dafe
       define_variable (num, strlen (num), *argv, o_automatic, 0);
71dafe
     }
71dafe
 
71dafe
@@ -2367,6 +2377,7 @@
71dafe
       char num[11];
71dafe
 
71dafe
       sprintf (num, "%d", i);
71dafe
+      DBS(DB_CALL, ("### arg %i for call %s is implicit\n", i, body));
71dafe
       define_variable (num, strlen (num), "", o_automatic, 0);
71dafe
     }
71dafe
 
71dafe
@@ -2377,7 +2388,14 @@
71dafe
 
71dafe
   saved_args = max_args;
71dafe
   max_args = i;
71dafe
+
71dafe
   o = variable_expand_string (o, body, flen+3);
71dafe
+  DBS(DB_CALL, ("### call to %s expended into\n", body));
71dafe
+  DB(DB_CALL, ("%s\n", o));
71dafe
+  DBS(DB_CALL, ("### call %s <--\n", body));
71dafe
+
71dafe
+  depth -= 1;
71dafe
+
71dafe
   max_args = saved_args;
71dafe
 
71dafe
   v->exp_count = 0;
71dafe
diff -r -u make-3.82/main.c make-3.82-lo_trace/main.c
71dafe
--- make-3.82/main.c	2010-07-19 02:10:53.000000000 -0500
71dafe
+++ make-3.82-lo_trace/main.c	2011-06-22 11:46:39.000000000 -0500
71dafe
@@ -634,6 +634,12 @@
71dafe
             case 'b':
71dafe
               db_level |= DB_BASIC;
71dafe
               break;
71dafe
+            case 'c':
71dafe
+              db_level |= DB_CALL;
71dafe
+              break;
71dafe
+            case 'e':
71dafe
+              db_level |= DB_EVAL;
71dafe
+              break;
71dafe
             case 'i':
71dafe
               db_level |= DB_BASIC | DB_IMPLICIT;
71dafe
               break;