Add silent rules support for texinfo outputs.
authorJack Kelly <endgame.dos@gmail.com>
Tue, 22 Sep 2009 02:24:04 +0000 (12:24 +1000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Fri, 25 Sep 2009 19:17:13 +0000 (21:17 +0200)
* automake.in (define_verbose_texinfo): Define several new verbose
tagvars and verbose vars.
(define_verbose_tagvar): Increase spacing to 8 to accommodate
MAKEINFO, TEXI2DVI, TEXI2PDF.
(handle_texinfo): Additional substitution for silencing dvips.
(output_texinfo_build_rules): Additional substitutions for
silencing texi2dvi and texi2pdf.
* lib/am/texibuild.am: Add silencing to makeinfo, makeinfo --html,
texi2dvi and texi2pdf rules.
* lib/am/texinfos.am: Add silencing to .dvi.ps rule.
* tests/Makefile.am: Add silent8.test.
* tests/silent8.test: New test: tests that silent texinfo rules
produce quiet messages.
* NEWS: Update.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
automake.in
doc/Makefile.in
lib/am/texibuild.am
lib/am/texinfos.am
tests/Makefile.am
tests/Makefile.in
tests/silent8.test [new file with mode: 0755]

index 6ed8dc9..f5c3689 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2009-09-25  Jack Kelly  <endgame.dos@gmail.com>
+
+       Add silent rules support for texinfo outputs.
+       * automake.in (define_verbose_texinfo): Define several new verbose
+       tagvars and verbose vars.
+       (define_verbose_tagvar): Increase spacing to 8 to accommodate
+       MAKEINFO, TEXI2DVI, TEXI2PDF.
+       (handle_texinfo): Additional substitution for silencing dvips.
+       (output_texinfo_build_rules): Additional substitutions for
+       silencing texi2dvi and texi2pdf.
+       * lib/am/texibuild.am: Add silencing to makeinfo, makeinfo --html,
+       texi2dvi and texi2pdf rules.
+       * lib/am/texinfos.am: Add silencing to .dvi.ps rule.
+       * tests/Makefile.am: Add silent8.test.
+       * tests/silent8.test: New test: tests that silent texinfo rules
+       produce quiet messages.
+       * NEWS: Update.
+
 2009-09-18  Peter Johansson  <trojkan@gmail.com>  (tiny change)
 
        Fix link to "Recursive Make Considered Harmful" paper.
diff --git a/NEWS b/NEWS
index cd427fb..7b7ab11 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,9 @@
 New in 1.11.0a:
 
+* Changes to automake:
+
+  - automake now generates silenced rules for texinfo outputs.
+
 Bugs fixed in 1.11.0a:
 
 * Bugs introduced by 1.11:
index bab8c42..25ba40d 100755 (executable)
@@ -1199,11 +1199,25 @@ sub define_verbose_tagvar ($)
     my ($name) = @_;
     if (option 'silent-rules')
       {
-       define_verbose_var ($name, '@echo "  '. $name . ' ' x (6 - length ($name)) . '" $@;');
+       define_verbose_var ($name, '@echo "  '. $name . ' ' x (8 - length ($name)) . '" $@;');
        define_verbose_var ('at', '@');
       }
 }
 
+# define_verbose_texinfo
+# ----------------------
+# Engage the needed `silent-rules' machinery for assorted texinfo commands.
+sub define_verbose_texinfo ()
+{
+  my @tagvars = ('DVIPS', 'MAKEINFO', 'INFOHTML', 'TEXI2DVI', 'TEXI2PDF');
+  foreach my $tag (@tagvars)
+    {
+      define_verbose_tagvar($tag);
+    }
+  define_verbose_var('texinfo', '-q');
+  define_verbose_var('texidevnull', '> /dev/null');
+}
+
 # define_verbose_libtool
 # ----------------------
 # Engage the needed `silent-rules' machinery for `libtool --silent'.
