ccorrodi avatar ccorrodi committed f395f70

add patch for GNU make

misc/cmdfile.patch patches GNU make 3.82. When running the patched make, a file
called commands.txt is opened in the current working directory. All executed
commands (including commands without output, using @) are written to
commands.txt. This results in a file that contains only the commands that are
executed and no standard output from the commands themselves.

Comments (0)

Files changed (1)

misc/cmdfile.patch

+diff --git a/make-3.82-original/misc.c b/make-3.82/misc.c
+index 7a6f773..7560529 100644
+--- a/make-3.82-original/misc.c
++++ b/make-3.82/misc.c
+@@ -214,7 +214,7 @@ concat (num, va_alist)
+ 
+   return result;
+ }
+-
++
+ /* Print a message on stdout.  */
+ 
+ void
+@@ -237,18 +237,27 @@ message (prefix, fmt, va_alist)
+     {
+       if (prefix)
+ 	{
+-	  if (makelevel == 0)
++	  if (makelevel == 0) {
+ 	    printf ("%s: ", program);
+-	  else
++	    fprintf (cmdfile, "%s: ", program);
++	  } else {
+ 	    printf ("%s[%u]: ", program, makelevel);
++	    fprintf (cmdfile, "%s[%u]: ", program, makelevel);
++	  }
+ 	}
+       VA_START (args, fmt);
+       VA_PRINTF (stdout, fmt, args);
+       VA_END (args);
+       putchar ('\n');
++
++      VA_START (args, fmt);
++      VA_PRINTF (cmdfile, fmt, args);
++      VA_END (args);
++      fputc ('\n', cmdfile);
+     }
+ 
+   fflush (stdout);
++  fflush (cmdfile);
+ }
+ 
+ /* Print an error message.  */
+diff --git a/make-3.82-original/job.c b/make-3.82/job.c
+index aacfb84..aabae71 100644
+--- a/make-3.82-original/job.c
++++ b/make-3.82/job.c
+@@ -1143,7 +1143,7 @@ start_job_command (struct child *child)
+      can log the working directory before the command's own error messages
+      appear.  */
+ 
+-  message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
++  message (0, (just_print_flag || !silent_flag)
+ 	   ? "%s" : (char *) 0, p);
+ 
+   /* Tell update_goal_chain that a command has been started on behalf of
+diff --git a/make-3.82-original/main.c b/make-3.82/main.c
+index c6989e3..ba8eeec 100644
+--- a/make-3.82-original/main.c
++++ b/make-3.82/main.c
+@@ -916,6 +916,7 @@ int
+ main (int argc, char **argv, char **envp)
+ #endif
+ {
++  cmdfile = fopen("commands.txt", "w");
+   static char *stdin_nm = 0;
+   int makefile_status = MAKE_SUCCESS;
+   struct dep *read_makefiles;
+@@ -2309,6 +2310,8 @@ main (int argc, char **argv, char **envp)
+     die (status);
+   }
+ 
++  fclose (cmdfile);
++
+   /* NOTREACHED */
+   return 0;
+ }
+diff --git a/make-3.82-original/make.h b/make-3.82/make.h
+index 60ade4c..aa4ec33 100644
+--- a/make-3.82-original/make.h
++++ b/make-3.82/make.h
+@@ -615,3 +615,5 @@ extern int handling_fatal_signal;
+ 
+ #define ENULLLOOP(_v,_c)   do { errno = 0; (_v) = _c; } \
+                            while((_v)==0 && errno==EINTR)
++
++FILE *cmdfile;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.