[libgweather] Use shave to improve build log readability



commit 0e90ef6e931b95dd88be89b7a01dc5ffad6a2e5a
Author: Vincent Untz <vuntz gnome org>
Date:   Mon Apr 27 01:42:57 2009 +0200

    Use shave to improve build log readability
    
    See http://git.lespiau.name/cgit/shave/tree/README for more details.
---
 configure.in            |    5 +++
 data/Makefile.am        |   20 ++++++-----
 libgweather/Makefile.am |    6 ++-
 m4/shave.m4             |   77 +++++++++++++++++++++++++++++++++++++++++++++
 python/Makefile.am      |    4 ++-
 shave-libtool.in        |   69 +++++++++++++++++++++++++++++++++++++++++
 shave.in                |   79 +++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 248 insertions(+), 12 deletions(-)

diff --git a/configure.in b/configure.in
index ccfed66..ce24c7a 100644
--- a/configure.in
+++ b/configure.in
@@ -3,6 +3,7 @@ AC_PREREQ(2.59)
 
 AM_CONFIG_HEADER(config.h)
 AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2])
+AC_CONFIG_MACRO_DIR([m4])
 
 # Before making a release, the LT_VERSION string should be modified.
 # The string is of the form C:R:A.
@@ -235,11 +236,15 @@ AC_SUBST(GLADEDIR)
 ##################################################
 GTK_DOC_CHECK([1.9])
 
