[libvirt] PATCH: Allow for quiet build output

Daniel P. Berrange berrange at redhat.com
Tue Apr 28 11:30:11 UTC 2009


The following patch is a slightly gross hack that puts a wrapper around
libtool to make it STFU, and only print the name of the output file, and
associated input files.  Since we can't change the automake generated
Makefile.in to add '@' in front of all libtool commands, this sill won't
be quiet by default. To make it really quiet you need to run 'make -s'

eg,  a short transcript with this applied....

$ make -s
Making all in gnulib/lib
(CC) -o c-ctype.lo c-ctype.c
(CC) -o asnprintf.lo asnprintf.c
(CC) -o physmem.lo physmem.c
(CC) -o printf-args.lo printf-args.c
(CC) -o printf-parse.lo printf-parse.c
(CC) -o tempname.lo tempname.c
(CC) -o vasnprintf.lo vasnprintf.c
(LD) -o libgnu.la c-ctype.lo asnprintf.lo physmem.lo printf-args.lo printf-parse.lo tempname.lo vasnprintf.lo
Making all in include
Making all in libvirt
Making all in src
(CC) -o bridge.lo bridge.c
(CC) -o buf.lo buf.c
(CC) -o conf.lo conf.c
(CC) -o event.lo event.c
(CC) -o hash.lo hash.c
(CC) -o iptables.lo iptables.c
(CC) -o logging.lo logging.c
(CC) -o memory.lo memory.c
(CC) -o pci.lo pci.c
(CC) -o qparams.lo qparams.c
(CC) -o threads.lo threads.c
(CC) -o uuid.lo uuid.c
(CC) -o util.lo util.c
(CC) -o virterror.lo virterror.c
(CC) -o xml.lo xml.c
(LD) -o libvirt_util.la bridge.lo buf.lo conf.lo event.lo hash.lo iptables.lo logging.lo memory.lo pci.lo qparams.lo threads.lo uuid.lo util.lo virterror.lo xml.lo
(CC) -o libvirt_driver_la-driver.lo driver.c
(CC) -o libvirt_driver_la-datatypes.lo datatypes.c
(CC) -o libvirt_driver_la-domain_event.lo domain_event.c
(CC) -o libvirt_driver_la-stats_linux.lo stats_linux.c
(CC) -o libvirt_driver_la-libvirt.lo libvirt.c
(CC) -o libvirt_driver_la-capabilities.lo capabilities.c
(CC) -o libvirt_driver_la-domain_conf.lo domain_conf.c
(CC) -o libvirt_driver_la-nodeinfo.lo nodeinfo.c
(CC) -o libvirt_driver_la-network_conf.lo network_conf.c
(CC) -o libvirt_driver_la-storage_conf.lo storage_conf.c
(CC) -o libvirt_driver_la-node_device_conf.lo node_device_conf.c
(LD) -o libvirt_driver.la libvirt_driver_la-driver.lo libvirt_driver_la-datatypes.lo libvirt_driver_la-domain_event.lo libvirt_driver_la-stats_linux.lo libvirt_driver_la-libvirt.lo libvirt_driver_la-capabilities.lo libvirt_driver_la-domain_conf.lo libvirt_driver_la-nodeinfo.lo libvirt_driver_la-network_conf.lo libvirt_driver_la-storage_conf.lo libvirt_driver_la-node_device_conf.lo
(CC) -o test.lo test.c
(LD) -o libvirt_driver_test.la test.lo
(CC) -o libvirt_driver_remote_la-remote_internal.lo remote_internal.c
(CC) -o libvirt_driver_remote_la-remote_protocol.lo ../qemud/remote_protocol.c
(LD) -o libvirt_driver_remote.la libvirt_driver_remote_la-remote_internal.lo libvirt_driver_remote_la-remote_protocol.lo
(CC) -o libvirt_driver_xen_la-proxy_internal.lo proxy_internal.c


Aside from changing libtool and automake themselves, I don't see any
easier way to do this better.

 b/mylibtool                                 |   62 ++++++++++++++++++++++++++++
 examples/domain-events/events-c/Makefile.am |    3 +
 examples/hellolibvirt/Makefile.am           |    3 +
 gnulib/lib/Makefile.am                      |    3 +
 proxy/Makefile.am                           |    3 +
 qemud/Makefile.am                           |    3 +
 src/Makefile.am                             |    3 +
 tests/Makefile.am                           |    3 +
 tools/Makefile.am                           |    3 +
 9 files changed, 86 insertions(+)


Daniel

diff -r f60b121571f2 examples/domain-events/events-c/Makefile.am
--- a/examples/domain-events/events-c/Makefile.am	Mon Apr 27 12:12:23 2009 +0100
+++ b/examples/domain-events/events-c/Makefile.am	Tue Apr 28 12:26:44 2009 +0100
@@ -1,3 +1,6 @@
+AM_LIBTOOLFLAGS = --silent
+LIBTOOL = $(top_srcdir)/mylibtool
+
 INCLUDES = -I at top_srcdir@/include
 noinst_PROGRAMS = event-test
 event_test_CFLAGS = $(WARN_CFLAGS)
diff -r f60b121571f2 examples/hellolibvirt/Makefile.am
--- a/examples/hellolibvirt/Makefile.am	Mon Apr 27 12:12:23 2009 +0100
+++ b/examples/hellolibvirt/Makefile.am	Tue Apr 28 12:26:44 2009 +0100
@@ -1,3 +1,6 @@
+AM_LIBTOOLFLAGS = --silent
+LIBTOOL = $(top_srcdir)/mylibtool
+
 INCLUDES = -I at top_srcdir@/include
 noinst_PROGRAMS = hellolibvirt
 hellolibvirt_CFLAGS = $(WARN_CFLAGS)