@@ -3233,6 +3247,9 @@ sub output_texinfo_build_rules ($$$@)
 
   $output_rules .= file_contents ('texibuild',
                                  new Automake::Location,
+                                  AM_V_MAKEINFO    => verbose_flag('MAKEINFO'),
+                                  AM_V_TEXI2DVI    => verbose_flag('TEXI2DVI'),
+                                  AM_V_TEXI2PDF    => verbose_flag('TEXI2PDF'),
                                  DEPS             => "@deps",
                                  DEST_PREFIX      => $dpfx,
                                  DEST_INFO_PREFIX => $dipfx,
@@ -3242,12 +3259,15 @@ sub output_texinfo_build_rules ($$$@)
                                  GENERIC_INFO     => $generic_info,
                                  INSRC            => $insrc,
                                  MAKEINFOFLAGS    => $makeinfoflags,
+                                  SILENT           => silent_flag(),
                                  SOURCE           => ($generic
                                                       ? '$<' : $source),
                                  SOURCE_INFO      => ($generic_info
                                                       ? '$<' : $source),
                                  SOURCE_REAL      => $source,
                                  SOURCE_SUFFIX    => $ssfx,
+                                  TEXIQUIET        => verbose_flag('texinfo'),
+                                  TEXIDEVNULL      => verbose_flag('texidevnull'),
                                  );
   return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html");
 }
@@ -3556,6 +3576,7 @@ sub handle_texinfo ()
   my ($mostlyclean, $clean, $maintclean) = ('', '', '');
   if ($info_texinfos)
     {
+      define_verbose_texinfo;
       ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos);
       chomp $mostlyclean;
       chomp $clean;
@@ -3564,10 +3585,12 @@ sub handle_texinfo ()
 
   $output_rules .=  file_contents ('texinfos',
                                   new Automake::Location,
+                                   AM_V_DVIPS    => verbose_flag('DVIPS'),
                                   MOSTLYCLEAN   => $mostlyclean,
                                   TEXICLEAN     => $clean,
                                   MAINTCLEAN    => $maintclean,
-                                  'LOCAL-TEXIS' => !!$info_texinfos);
+                                  'LOCAL-TEXIS' => !!$info_texinfos,
+                                   TEXIQUIET     => verbose_flag('texinfo'));
 }
 
 
index 1deaa30..fbac159 100644 (file)
@@ -287,12 +287,12 @@ $(am__aclocal_m4_deps):
 .texi.dvi:
        TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
        MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
-       $(TEXI2DVI) $<
+       $(TEXI2DVI)  $< 
 
 .texi.pdf:
        TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
        MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
-       $(TEXI2PDF) $<
+       $(TEXI2PDF)  $< 
 
 .texi.html:
        rm -rf $(@:.html=.htp)
@@ -332,7 +332,7 @@ maintainer-clean-vti:
        -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi
 .dvi.ps:
        TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
-       $(DVIPS) -o $@ $<
+       $(DVIPS)  -o $@ $<
 
 uninstall-dvi-am:
        @$(NORMAL_UNINSTALL)
index dca9ce1..4b1add7 100644 (file)
@@ -32,7 +32,7 @@
 ##    to fail, the info files are not removed.  (They are needed by the
 ##    developer while he writes documentation.)
 ## *.iNN files are used on DJGPP.  See the comments in install-info-am
-       restore=: && backupdir="$(am__leading_dot)am$$$$" && \
+       %AM_V_MAKEINFO%restore=: && backupdir="$(am__leading_dot)am$$$$" && \
 ?INSRC?        am__cwd=`pwd` && $(am__cd) $(srcdir) && \
        rm -rf $$backupdir && mkdir $$backupdir && \
 ## If makeinfo is not installed we must not backup the files so
@@ -62,23 +62,27 @@ INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
 
 ?GENERIC?%SOURCE_SUFFIX%.dvi:
 ?!GENERIC?%DEST_PREFIX%.dvi: %SOURCE% %DEPS% %DIRSTAMP%
-       TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+       %AM_V_TEXI2DVI%TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
 ## Must set MAKEINFO like this so that version.texi will be found even
 ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
        MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS%' \
 ## Do not use `-o' unless necessary: it is only supported since Texinfo 4.1.
-?GENERIC?      $(TEXI2DVI) %SOURCE%
-?!GENERIC?     $(TEXI2DVI) -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+## texi2dvi doesn't silence everything with -q, redirect to /dev/null instead.
+## We still want -q (%TEXIQUIET%) because it turns on batch mode.
+?GENERIC?      $(TEXI2DVI) %TEXIQUIET% %SOURCE% %TEXIDEVNULL%
+?!GENERIC?     $(TEXI2DVI) %TEXIQUIET% -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% %TEXIDEVNULL%
 
 ?GENERIC?%SOURCE_SUFFIX%.pdf:
 ?!GENERIC?%DEST_PREFIX%.pdf: %SOURCE% %DEPS% %DIRSTAMP%