+SHAVE_INIT([.], [enable])
+
 dnl ***************************************************************************
 dnl *** Output Makefiles et al                                              ***
 dnl ***************************************************************************
 AC_OUTPUT([
 Makefile
+shave
+shave-libtool
 doc/Makefile
 po/Makefile.in
 po-locations/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index d3e5de0..a3b0950 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,3 +1,5 @@
+QUIET_GEN = $(Q:@= echo '  GEN   '$@;)
+
 libgweatherdtddir = $(pkgdatadir)
 libgweatherdtd_DATA = locations.dtd
 
@@ -11,7 +13,7 @@ LOCATIONS_STAMP =
 libgweatherlocations_DATA = $(libgweatherlocations_in_files:.xml.in=.xml$(COMPRESS_EXT))
 
 %.xml$(COMPRESS_EXT): %.xml.in $(wildcard $(top_srcdir)/po-locations/*.po)
-	LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po-locations/.intltool-merge-cache $(top_srcdir)/po-locations $< `echo $@ | sed "s/.xml$(COMPRESS_EXT)/.xml/"`
+	$(QUIET_GEN)LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po-locations/.intltool-merge-cache $(top_srcdir)/po-locations $< `echo $@ | sed "s/.xml$(COMPRESS_EXT)/.xml/"` && \
 	if test "x$(COMPRESS_EXT)" = "x.gz"; then				\
 		gzip --force `echo $@ | sed "s/.xml$(COMPRESS_EXT)/.xml/"`;	\
 	fi
@@ -33,7 +35,7 @@ libgweatherlocations_DATA = $(shell echo $(PO_LOCATIONS) | sed "s|$(top_srcdir)/
 $(libgweatherlocations_DATA): $(LOCATIONS_STAMP)
 
 $(LOCATIONS_STAMP): $(libgweatherlocations_in_files) $(PO_LOCATIONS) Makefile
-	LC_ALL=C $(INTLTOOL_MERGE) --multiple-output --xml-style --utf8 --cache=$(top_builddir)/po-locations/.intltool-merge-cache $(top_srcdir)/po-locations $< $(libgweatherlocations_data)
+	LC_ALL=C $(INTLTOOL_MERGE) --multiple-output --xml-style --utf8 --cache=$(top_builddir)/po-locations/.intltool-merge-cache $(top_srcdir)/po-locations $< $(libgweatherlocations_data) && \
 	for pofile in $(PO_LOCATIONS); do \
 		locale=`echo $$pofile | sed "s;$(top_srcdir)/po-locations/\(.*\)\.po;\1;"`;	\
 		xmllint --noblanks -o Locations.$$locale.xml $$locale/$(libgweatherlocations_data); \
@@ -42,13 +44,13 @@ $(LOCATIONS_STAMP): $(libgweatherlocations_in_files) $(PO_LOCATIONS) Makefile
 		if test "x$(COMPRESS_EXT)" = "x.gz"; then		\
 			gzip --force Locations.$$locale.xml;		\
 		fi;							\
-	done
-	xmllint --noblanks -o Locations.xml C/$(libgweatherlocations_data)
-	rm -f C/$(libgweatherlocations_data)
-	test -d C && rmdir C
+	done &&								\
+	xmllint --noblanks -o Locations.xml C/$(libgweatherlocations_data) && \
+	rm -f C/$(libgweatherlocations_data) &&				\
+	test -d C && rmdir C &&						\
 	if test "x$(COMPRESS_EXT)" = "x.gz"; then			\
 		gzip --force Locations.xml;				\
-	fi
+	fi &&								\
 	touch $@
 
 endif # USE_ONE_BIG_XML
@@ -59,10 +61,10 @@ check:
 
 ### Locations.xml.in rebuild
 rebuild-locations: locationdb.sqlite update-locations.py
-	($(srcdir)/update-locations.py > Locations.xml.in.new && mv Locations.xml.in.new Locations.xml.in) || rm -f Locations.xml.in.new
+	$(QUIET_GEN)($(srcdir)/update-locations.py > Locations.xml.in.new && mv Locations.xml.in.new Locations.xml.in) || rm -f Locations.xml.in.new
 
 locationdb.sqlite: build-locationdb.pl major-cities.txt sources/nsd_cccc.txt sources/POP_PLACES.txt sources/US_CONCISE.txt sources/geonames_dd_dms_date_*.txt city-fixups.pl station-fixups.pl
-	$(srcdir)/build-locationdb.pl
+	$(QUIET_GEN)$(srcdir)/build-locationdb.pl
 
 EXTRA_DIST =	\
 	$(libgweatherlocations_in_files)	\
diff --git a/libgweather/Makefile.am b/libgweather/Makefile.am
index d92943a..b99e1bb 100644
--- a/libgweather/Makefile.am
+++ b/libgweather/Makefile.am
@@ -1,3 +1,5 @@
+QUIET_GEN = $(Q:@= echo '  GEN   '$@;)
+
 lib_LTLIBRARIES = libgweather.la
 
 libgweatherincdir = $(includedir)/libgweather
@@ -61,13 +63,13 @@ libgweather_la_LDFLAGS = \
 MKENUMS_GENERATED = gweather-enum-types.c gweather-enum-types.h
 
 gweather-enum-types.h: $(gweather_new_headers)
-	( cd $(srcdir) && $(GLIB_MKENUMS) --template gweather-enum-types.h.tmpl \
+	$(QUIET_GEN)( cd $(srcdir) && $(GLIB_MKENUMS) --template gweather-enum-types.h.tmpl \
 		$(gweather_new_headers) ) > gweather-enum-types.h.tmp \
 	&& mv gweather-enum-types.h.tmp gweather-enum-types.h \
 	|| rm -f gweather-enum-type.h.tmp
 
 gweather-enum-types.c: $(libgweatherinclude_HEADERS)
-	( cd $(srcdir) && $(GLIB_MKENUMS) --template gweather-enum-types.c.tmpl \
+	$(QUIET_GEN)( cd $(srcdir) && $(GLIB_MKENUMS) --template gweather-enum-types.c.tmpl \
 		$(gweather_new_headers) ) > gweather-enum-types.c.tmp \
 	&& mv gweather-enum-types.c.tmp gweather-enum-types.c \
 	|| rm -f gweather-enum-type.c.tmp
diff --git a/m4/shave.m4 b/m4/shave.m4
new file mode 100644
index 0000000..0a3509e
--- /dev/null
+++ b/m4/shave.m4
@@ -0,0 +1,77 @@
+dnl Make automake/libtool output more friendly to humans
+dnl  Damien Lespiau <damien lespiau gmail com>
+dnl
+dnl SHAVE_INIT([shavedir],[default_mode])
+dnl
+dnl shavedir: the directory where the shave scripts are, it defaults to
+dnl           $(top_builddir)
+dnl default_mode: (enable|disable) default shave mode.  This parameter
+dnl               controls shave's behaviour when no option has been
+dnl               given to configure.  It defaults to disable.
+dnl
+dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just
+dnl   before AC_CONFIG_FILE/AC_OUTPUT is perfect.  This macro rewrites CC and
+dnl   LIBTOOL, you don't want the configure tests to have these variables
+dnl   re-defined.
+dnl * This macro requires GNU make's -s option.
+
+AC_DEFUN([_SHAVE_ARG_ENABLE],
+[
+  AC_ARG_ENABLE([shave],
+    AS_HELP_STRING(
+      [--enable-shave],
+      [use shave to make the build pretty [[default=$1]]]),,
+      [enable_shave=$1]
+    )
+])
+
+AC_DEFUN([SHAVE_INIT],
+[
+  dnl you can tweak the default value of enable_shave
+  m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)])
+
+  if test x"$enable_shave" = xyes; then
+    dnl where can we find the shave scripts?
+    m4_if([$1],,
+      [shavedir="$ac_pwd"],
+      [shavedir="$ac_pwd/$1"])
+    AC_SUBST(shavedir)
+
+    dnl make is now quiet
+    AC_SUBST([MAKEFLAGS], [-s])
+    AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`'])
+
+    dnl we need sed
+    AC_CHECK_PROG(SED,sed,sed,false)
+
+    dnl substitute libtool
+    SHAVE_SAVED_LIBTOOL=$LIBTOOL
+    LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'"
+    AC_SUBST(LIBTOOL)
+
+    dnl substitute cc/cxx
+    SHAVE_SAVED_CC=$CC
+    SHAVE_SAVED_CXX=$CXX
+    SHAVE_SAVED_FC=$FC
+    SHAVE_SAVED_F77=$F77
+    SHAVE_SAVED_OBJC=$OBJC
+    CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}"
+    CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}"
+    FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}"
+    F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}"
+    OBJC="${SHELL} ${shavedir}/shave objc ${SHAVE_SAVED_OBJC}"
+    AC_SUBST(CC)
+    AC_SUBST(CXX)
+    AC_SUBST(FC)
+    AC_SUBST(F77)
+    AC_SUBST(OBJC)
+
+    V=@
+  else
+    V=1
+  fi
+  Q='$(V:1=)'
+  AC_SUBST(V)
+  AC_SUBST(Q)
+])
+
diff --git a/python/Makefile.am b/python/Makefile.am
index 40681ad..51b49a8 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -1,4 +1,6 @@
 if BUILD_PYTHON
+QUIET_GEN = $(Q:@= echo '  GEN   '$@;)
+
 INCLUDES =			\
 	$(PYTHON_INCLUDES)	\
 	$(PYGOBJECT_CFLAGS)	\
@@ -14,7 +16,7 @@ gweather.c: gweather.defs gweather.override
 CLEANFILES = gweather.c
 
 .defs.c:
-	(cd $(srcdir)\
+	$(QUIET_GEN)(cd $(srcdir)\
 	 && pygtk-codegen-2.0 \
 		--register $(PYGTK_DEFS) \
 		--override $*.override \
diff --git a/shave-libtool.in b/shave-libtool.in
new file mode 100644
index 0000000..1f3a720
--- /dev/null
+++ b/shave-libtool.in
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# we need sed
+SED= SED@
+if test -z "$SED" ; then
+SED=sed
+fi
+
+lt_unmangle ()
+{
+   last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
+}
+
+# the real libtool to use
+LIBTOOL="$1"
+shift
+
+# if 1, don't print anything, the underlaying wrapper will do it
+pass_though=0
+
+# scan the arguments, keep the right ones for libtool, and discover the mode
+preserved_args=
+while test "$#" -gt 0; do
+    opt="$1"
+    shift
+
+    case $opt in
+    --mode=*)
+        mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
+        preserved_args="$preserved_args $opt"
+        ;;
+    -o)
+        lt_output="$1"
+        preserved_args="$preserved_args $opt"
+	;;
+    *)
+        preserved_args="$preserved_args $opt"
+        ;;
+      esac
+done
+
+case "$mode" in
+compile)
+    # shave will be called and print the actual CC/CXX/LINK line
+    preserved_args="$preserved_args --shave-mode=$mode"
+    pass_though=1
+    ;;
+link)
+    preserved_args="$preserved_args --shave-mode=$mode"
+    Q="  LINK  "
+    ;;
+*)
+    # let's u
+    # echo "*** libtool: Unimplemented mode: $mode, fill a bug report"
+    ;;
+esac
+
+lt_unmangle "$lt_output"
+output=$last_result
+
+if test -z $V; then
+    if test $pass_though -eq 0; then
+        echo "$Q$output"
+    fi
+    $LIBTOOL --silent $preserved_args
+else
+    echo $LIBTOOL $preserved_args
+    $LIBTOOL $preserved_args
+fi
diff --git a/shave.in b/shave.in
new file mode 100644
index 0000000..5c16f27
--- /dev/null
+++ b/shave.in
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# we need sed
+SED= SED@
+if test -z "$SED" ; then
+SED=sed
+fi
+
+lt_unmangle ()
+{
+   last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
+}
+
+# the tool to wrap (cc, cxx, ar, ranlib, ..)
+tool="$1"
+shift
+
+# the reel tool (to call)
+REEL_TOOL="$1"
+shift
+
+pass_through=0
+preserved_args=
+while test "$#" -gt 0; do
+    opt="$1"
+    shift
+
+    case $opt in
+    --shave-mode=*)
+        mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
+	;;
+    -o)
+        lt_output="$1"
+        preserved_args="$preserved_args $opt"
+	;;
+    *)
+        preserved_args="$preserved_args $opt"
+        ;;
+      esac
+done
+
+# mode=link is handled in the libtool wrapper
+case "$mode,$tool" in
+link,*)
+    pass_through=1
+    ;;
+*,cxx)
+    Q="  CXX   "
+    ;;
+*,cc)
+    Q="  CC    "
+    ;;
+*,fc)
+    Q="  FC    "
+    ;;
+*,f77)
+    Q="  F77   "
+    ;;
+*,objc)
+    Q="  OBJC   "
+    ;;
+*,*)
+    # should not happen
+    Q="  CC    "
+    ;;
+esac
+
+lt_unmangle "$lt_output"
+output=$last_result
+
+if test -z $V; then
+    if test $pass_through -eq 0; then
+        echo "$Q$output"
+    fi
+    $REEL_TOOL $preserved_args
+else
+    echo $REEL_TOOL $preserved_args
+    $REEL_TOOL $preserved_args
+fi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]