diff -r f60b121571f2 gnulib/lib/Makefile.am
--- a/gnulib/lib/Makefile.am	Mon Apr 27 12:12:23 2009 +0100
+++ b/gnulib/lib/Makefile.am	Tue Apr 28 12:26:44 2009 +0100
@@ -11,6 +11,9 @@
 # Generated by gnulib-tool.
 # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --tests-base=gnulib/tests --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl --no-vc-files c-ctype close connect getaddrinfo gethostname getpass gettext inet_pton ioctl mkstemp mktempd perror physmem poll posix-shell random_r recv send setsockopt socket stpcpy strerror strndup strsep sys_stat time_r useless-if-before-free vasprintf vc-list-files verify
 
+AM_LIBTOOLFLAGS = --silent
+LIBTOOL = $(top_srcdir)/mylibtool
+
 AUTOMAKE_OPTIONS = 1.5 gnits
 
 SUBDIRS =
diff -r f60b121571f2 mylibtool
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mylibtool	Tue Apr 28 12:26:44 2009 +0100
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+mode=libtool
+cfiles=""
+ofiles=""
+afiles=""
+
+wantnext=0
+for v in "$@"
+do
+  case $v
+  in
+     --mode=compile)
+        mode=CC
+        ;;
+     --mode=link)
+        mode=LD
+        ;;
+  esac
+
+  case $v
+  in
+    *.c)
+    cfiles="$cfiles $v"
+    ;;
+    *.o)
+    if [ "$mode" = "LD" -o "$wantnext" = "1" ]; then
+      ofiles="$ofiles $v"
+    fi
+    ;;
+    *.lo)
+    if [ "$mode" = "LD" -o "$wantnext" = "1" ]; then
+      ofiles="$ofiles $v"
+    fi
+    ;;
+  esac
+
+  if [ "$mode" = "LD" -a "$wantnext" = "1" ]; then
+      afiles="$afiles $v"
+  fi
+
+  if [ "$v" = "-o" ]; then
+    wantnext=1
+  else
+    wantnext=0
+  fi
+done
+
+#afiles=`echo $afiles | sed -e 's/ /\n/g' | sort | uniq | tr '\n' ' '`
+#cfiles=`echo $cfiles | sed -e 's/ /\n/g' | sort | uniq | tr '\n' ' '`
+#ofiles=`echo $ofiles | sed -e 's/ /\n/g' | sort | uniq | tr '\n' ' '`
+
+args=""
+test -n "$afiles" && args="$args -o$afiles"
+test -n "$ofiles" -a "$mode" = "CC" && args="$args -o"
+test -n "$ofiles" && args="$args$ofiles"
+test -n "$cfiles" && args="$args$cfiles"
+
+echo "($mode)$args"
+
+here=`dirname $0`
+exec $here/libtool "$@"
diff -r f60b121571f2 proxy/Makefile.am
--- a/proxy/Makefile.am	Mon Apr 27 12:12:23 2009 +0100
+++ b/proxy/Makefile.am	Tue Apr 28 12:26:44 2009 +0100
@@ -1,5 +1,8 @@
 ## Process this file with automake to produce Makefile.in
 
+AM_LIBTOOLFLAGS = --silent
+LIBTOOL = $(top_srcdir)/mylibtool
+
 if WITH_PROXY
 INCLUDES = -I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
            -I$(top_builddir)/include -I at top_srcdir@/include \
diff -r f60b121571f2 qemud/Makefile.am
--- a/qemud/Makefile.am	Mon Apr 27 12:12:23 2009 +0100
+++ b/qemud/Makefile.am	Tue Apr 28 12:26:44 2009 +0100
@@ -1,5 +1,8 @@
 ## Process this file with automake to produce Makefile.in
 
+AM_LIBTOOLFLAGS = --silent
+LIBTOOL = $(top_srcdir)/mylibtool
+
 DAEMON_SOURCES =					\
 		event.c event.h				\
 		qemud.c qemud.h				\
diff -r f60b121571f2 src/Makefile.am
--- a/src/Makefile.am	Mon Apr 27 12:12:23 2009 +0100
+++ b/src/Makefile.am	Tue Apr 28 12:26:44 2009 +0100
@@ -1,5 +1,8 @@
 ## Process this file with automake to produce Makefile.in
 
+AM_LIBTOOLFLAGS = --silent
+LIBTOOL = $(top_srcdir)/mylibtool
+
 INCLUDES = \
 	   -I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
 	   -I../include \
diff -r f60b121571f2 tests/Makefile.am
--- a/tests/Makefile.am	Mon Apr 27 12:12:23 2009 +0100
+++ b/tests/Makefile.am	Tue Apr 28 12:26:44 2009 +0100
@@ -1,5 +1,8 @@
 ## Process this file with automake to produce Makefile.in
 
+AM_LIBTOOLFLAGS = --silent
+LIBTOOL = $(top_srcdir)/mylibtool
+
 SHELL = $(PREFERABLY_POSIX_SHELL)
 
 SUBDIRS = confdata sexpr2xmldata \
diff -r f60b121571f2 tools/Makefile.am
--- a/tools/Makefile.am	Mon Apr 27 12:12:23 2009 +0100
+++ b/tools/Makefile.am	Tue Apr 28 12:26:44 2009 +0100
@@ -1,3 +1,6 @@
+
+AM_LIBTOOLFLAGS = --silent
+LIBTOOL = $(top_srcdir)/mylibtool
 
 bin_SCRIPTS = \
 	virt-xml-validate

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list