-       TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+       %AM_V_TEXI2PDF%TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
 ## Must set MAKEINFO like this so that version.texi will be found even
 ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
        MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS%' \
 ## Do not use `-o' unless necessary: it is only supported since Texinfo 4.1.
-?GENERIC?      $(TEXI2PDF) %SOURCE%
-?!GENERIC?     $(TEXI2PDF) -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+## texi2pdf doesn't silence everything with -q, redirect to /dev/null instead.
+## We still want -q (%TEXIQUIET%) because it turns on batch mode.
+?GENERIC?      $(TEXI2PDF) %TEXIQUIET% %SOURCE% %TEXIDEVNULL%
+?!GENERIC?     $(TEXI2PDF) %TEXIQUIET% -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% %TEXIDEVNULL%
 
 ?GENERIC?%SOURCE_SUFFIX%.html:
 ?!GENERIC?%DEST_PREFIX%.html: %SOURCE% %DEPS% %DIRSTAMP%
@@ -88,8 +92,8 @@ INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
 ## in the manual change, it may leave unused pages.  Our fix
 ## is to build under a temporary name, and replace the target on
 ## success.
-       rm -rf $(@:.html=.htp)
-       if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \
+       %AM_V_MAKEINFO%rm -rf $(@:.html=.htp)
+       %SILENT%if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \
 ?GENERIC?       -o $(@:.html=.htp) %SOURCE%; \
 ?!GENERIC?      -o $(@:.html=.htp) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \
        then \
index c9dcd9d..bfde665 100644 (file)
@@ -55,8 +55,8 @@ endif %?LOCAL-TEXIS%
 if %?LOCAL-TEXIS%
 DVIPS = dvips
 .dvi.ps:
-       TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
-       $(DVIPS) -o $@ $<
+       %AM_V_DVIPS%TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+       $(DVIPS) %TEXIQUIET% -o $@ $<
 endif %?LOCAL-TEXIS%
 
 .PHONY: dvi dvi-am html html-am info info-am pdf pdf-am ps ps-am
index 62529a6..3ed0cab 100644 (file)
@@ -583,6 +583,7 @@ silent4.test \
 silent5.test \
 silent6.test \
 silent7.test \
+silent8.test \
 sinclude.test \
 srcsub.test \
 srcsub2.test \
index 570b76d..c4914c8 100644 (file)
@@ -817,6 +817,7 @@ silent4.test \
 silent5.test \
 silent6.test \
 silent7.test \
+silent8.test \
 sinclude.test \
 srcsub.test \
 srcsub2.test \
diff --git a/tests/silent8.test b/tests/silent8.test
new file mode 100755 (executable)
index 0000000..88f0821
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/sh
+# Copyright (C) 2009  Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check texinfo rules in silent-rules mode.
+
+. ./defs
+
+set -e
+
+cat >>configure.in <<'EOF'
+AM_SILENT_RULES
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+info_TEXINFOS = foo.texi
+EOF
+
+cat > foo.texi <<'EOF'
+\input texinfo
+@c %**start of header
+@setfilename foo.info
+@settitle foo manual
+@c %**end of header
+@bye
+EOF
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure --disable-silent-rules
+
+# Make sure that all labels work in silent-mode
+$MAKE V=0 dvi html info ps pdf >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'DVIPS    foo.ps' stdout || Exit 1
+grep 'MAKEINFO foo.html' stdout || Exit 1
+grep 'MAKEINFO foo.info' stdout || Exit 1
+grep 'TEXI2DVI foo.dvi' stdout || Exit 1
+grep 'TEXI2PDF foo.pdf' stdout || Exit 1
+
+# Now make sure the labels don't appear in verbose mode.
+$MAKE clean || Exit 1
+$MAKE V=1 dvi html info ps pdf >stdout || { cat stdout; Exit 1; }
+grep 'DVIPS    foo.ps' stdout && Exit 1
+grep 'MAKEINFO foo.html' stdout && Exit 1
+grep 'MAKEINFO foo.info' stdout && Exit 1
+grep 'TEXI2DVI foo.dvi' stdout && Exit 1
+grep 'TEXI2PDF foo.pdf' stdout && Exit 1
+
+: