[PATCH 1/3] makefiles: Allow make-time silent build output

Jeff Smith whydoubt at gmail.com
Sun Sep 15 14:42:32 CDT 2019


At make time, setting V=0 will cause the output to be much quieter.
While details about the commands being called is suppressed, this
can make following the progress of the build easier. It also has the
effect of causing warning messages to be more prominent.

Signed-off-by: Jeff Smith <whydoubt at gmail.com>
---
 libs/wine/Makefile.in         |  2 +-
 programs/winetest/Makefile.in |  4 +-
 tools/makedep.c               | 90 ++++++++++++++++++++---------------
 3 files changed, 55 insertions(+), 41 deletions(-)

diff --git a/libs/wine/Makefile.in b/libs/wine/Makefile.in
index f7dd34b058..def6da4a31 100644
--- a/libs/wine/Makefile.in
+++ b/libs/wine/Makefile.in
@@ -25,7 +25,7 @@ libwine_LDFLAGS = $(LIBWINE_LDFLAGS)
 libwine_DEPS = $(LIBWINE_DEPENDS)
 
 version.c: dummy
-	version=`(GIT_DIR=$(top_srcdir)/.git git describe HEAD 2>/dev/null || echo "wine-$(PACKAGE_VERSION)") | sed -n -e '$$s/\(.*\)/const char wine_build[] = "\1";/p'` && (echo $$version | cmp -s - $@) || echo $$version >$@ || (rm -f $@ && exit 1)
+	$(QUIET_GEN)version=`(GIT_DIR=$(top_srcdir)/.git git describe HEAD 2>/dev/null || echo "wine-$(PACKAGE_VERSION)") | sed -n -e '$$s/\(.*\)/const char wine_build[] = "\1";/p'` && (echo $$version | cmp -s - $@) || echo $$version >$@ || (rm -f $@ && exit 1)
 
 dummy:
 .PHONY: dummy
diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in
index 0322e773c5..689adad46a 100644
--- a/programs/winetest/Makefile.in
+++ b/programs/winetest/Makefile.in
@@ -22,10 +22,10 @@ EXTRA_TARGETS = build.nfo
 INSTALL_LIB = none
 
 build.rc: dummy
-	build="STRINGTABLE { 1 \"`GIT_DIR=$(top_srcdir)/.git git rev-parse HEAD 2>/dev/null`\" }" && (echo $$build | cmp -s - $@) || echo $$build >$@ || (rm -f $@ && exit 1)
+	$(QUIET_GEN)build="STRINGTABLE { 1 \"`GIT_DIR=$(top_srcdir)/.git git rev-parse HEAD 2>/dev/null`\" }" && (echo $$build | cmp -s - $@) || echo $$build >$@ || (rm -f $@ && exit 1)
 
 build.nfo:
-	-$(CC) -v 2>$@
+	-$(QUIET_GEN)$(CC) -v 2>$@
 
 dummy:
 .PHONY: dummy
