Build system, autotest.am: Support Automake 1.11 `silent-rules'.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 22 May 2010 13:03:27 +0000 (14:03 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 30 May 2010 14:20:24 +0000 (15:20 +0100)
  * Introduce a new macro mdw_SILENT_RULES which enables the use of
    the `silent-rules' feature if it's available.  If the feature is
    /not/ available, then make sure that AM_DEFAULT_VERBOSITY is
    defined, in order to avoid errors about recursive variable-expansion
    in custom silent-rules actions.

  * Use this machinery to implement `silent-rules' building in the
    package itself.

Makefile.am
aclocal.glob
autotest.am
configure.ac

index 862491d..14de24f 100644 (file)
@@ -36,6 +36,11 @@ CLEANFILES            =
 confsubst = $(srcdir)/confsubst.in
 mkdir_p = $(srcdir)/config/install-sh -d
 
+V_SUBST = $(V_SUBST_$(V))
+V_SUBST_ = $(V_SUBST_$(AM_DEFAULT_VERBOSITY))
+V_SUBST_0 = @echo "  SUBST  $@";
+SUBST = $(V_SUBST)$(confsubst)
+
 ###--------------------------------------------------------------------------
 ### Main scripts.
 
@@ -45,10 +50,10 @@ CLEANFILES          += mklinks
 EXTRA_DIST             += mklinks.in
 
 mklinks: mklinks.in Makefile
-       $(confsubst) $(srcdir)/mklinks.in >$@.new \
+       $(SUBST) $(srcdir)/mklinks.in >$@.new \
                pkgdatadir=$(pkgdatadir) VERSION=$(VERSION)
-       chmod +x $@.new
-       mv $@.new $@
+       $(AM_V_at)chmod +x $@.new
+       $(AM_V_at)mv $@.new $@
 
 ## findlinks
 bin_SCRIPTS            += findlinks
@@ -56,10 +61,10 @@ CLEANFILES          += findlinks
 EXTRA_DIST             += findlinks.in
 
 findlinks: findlinks.in Makefile
-       $(confsubst) $(srcdir)/findlinks.in >$@.new \
+       $(SUBST) $(srcdir)/findlinks.in >$@.new \
                pkgdatadir=$(pkgdatadir) VERSION=$(VERSION)
-       chmod +x $@.new
-       mv $@.new $@
+       $(AM_V_at)chmod +x $@.new
+       $(AM_V_at)mv $@.new $@
 
 ## mdw-setup
 bin_SCRIPTS            += mdw-setup
@@ -93,10 +98,9 @@ CLEANFILES           += confsubst
 EXTRA_DIST             += confsubst.in
 
 confsubst: confsubst.in Makefile
-       $(confsubst) $(srcdir)/confsubst.in >$@.new \
-               VERSION=$(VERSION)
-       chmod +x $@.new
-       mv $@.new $@
+       $(SUBST) $(srcdir)/confsubst.in >$@.new VERSION=$(VERSION)
+       $(AM_V_at)chmod +x $@.new
+       $(AM_V_at)mv $@.new $@
 
 ## auto-version
 pkgdata_SCRIPTS                += auto-version
@@ -104,10 +108,9 @@ CLEANFILES         += auto-version
 EXTRA_DIST             += auto-version.in
 
 auto-version: auto-version.in Makefile
-       $(confsubst) $(srcdir)/auto-version.in >$@.new \
-               VERSION=$(VERSION)
-       chmod +x $@.new
-       mv $@.new $@
+       $(SUBST) $(srcdir)/auto-version.in >$@.new VERSION=$(VERSION)
+       $(AM_V_at)chmod +x $@.new
+       $(AM_V_at)mv $@.new $@
 
 ## Testsuites.
 pkgdata_DATA           += autotest.am
index eb0e4d0..c20cfac 100644 (file)
@@ -68,6 +68,24 @@ AC_DEFUN([mdw_LIBTOOL_VERSION_INFO], [
   AC_SUBST([LIBTOOL_VERSION_INFO])
 ])
 
+dnl --- *@-mdw_SILENT_RULES-@* ---
+dnl
+dnl Author:    Mark Wooding
+dnl
+dnl Synopsis:  mdw_SILENT_RULES
+dnl
+dnl Arguments: ---
+dnl
+dnl Use:       Enables the Automake `silent-rules' feature, if available.
+
+AC_DEFUN([mdw_SILENT_RULES], [
+  m4_ifdef([AM_SILENT_RULES], [
+    AM_SILENT_RULES([yes])
+  ], [
+    AC_SUBST([AM_DEFAULT_VERBOSITY], [1])
+  ])
+])
+
 dnl --- *@-mdw_DECL_ENVIRON-@* ---
 dnl
 dnl Author:    Mark Wooding
index 3a34dc7..c99ce19 100644 (file)
@@ -46,7 +46,7 @@ MAINTAINERCLEANFILES  += $(srcdir)/testsuite
 EXTRA_DIST             += testsuite.at testsuite $(autotest_TESTS)
 
 $(srcdir)/testsuite: $(TESTDEPS)
-       $(AUTOM4TE) --language=autotest \
+       $(AM_V_GEN)$(AUTOM4TE) --language=autotest \
                -I$(srcdir) $@.at -o $@.new && mv $@.new $@
 
 clean-local: clean-testsuite-dir
@@ -58,6 +58,7 @@ clean-testsuite-dir:
 CLEANFILES             += run-tests
 
 run-tests: Makefile $(srcdir)/testsuite
+       $(AM_V_GEN) \
        { echo '#! /bin/sh';                                               \
          echo 'exec $(SHELL) $(srcdir)/testsuite "$$@"';                  \
        } >$@.new && chmod +x $@.new && mv $@.new $@
@@ -71,6 +72,7 @@ MAINTAINERCLEANFILES  += $(srcdir)/tests.m4
 EXTRA_DIST             += tests.m4
 
 $(srcdir)/tests.m4: Makefile.in
+       $(AM_V_GEN) \
        for i in $(all_autotest_TESTS); do \
          echo $$i | sed \
            -e 's:^$(top_srcdir):$(top_builddir):' \
@@ -83,6 +85,7 @@ MAINTAINERCLEANFILES  += $(srcdir)/package.m4
 EXTRA_DIST             += package.m4
 
 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
+       $(AM_V_GEN) \
        { echo '### package information';                                  \
          echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])';      \
          echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])';   \
index e5a9e88..2c11f69 100644 (file)
@@ -32,6 +32,7 @@ AC_INIT([Common Files Distribution], AUTO_VERSION,
 AC_CONFIG_SRCDIR([mdw-setup])
 AC_CONFIG_AUX_DIR([config])
 AM_INIT_AUTOMAKE([foreign])
+mdw_SILENT_RULES
 
 dnl--------------------------------------------------------------------------
 dnl Finding installation directories.