Pretty Build System (Take 3)

Alexandre Julliard julliard at winehq.org
Tue May 29 16:22:40 CDT 2007


Robert Shearman <rob at codeweavers.com> writes:

> Attached is a patch that reduces the verbosity of the build system by
> printing the build commands in one of two formats:
> COMMAND output_file
> or
> COMMAND input_file -> output_file
>
> I hope it meets Alexandre's requirements of not reducing portability
> of Wine to other platforms (including Windows).

The MAKEFLAGS stuff is still not portable, and I still think this
belongs in make itself.

Here's a quick proof of concept patch against GNU make. It needs a
better algorithm for extracting the command name, and some sort of
command-line option; this is left as an exercise for the reader.

Index: job.c
===================================================================
RCS file: /sources/make/make/job.c,v
retrieving revision 1.186
diff -u -p -r1.186 job.c
--- job.c	11 May 2007 20:57:21 -0000	1.186
+++ job.c	29 May 2007 21:07:47 -0000
@@ -1079,9 +1079,21 @@ start_job_command (struct child *child)
   /* Print out the command.  If silent, we call `message' with null so it
      can log the working directory before the command's own error messages
      appear.  */
+  {
+      char *ptr, cmd[128];
 
-  message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
-	   ? "%s" : (char *) 0, p);
+      strncpy( cmd, argv[0], sizeof(cmd)-1 );
+      cmd[sizeof(cmd)-1] = 0;
+      if (!strcmp(cmd,"/bin/sh"))
+      {
+          if (argv[1] && !strcmp(argv[1],"-c")) strncpy( cmd, argv[2], sizeof(cmd)-1 );
+          if ((ptr = strchr( cmd, ' ' ))) *ptr = 0;
+      }
+      if ((ptr = strrchr( cmd, '/' ))) memmove( cmd, ptr + 1, strlen(ptr+1) + 1 );
+
+      message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
+               ? "[%s] %s" : (char *) 0, cmd, child->file->name);
+  }
 
   /* Tell update_goal_chain that a command has been started on behalf of
      this target.  It is important that this happens here and not in


-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list