]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
texinfo: don't clutter the builddir when using modern texi2dvi
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 1 Apr 2012 19:55:09 +0000 (21:55 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 4 Apr 2012 09:13:22 +0000 (11:13 +0200)
In modern versions of texi2dvi (at least since version 1.135, which
comes with Texinfo 4.13) the '-o' option does not imply anymore the
'--clean' option.  As a consequence, lots of TeX-generated auxiliary
files are now left in the build directory by the 'pdf', 'ps' and
'dvi' rules.

This is especially annoying with non-recursive setups having the
'.texi' files in a subdirectory, as in:

  info_TEXINFOS = doc/foo.texi

In this case, the stray auxiliary files are left in the top build
directory (since TeX is run from there).  See for example:

 <http://lists.gnu.org/archive/html/bug-bison/2012-04/msg00002.html>

See also automake bug#11146.

* lib/am/texibuild.am: Call 'texi2dvi' and 'texi2pdf' with the
'--clean' option.  Update comments accordingly.
* tests/txinfo-noclutter.test: New test.
* tests/txinfo18.test: Remove as obsolete, the still relevant parts
of it moved into the new test.
* tests/list-of-tests.mk: Adjust.
* NEWS: Update.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NEWS
lib/am/texibuild.am
tests/list-of-tests.mk
tests/txinfo-no-clutter.test [new file with mode: 0755]
tests/txinfo18.test [deleted file]

diff --git a/NEWS b/NEWS
index 0a38d1d1d9aef5db26dcf1f4d055d17c7fe32b60..3e54207c7ac84d50c2506bd60b2b3b7972552169 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -181,6 +181,11 @@ New in 1.11a:
 
   - The 'dist' and 'dist-all' targets now can run compressors in parallel.
 
+  - The rules to create pdf, dvi and ps output from Texinfo files now
+    works better with modern 'texi2dvi' script, by explicitly passing
+    it the '--clean' option to ensure stray auxiliary files are not
+    left to clutter the build directory.
+
   - Automake can now generate silenced rules for texinfo outputs.
 
   - Some auxiliary files that are automatically distributed by Automake
index 40f01e45a2abd66f4b22d79eb64fd424fc56fbcf..f77748a3e46d081a75359a38d1817885b5085ad8 100644 (file)
@@ -68,8 +68,11 @@ INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
 ## Do not use '-o' unless necessary: it is only supported since Texinfo 4.1.
 ## 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%
+## Use '--clean' to avoid leaving auxiliary files behind cluttering the build
+## directory (see automake bug#11146).  We should start using '--tidy' when we
+## can assume Texinf 4.9 or later.
+?GENERIC?      $(TEXI2DVI) %TEXIQUIET% --clean %SOURCE% %TEXIDEVNULL%
+?!GENERIC?     $(TEXI2DVI) %TEXIQUIET% --clean -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% %TEXIDEVNULL%
 
 ?GENERIC?%SOURCE_SUFFIX%.pdf:
 ?!GENERIC?%DEST_PREFIX%.pdf: %SOURCE% %DEPS% %DIRSTAMP%
@@ -80,8 +83,11 @@ INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
 ## Do not use '-o' unless necessary: it is only supported since Texinfo 4.1.
 ## 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%
+## Use '--clean' to avoid leaving auxiliary files behind cluttering the build
+## directory (see automake bug#11146).  We should start using '--tidy' when we
+## can assume Texinf 4.9 or later.
+?GENERIC?      $(TEXI2PDF) %TEXIQUIET% --clean %SOURCE% %TEXIDEVNULL%
+?!GENERIC?     $(TEXI2PDF) %TEXIQUIET% --clean -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% %TEXIDEVNULL%
 
 ?GENERIC?%SOURCE_SUFFIX%.html:
 ?!GENERIC?%DEST_PREFIX%.html: %SOURCE% %DEPS% %DIRSTAMP%
index de022a2d324ec9845338bbe4e52b514c118b4625..9dd45ab4fe05bc5bfcd75acae1a40cc90a505070 100644 (file)
@@ -1164,7 +1164,6 @@ txinfo10.test \
 txinfo13.test \
 txinfo16.test \
 txinfo17.test \
-txinfo18.test \
 txinfo19.test \
 txinfo20.test \
 txinfo21.test \
@@ -1180,6 +1179,7 @@ txinfo30.test \
 txinfo31.test \
 txinfo32.test \
 txinfo33.test \
+txinfo-no-clutter.test \
 txinfo-unrecognized-extension.test \
 transform.test \
 transform2.test \
diff --git a/tests/txinfo-no-clutter.test b/tests/txinfo-no-clutter.test
new file mode 100755 (executable)
index 0000000..ae5e9f2
--- /dev/null
@@ -0,0 +1,102 @@
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# The pdf, ps and dvi targets shouldn't let clutter in the build directory.
+# Related to automake bug#11146.
+
+required='makeinfo tex texi2dvi-o dvips'
+. ./defs || Exit 1
+
+mkdir sub
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am << 'END'
+all-local: ps pdf dvi html
+info_TEXINFOS = foo.texi sub/bar.texi
+END
+
+cat > foo.texi << 'END'
+\input texinfo
+@setfilename foo.info
+@settitle foo
+@node Top
+Hello walls.
+@include version.texi
+@bye
+END
+
+cat > sub/bar.texi << 'END'
+\input texinfo
+@setfilename bar.info
+@settitle bar
+@node Top
+Hello walls.
+@include version2.texi
+@bye
+END
+
+cat > baz.texi << 'END'
+\input texinfo
+@setfilename baz.info
+@settitle baz
+@node Top
+Hello walls.
+@bye
+END
+
+cat > baz.texi << 'END'
+\input texinfo
+@setfilename baz.info
+@settitle baz
+@defindex au
+@defindex sa
+@defindex sb
+@synindex sa sb
+@node Top
+Hello walls.
+@cindex foo
+foo
+@pindex bar
+bar
+@auindex baz
+baz
+@saindex sa
+sa
+@sbindex sb
+sb
+@bye
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure
+
+# Try one by one, to ensure later targets don't involuntarily
+# clean up potential cruft left by earlier ones.
+for fmt in info pdf ps dvi html all; do
+  $MAKE $fmt
+  ls -l . sub # For debugging.
+  ls -d foo* baz* sub/bar* > lst
+  $EGREP -v '^(foo|sub/bar|baz)\.(texi|dvi|ps|pdf|html|info)$' lst && Exit 1
+  $MAKE clean
+done
+
+$MAKE distcheck
+
+:
diff --git a/tests/txinfo18.test b/tests/txinfo18.test
deleted file mode 100755 (executable)
index 22b096b..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2002-2012 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/>.
-
-# Make sure we clean index files, even if they are not used at the top-level.
-# Only *new* indexes need to be declared at the top-level.
-# PR/375.
-
-required='makeinfo tex texi2dvi'
-. ./defs || Exit 1
-
-cat >> configure.ac << 'END'
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-info_TEXINFOS = main.texi
-main_TEXINFOS = sub.texi
-END
-
-cat > main.texi << 'END'
-\input texinfo
-@setfilename main.info
-@settitle main
-@defindex au
-@defindex sa
-@defindex sb
-@synindex sa sb
-@node Top
-Hello walls.
-@include sub.texi
-@bye
-END
-
-cat > sub.texi << 'END'
-@cindex foo
-foo
-@pindex bar
-bar
-@auindex baz
-baz
-@saindex sa
-sa
-@sbindex sb
-sb
-END
-
-$ACLOCAL
-$AUTOMAKE --add-missing
-$AUTOCONF
-
-./configure
-
-$MAKE dvi
-ls -l           # For debugging.
-test -f main.sa # Sanity check.
-$MAKE clean
-ls -l           # For debugging.
-test x"`echo main.*`" = x"main.texi"
-
-TAR_OPTIONS= $MAKE distcheck
-
-: