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