diff --git a/tools/makedep.c b/tools/makedep.c
index e37bd8d63a..4bdef79a78 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -2320,7 +2320,7 @@ static struct strarray get_source_defines( struct makefile *make, struct incl_fi
  */
 static void output_winegcc_command( struct makefile *make )
 {
-    output( "\t%s -o $@", tools_path( make, "winegcc" ));
+    output( "\t$(QUIET_CCLD)%s -o $@", tools_path( make, "winegcc" ));
     output_filename( strmake( "-B%s", tools_dir_path( make, "winebuild" )));
     if (tools_dir) output_filename( strmake( "--sysroot=%s", top_obj_dir_path( make, "" )));
     if (make->is_cross)
@@ -2346,7 +2346,7 @@ static void output_symlink_rule( const char *src_name, const char *link_name )
 {
     const char *name;
 
-    output( "\trm -f %s && ", link_name );
+    output( "\t$(QUIET_LN)rm -f %s && ", link_name );
 
     /* dest path with a directory needs special handling if ln -s isn't supported */
     if (strcmp( ln_s, "ln -s" ) && ((name = strrchr( link_name, '/' ))))
@@ -2592,7 +2592,7 @@ static void output_po_files( const struct makefile *make )
         for (i = 0; i < linguas.count; i++)
             output_filename( strmake( "%s/%s.po", po_dir, linguas.str[i] ));
         output( ": %s/wine.pot\n", po_dir );
-        output( "\tmsgmerge --previous -q $@ %s/wine.pot | msgattrib --no-obsolete -o [email protected] && mv [email protected] $@\n",
+        output( "\t$(QUIET_GEN)msgmerge --previous -q $@ %s/wine.pot | msgattrib --no-obsolete -o [email protected] && mv [email protected] $@\n",
                 po_dir );
         output( "po:" );
         for (i = 0; i < linguas.count; i++)
@@ -2602,7 +2602,7 @@ static void output_po_files( const struct makefile *make )
     output( "%s/wine.pot:", po_dir );
     output_filenames( pot_files );
     output( "\n" );
-    output( "\tmsgcat -o $@" );
+    output( "\t$(QUIET_GEN)msgcat -o $@" );
     output_filenames( pot_files );
     output( "\n" );
 }
@@ -2619,7 +2619,7 @@ static void output_source_y( struct makefile *make, struct incl_file *source, co
     if (find_include_file( make, header ))
     {
         output( "%s: %s\n", obj_dir_path( make, header ), source->filename );
-        output( "\t%s -p %s_ -o %s.tab.c -d %s\n",
+        output( "\t$(QUIET_BISON)%s -p %s_ -o %s.tab.c -d %s\n",
                 bison, obj, obj_dir_path( make, obj ), source->filename );
         output( "%s.tab.c: %s %s\n", obj_dir_path( make, obj ),
                 source->filename, obj_dir_path( make, header ));
@@ -2627,7 +2627,7 @@ static void output_source_y( struct makefile *make, struct incl_file *source, co
     }
     else output( "%s.tab.c: %s\n", obj, source->filename );
 
-    output( "\t%s -p %s_ -o $@ %s\n", bison, obj, source->filename );
+    output( "\t$(QUIET_BISON)%s -p %s_ -o $@ %s\n", bison, obj, source->filename );
 }
 
 
@@ -2637,7 +2637,7 @@ static void output_source_y( struct makefile *make, struct incl_file *source, co
 static void output_source_l( struct makefile *make, struct incl_file *source, const char *obj )
 {
     output( "%s.yy.c: %s\n", obj_dir_path( make, obj ), source->filename );
-    output( "\t%s -o$@ %s\n", flex, source->filename );
+    output( "\t$(QUIET_FLEX)%s -o $@ %s\n", flex, source->filename );
 }
 
 
@@ -2665,7 +2665,7 @@ static void output_source_rc( struct makefile *make, struct incl_file *source, c
     if (source->file->flags & FLAG_GENERATED) strarray_add( &make->clean_files, source->name );
     strarray_add( &make->res_files, strmake( "%s.res", obj ));
     output( "%s.res: %s\n", obj_dir_path( make, obj ), source->filename );
-    output( "\t%s -o $@", tools_path( make, "wrc" ) );
+    output( "\t$(QUIET_GEN)%s -o $@", tools_path( make, "wrc" ) );
     if (make->is_win16) output_filename( "-m16" );
     else output_filenames( target_flags );
     output_filename( "--nostdinc" );
@@ -2690,7 +2690,7 @@ static void output_source_rc( struct makefile *make, struct incl_file *source, c
     {
         strarray_add( &make->clean_files, strmake( "%s.pot", obj ));
         output( "%s.pot: %s\n", obj_dir_path( make, obj ), source->filename );
-        output( "\t%s -O pot -o $@", tools_path( make, "wrc" ) );
+        output( "\t$(QUIET_GEN)%s -O pot -o $@", tools_path( make, "wrc" ) );
         if (make->is_win16) output_filename( "-m16" );
         else output_filenames( target_flags );
         output_filename( "--nostdinc" );
@@ -2716,7 +2716,7 @@ static void output_source_mc( struct makefile *make, struct incl_file *source, c
     strarray_add( &make->res_files, strmake( "%s.res", obj ));
     strarray_add( &make->clean_files, strmake( "%s.pot", obj ));
     output( "%s.res: %s\n", obj_dir_path( make, obj ), source->filename );
-    output( "\t%s -U -O res -o $@ %s", tools_path( make, "wmc" ), source->filename );
+    output( "\t$(QUIET_GEN)%s -U -O res -o $@ %s", tools_path( make, "wmc" ), source->filename );
     if (linguas.count)
     {
         char *po_dir = top_obj_dir_path( make, "po" );
@@ -2728,7 +2728,7 @@ static void output_source_mc( struct makefile *make, struct incl_file *source, c
     }
     output( "\n" );
     output( "%s.pot: %s\n", obj_dir_path( make, obj ), source->filename );
-    output( "\t%s -O pot -o $@ %s", tools_path( make, "wmc" ), source->filename );
+    output( "\t$(QUIET_GEN)%s -O pot -o $@ %s", tools_path( make, "wmc" ), source->filename );
     output( "\n" );
     output( "%s.pot %s.res:", obj_dir_path( make, obj ), obj_dir_path( make, obj ));
     output_filename( tools_path( make, "wmc" ));
@@ -2779,7 +2779,7 @@ static void output_source_idl( struct makefile *make, struct incl_file *source,
 
     output_filenames_obj_dir( make, targets );
     output( ": %s\n", tools_path( make, "widl" ));
-    output( "\t%s -o $@", tools_path( make, "widl" ) );
+    output( "\t$(QUIET_GEN)%s -o $@", tools_path( make, "widl" ) );
     output_filenames( target_flags );
     output_filenames( defines );
     output_filenames( get_expanded_make_var_array( make, "EXTRAIDLFLAGS" ));
@@ -2809,7 +2809,7 @@ static void output_source_x( struct makefile *make, struct incl_file *source, co
 {
     output( "%s.h: %s%s %s\n", obj_dir_path( make, obj ),
             tools_dir_path( make, "make_xftmpl" ), tools_ext, source->filename );
-    output( "\t%s%s -H -o $@ %s\n",
+    output( "\t$(QUIET_GEN)%s%s -H -o $@ %s\n",
             tools_dir_path( make, "make_xftmpl" ), tools_ext, source->filename );
     if (source->file->flags & FLAG_INSTALL)
     {
@@ -2833,7 +2833,7 @@ static void output_source_sfd( struct makefile *make, struct incl_file *source,
     if (fontforge && !make->src_dir)
     {
         output( "%s: %s\n", ttf_file, source->filename );
-        output( "\t%s -script %s %s $@\n",
+        output( "\t$(QUIET_GEN)%s -script %s %s $@\n",
                 fontforge, top_src_dir_path( make, "fonts/genttf.ff" ), source->filename );
         if (!(source->file->flags & FLAG_SFD_FONTS)) output( "all: %s\n", ttf_file );
     }
@@ -2852,7 +2852,7 @@ static void output_source_sfd( struct makefile *make, struct incl_file *source,
             strarray_add( &make->all_targets, xstrdup( font ));
             output( "%s: %s %s\n", obj_dir_path( make, font ),
                     tools_path( make, "sfnt2fon" ), ttf_file );
-            output( "\t%s -q -o $@ %s %s\n", tools_path( make, "sfnt2fon" ), ttf_file, args );
+            output( "\t$(QUIET_GEN)%s -q -o $@ %s %s\n", tools_path( make, "sfnt2fon" ), ttf_file, args );
             add_install_rule( make, source->name, xstrdup(font), strmake( "d$(fontdir)/%s", font ));
         }
     }
@@ -2875,7 +2875,7 @@ static void output_source_svg( struct makefile *make, struct incl_file *source,
         if (images[i])
         {
             output( "%s.%s: %s\n", src_dir_path( make, obj ), images[i], source->filename );
-            output( "\tCONVERT=\"%s\" ICOTOOL=\"%s\" RSVG=\"%s\" %s %s $@\n", convert, icotool, rsvg,
+            output( "\t$(QUIET_GEN)CONVERT=\"%s\" ICOTOOL=\"%s\" RSVG=\"%s\" %s %s $@\n", convert, icotool, rsvg,
                     top_src_dir_path( make, "tools/buildimage" ), source->filename );
         }
     }
@@ -2908,7 +2908,7 @@ static void output_source_desktop( struct makefile *make, struct incl_file *sour
 static void output_source_po( struct makefile *make, struct incl_file *source, const char *obj )
 {
     output( "%s.mo: %s\n", obj_dir_path( make, obj ), source->filename );
-    output( "\t%s -o $@ %s\n", msgfmt, source->filename );
+    output( "\t$(QUIET_GEN)%s -o $@ %s\n", msgfmt, source->filename );
     strarray_add( &make->all_targets, strmake( "%s.mo", obj ));
 }
 
@@ -2943,7 +2943,7 @@ static void output_source_in( struct makefile *make, struct incl_file *source, c
     strarray_add( &make->in_files, xstrdup(obj) );
     strarray_add( &make->all_targets, xstrdup(obj) );
     output( "%s: %s\n", obj_dir_path( make, obj ), source->filename );
-    output( "\t%s %s >$@ || (rm -f $@ && false)\n", sed_cmd, source->filename );
+    output( "\t$(QUIET_GEN)%s %s >$@ || (rm -f $@ && false)\n", sed_cmd, source->filename );
     output( "%s:", obj_dir_path( make, obj ));
     output_filenames( source->dependencies );
     output( "\n" );
@@ -2972,7 +2972,7 @@ static void output_source_spec( struct makefile *make, struct incl_file *source,
     strarray_add( &make->clean_files, dll_name );
     strarray_add( &make->res_files, strmake( "%s.res", obj ));
     output( "%s.res: %s\n", obj_dir_path( make, obj ), obj_dir_path( make, dll_name ));
-    output( "\techo \"%s.dll TESTDLL \\\"%s\\\"\" | %s -o $@\n", obj,
+    output( "\t$(QUIET_GEN)echo \"%s.dll TESTDLL \\\"%s\\\"\" | %s -o $@\n", obj,
             obj_dir_path( make, dll_name ), tools_path( make, "wrc" ));
 
     output( "%s:", obj_dir_path( make, dll_name ));
@@ -3028,7 +3028,7 @@ static void output_source_default( struct makefile *make, struct incl_file *sour
         else
             strarray_add( &make->clean_files, strmake( "%s.o", obj ));
         output( "%s.o: %s\n", obj_dir_path( make, obj ), source->filename );
-        output( "\t$(CC) -c -o $@ %s", source->filename );
+        output( "\t$(QUIET_CC)$(CC) -c -o $@ %s", source->filename );
         output_filenames( defines );
         if (make->module || make->staticlib || make->sharedlib || make->testdll)
         {
@@ -3044,7 +3044,7 @@ static void output_source_default( struct makefile *make, struct incl_file *sour
     {
         strarray_add( is_dll_src ? &make->clean_files : &make->crossobj_files, strmake( "%s.cross.o", obj ));
         output( "%s.cross.o: %s\n", obj_dir_path( make, obj ), source->filename );
-        output( "\t$(CROSSCC) -c -o $@ %s", source->filename );
+        output( "\t$(QUIET_CC)$(CROSSCC) -c -o $@ %s", source->filename );
         output_filenames( defines );
         output_filenames( extra_cross_cflags );
         output_filenames( cpp_flags );
@@ -3058,7 +3058,7 @@ static void output_source_default( struct makefile *make, struct incl_file *sour
         {
             strarray_add( &make->ok_files, strmake( "%s.ok", obj ));
             output( "%s.ok:\n", obj_dir_path( make, obj ));
-            output( "\t%s $(RUNTESTFLAGS) -T %s -M %s -p %s%s %s && touch $@\n",
+            output( "\t$(QUIET_TEST)%s $(RUNTESTFLAGS) -T %s -M %s -p %s%s %s && touch $@\n",
                     top_src_dir_path( make, "tools/runtest" ), top_obj_dir_path( make, "" ),
                     make->testdll, replace_extension( make->testdll, ".dll", "_test.exe" ),
                     make->is_cross ? "" : dll_ext, obj );
@@ -3251,7 +3251,7 @@ static void output_module( struct makefile *make )
         {
             strarray_add( &make->clean_files, strmake( "lib%s.def", make->importlib ));
             output( "%s.def: %s %s\n", importlib_path, tools_path( make, "winebuild" ), spec_file );
-            output( "\t%s -w --def -o $@", tools_path( make, "winebuild" ) );
+            output( "\t$(QUIET_BUILD)%s -w --def -o $@", tools_path( make, "winebuild" ) );
             output_filenames( target_flags );
             if (make->is_win16) output_filename( "-m16" );
             output_filename( "--export" );
@@ -3272,7 +3272,7 @@ static void output_module( struct makefile *make )
             output( "%s.a: %s %s", importlib_path, tools_path( make, "winebuild" ), spec_file );
             output_filenames_obj_dir( make, make->implib_objs );
             output( "\n" );
-            output( "\t%s -w --implib -o $@", tools_path( make, "winebuild" ) );
+            output( "\t$(QUIET_BUILD)%s -w --implib -o $@", tools_path( make, "winebuild" ) );
             output_filenames( target_flags );
             if (make->is_win16) output_filename( "-m16" );
             output_filename( "--export" );
@@ -3299,7 +3299,7 @@ static void output_module( struct makefile *make )
             output( ": %s %s", tools_path( make, "winebuild" ), spec_file );
             output_filenames_obj_dir( make, cross_files );
             output( "\n" );
-            output( "\t%s -b %s -w --implib -o $@", tools_path( make, "winebuild" ), crosstarget );
+            output( "\t$(QUIET_BUILD)%s -b %s -w --implib -o $@", tools_path( make, "winebuild" ), crosstarget );
             if (make->is_win16) output_filename( "-m16" );
             output_filename( "--export" );
             output_filename( spec_file );
@@ -3327,11 +3327,11 @@ static void output_static_lib( struct makefile *make )
     output( "%s:", obj_dir_path( make, make->staticlib ));
     output_filenames_obj_dir( make, make->object_files );
     output_filenames_obj_dir( make, make->unixobj_files );
-    output( "\n\trm -f $@\n" );
-    output( "\t%s rc $@", ar );
+    output( "\n\t$(QUIET)rm -f $@\n" );
+    output( "\t$(QUIET_AR)%s rc $@", ar );
     output_filenames_obj_dir( make, make->object_files );
     output_filenames_obj_dir( make, make->unixobj_files );
-    output( "\n\t%s $@\n", ranlib );
+    output( "\n\t$(QUIET_RANLIB)%s $@\n", ranlib );
     add_install_rule( make, make->staticlib, make->staticlib,
                       strmake( "d$(dlldir)/%s", make->staticlib ));
     if (needs_cross_lib( make ))
@@ -3341,10 +3341,10 @@ static void output_static_lib( struct makefile *make )
         strarray_add( &make->all_targets, name );
         output( "%s:", obj_dir_path( make, name ));
         output_filenames_obj_dir( make, make->crossobj_files );
-        output( "\n\trm -f $@\n" );
-        output( "\t%s-ar rc $@", crosstarget );
+        output( "\n\t$(QUIET)rm -f $@\n" );
+        output( "\t$(QUIET_AR)%s-ar rc $@", crosstarget );
         output_filenames_obj_dir( make, make->crossobj_files );
-        output( "\n\t%s-ranlib $@\n", crosstarget );
+        output( "\n\t$(QUIET_RANLIB)%s-ranlib $@\n", crosstarget );
     }
 }
 
@@ -3371,7 +3371,7 @@ static void output_shared_lib( struct makefile *make )
     output_filenames_obj_dir( make, make->object_files );
     output_filenames( dep_libs );
     output( "\n" );
-    output( "\t$(CC) -o $@" );
+    output( "\t$(QUIET_CCLD)$(CC) -o $@" );
     output_filenames_obj_dir( make, make->object_files );
     output_filenames( all_libs );
     output_filename( "$(LDFLAGS)" );
@@ -3437,7 +3437,7 @@ static void output_test_module( struct makefile *make )
         output( "all: %s/%s\n", top_obj_dir_path( make, "programs/winetest" ), testres );
     output( "%s/%s: %s%s\n", top_obj_dir_path( make, "programs/winetest" ), testres,
             obj_dir_path( make, stripped ), ext );
-    output( "\techo \"%s TESTRES \\\"%s%s\\\"\" | %s -o $@\n",
+    output( "\t$(QUIET_GEN)echo \"%s TESTRES \\\"%s%s\\\"\" | %s -o $@\n",
             testmodule, obj_dir_path( make, stripped ), ext, tools_path( make, "wrc" ));
 
     output_filenames_obj_dir( make, make->ok_files );
@@ -3481,7 +3481,7 @@ static void output_programs( struct makefile *make )
         output_filenames_obj_dir( make, objs );
         output_filenames( deps );
         output( "\n" );
-        output( "\t$(CC) -o $@" );
+        output( "\t$(QUIET_CCLD)$(CC) -o $@" );
         output_filenames_obj_dir( make, objs );
 
         if (strarray_exists( &all_libs, "-lwine" ))
@@ -3498,7 +3498,7 @@ static void output_programs( struct makefile *make )
                 output_filenames_obj_dir( make, objs );
                 output_filenames( deps );
                 output( "\n" );
-                output( "\t$(CC) -o $@" );
+                output( "\t$(QUIET_CCLD)$(CC) -o $@" );
                 output_filenames_obj_dir( make, objs );
                 output_filename( ldrpath_install );
                 strarray_add( &make->all_targets, program_installed );
@@ -3602,7 +3602,7 @@ static void output_subdirs( struct makefile *make )
                 }
                 output_filename( tools_path( make, "winebuild" ));
                 output( "\n" );
-                output( "\t%s -w -o $@", tools_path( make, "winebuild" ));
+                output( "\t$(QUIET_BUILD)%s -w -o $@", tools_path( make, "winebuild" ));
                 output_filename( *dll_ext ? "--def" : "--implib" );
                 output_filenames( target_flags );
                 if (submake->is_win16) output_filename( "-m16" );
@@ -3624,7 +3624,7 @@ static void output_subdirs( struct makefile *make )
                     output( ": %s", spec_file );
                     output_filename( tools_path( make, "winebuild" ));
                     output( "\n" );
-                    output( "\t%s -b %s -w -o $@", tools_path( make, "winebuild" ), crosstarget );
+                    output( "\t$(QUIET_BUILD)%s -b %s -w -o $@", tools_path( make, "winebuild" ), crosstarget );
                     if (submake->is_win16) output_filename( "-m16" );
                     output_filename( "--implib" );
                     output_filename( "--export" );
@@ -3773,6 +3773,20 @@ static void output_sources( struct makefile *make )
 
     strarray_add( &make->phony_targets, "all" );
 
+    output("ifeq ($(V),0)\n");
+    output(" QUIET          = @\n");
+    output(" QUIET_AR       = @echo '   ' AR $@;\n");
+    output(" QUIET_BISON    = @echo '   ' BISON $@;\n");
+    output(" QUIET_BUILD    = @echo '   ' BUILD $@;\n");
+    output(" QUIET_CC       = @echo '   ' CC $@;\n");
+    output(" QUIET_CCLD     = @echo '   ' CCLD $@;\n");
+    output(" QUIET_GEN      = @echo '   ' GEN $@;\n");
+    output(" QUIET_FLEX     = @echo '   ' FLEX $@;\n");
+    output(" QUIET_LN       = @echo '   ' LN $@;\n");
+    output(" QUIET_RANLIB   = @echo '   ' RANLIB $@;\n");
+    output(" QUIET_TEST     = @echo '   ' TEST $@;\n");
+    output("endif\n\n");
+
     LIST_FOR_EACH_ENTRY( source, &make->sources, struct incl_file, entry )
     {
         char *obj = xstrdup( source->name );
@@ -3804,7 +3818,7 @@ static void output_sources( struct makefile *make )
     {
         output( "%s: %s %s\n", obj_dir_path( make, "dlldata.c" ),
                 tools_path( make, "widl" ), src_dir_path( make, "Makefile.in" ));
-        output( "\t%s --dlldata-only -o $@", tools_path( make, "widl" ));
+        output( "\t$(QUIET_GEN)%s --dlldata-only -o $@", tools_path( make, "widl" ));
         output_filenames( make->dlldata_files );
         output( "\n" );
     }
-- 
2.21.0




More information about the wine-devel mailing list