Do not remove texinfo outputs upon mostlyclean.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 7 Apr 2009 20:54:28 +0000 (22:54 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 7 Apr 2009 20:59:02 +0000 (22:59 +0200)
* lib/am/texinfos.am: New substitutions %MOSTLYCLEAN%,
%MAINTCLEAN%.
(clean-aminfo): New target, remove %TEXICLEAN% if nonemtpy,
declare phony.  Hook this target to ...
(clean-am): ... this and ...
(?CYGNUS?clean-info): ... this.
(maintainer-clean-aminfo): Remove %MAINTCLEAN% if nonempty,
for later.
(mostlyclean-aminfo): Remove %MOSTLYCLEAN%.
* automake.in (handle_texinfo_helper): Return three arrays
$MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN, instead of one array.
Only put LaTeX helper files in $MOSTLYCLEAN, the rest in
$TEXICLEAN for now.
(handle_texinfo): Accept these, chop off extra newline, and
substitute them in `texinfos.am'.
* NEWS: Update.
* tests/txinfo33.test: New test.
* tests/Makefile.am: Update.
Report by Bruno Haible.

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

index 4671ddf..e574108 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2009-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Do not remove texinfo outputs upon mostlyclean.
+       * lib/am/texinfos.am: New substitutions %MOSTLYCLEAN%,
+       %MAINTCLEAN%.
+       (clean-aminfo): New target, remove %TEXICLEAN% if nonemtpy,
+       declare phony.  Hook this target to ...
+       (clean-am): ... this and ...
+       (?CYGNUS?clean-info): ... this.
+       (maintainer-clean-aminfo): Remove %MAINTCLEAN% if nonempty,
+       for later.
+       (mostlyclean-aminfo): Remove %MOSTLYCLEAN%.
+       * automake.in (handle_texinfo_helper): Return three arrays
+       $MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN, instead of one array.
+       Only put LaTeX helper files in $MOSTLYCLEAN, the rest in
+       $TEXICLEAN for now.
+       (handle_texinfo): Accept these, chop off extra newline, and
+       substitute them in `texinfos.am'.
+       * NEWS: Update.
+       * tests/txinfo33.test: New test.
+       * tests/Makefile.am: Update.
+       Report by Bruno Haible.
+
 2009-04-06  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        testsuite: unset TESTS, TEST_LOGS, to avoid interference.
diff --git a/NEWS b/NEWS
index 1f88963..962a93a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,13 @@ New in 1.10c:
 
     to the rules.
 
+Bugs fixed in 1.10c:
+
+* Long standing bugs:
+
+  - Texinfo dvi, ps, pdf, and html output files are not removed upon
+    `make mostlyclean' any more; only the LaTeX by-products are.
+
 \f
 New in 1.10b:
 
index 0460a44..1be3e18 100755 (executable)
@@ -3224,7 +3224,7 @@ sub output_texinfo_build_rules ($$$@)
 }
 
 
-# $TEXICLEANS
+# ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN)
 # handle_texinfo_helper ($info_texinfos)
 # --------------------------------------
 # Handle all Texinfo source; helper for handle_texinfo.
@@ -3234,7 +3234,7 @@ sub handle_texinfo_helper ($)
   my (@infobase, @info_deps_list, @texi_deps);
   my %versions;
   my $done = 0;
-  my @texi_cleans;
+  my (@mostly_cleans, @texi_cleans, @maint_cleans) = ('', '', '');
 
   # Build a regex matching user-cleaned files.
   my $d = var 'DISTCLEANFILES';
@@ -3265,7 +3265,7 @@ sub handle_texinfo_helper ($)
       my ($out_file, $vtexi, @clean_files) =
        scan_texinfo_file ("$relative_dir/$texi")
        or next;
-      push (@texi_cleans, @clean_files);
+      push (@mostly_cleans, @clean_files);
 
       # If the Texinfo source is in a subdirectory, create the
       # resulting info in this subdirectory.  If it is in the current
@@ -3508,7 +3508,9 @@ sub handle_texinfo_helper ($)
        }
     }
 
-  return makefile_wrap ("", "\t  ", @texi_cleans);
+  return (makefile_wrap ("", "\t  ", @mostly_cleans),
+         makefile_wrap ("", "\t  ", @texi_cleans),
+         makefile_wrap ("", "\t  ", @maint_cleans));
 }
 
 
@@ -3522,14 +3524,20 @@ sub handle_texinfo ()
   reject_var 'html_TEXINFOS', "HTML generation not yet supported";
 
   my $info_texinfos = var ('info_TEXINFOS');
-  my $texiclean = "";
+  my ($mostlyclean, $clean, $maintclean) = ('', '', '');
   if ($info_texinfos)
     {
-      $texiclean = handle_texinfo_helper ($info_texinfos);
+      ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos);
+      chomp $mostlyclean;
+      chomp $clean;
+      chomp $maintclean;
     }
+
   $output_rules .=  file_contents ('texinfos',
                                   new Automake::Location,
-                                  TEXICLEAN     => $texiclean,
+                                  MOSTLYCLEAN   => $mostlyclean,
+                                  TEXICLEAN     => $clean,
+                                  MAINTCLEAN    => $maintclean,
                                   'LOCAL-TEXIS' => !!$info_texinfos);
 }
 
index fcfa1be..8495fd1 100644 (file)
@@ -415,8 +415,11 @@ mostlyclean-aminfo:
          automake.fn automake.fns automake.ky automake.kys \
          automake.log automake.op automake.pg automake.pgs \
          automake.tmp automake.toc automake.tp automake.tps \
-         automake.tr automake.vr automake.vrs automake.dvi \
-         automake.pdf automake.ps automake.html
+         automake.tr automake.vr automake.vrs
+
+clean-aminfo:
+       -test -z "automake.dvi automake.pdf automake.ps automake.html" \
+       || rm -rf automake.dvi automake.pdf automake.ps automake.html
 
 maintainer-clean-aminfo:
        @list='$(INFO_DEPS)'; for i in $$list; do \
@@ -612,7 +615,7 @@ maintainer-clean-generic:
        -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
 clean: clean-am
 
-clean-am: clean-generic mostlyclean-am
+clean-am: clean-aminfo clean-generic mostlyclean-am
 
 distclean: distclean-am
        -rm -f Makefile
@@ -759,21 +762,21 @@ uninstall-man: uninstall-man1
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-       ctags dist-info distclean distclean-generic distclean-tags \
-       distdir dvi dvi-am html html-am info info-am install \
-       install-am install-data install-data-am install-dist_docDATA \
-       install-dvi install-dvi-am install-exec install-exec-am \
-       install-html install-html-am install-info install-info-am \
-       install-man install-man1 install-pdf install-pdf-am install-ps \
-       install-ps-am install-strip installcheck installcheck-am \
-       installdirs maintainer-clean maintainer-clean-aminfo \
-       maintainer-clean-generic maintainer-clean-vti mostlyclean \
-       mostlyclean-aminfo mostlyclean-generic mostlyclean-vti pdf \
-       pdf-am ps ps-am tags uninstall uninstall-am \
-       uninstall-dist_docDATA uninstall-dvi-am uninstall-html-am \
-       uninstall-info-am uninstall-man uninstall-man1 \
-       uninstall-pdf-am uninstall-ps-am
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-aminfo \
+       clean-generic ctags dist-info distclean distclean-generic \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am \
+       install-dist_docDATA install-dvi install-dvi-am install-exec \
+       install-exec-am install-html install-html-am install-info \
+       install-info-am install-man install-man1 install-pdf \
+       install-pdf-am install-ps install-ps-am install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-aminfo maintainer-clean-generic \
+       maintainer-clean-vti mostlyclean mostlyclean-aminfo \
+       mostlyclean-generic mostlyclean-vti pdf pdf-am ps ps-am tags \
+       uninstall uninstall-am uninstall-dist_docDATA uninstall-dvi-am \
+       uninstall-html-am uninstall-info-am uninstall-man \
+       uninstall-man1 uninstall-pdf-am uninstall-ps-am
 
 $(dist_man1_MANS): $(top_srcdir)/configure.ac
 $(srcdir)/aclocal.1 $(srcdir)/automake.1:
index e9a8483..5dda4ab 100644 (file)
@@ -385,9 +385,16 @@ if %?LOCAL-TEXIS%
 .PHONY mostlyclean-am: mostlyclean-aminfo
 .PHONY: mostlyclean-aminfo
 mostlyclean-aminfo:
-## Use `-rf', not just `-f', because %TEXICLEAN% also contains
-## any directory created by `makeinfo --html'.
-       -rm -rf %TEXICLEAN%
+## Use `-rf', not just `-f', because the %*CLEAN% substitutions can also
+## contain any directory created by `makeinfo --html'.
+       -rm -rf %MOSTLYCLEAN%
+
+.PHONY clean-am: clean-aminfo
+clean-aminfo:
+## Use `-rf', not just `-f', because the %*CLEAN% substitutions can also
+## contain any directory created by `makeinfo --html'.
+?TEXICLEAN?    -test -z "%TEXICLEAN%" \
+?TEXICLEAN?    || rm -rf %TEXICLEAN%
 
 .PHONY maintainer-clean-am: maintainer-clean-aminfo
 maintainer-clean-aminfo:
@@ -397,7 +404,11 @@ maintainer-clean-aminfo:
          echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
          rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
        done
+## Use `-rf', not just `-f', because the %*CLEAN% substitutions can also
+## contain any directory created by `makeinfo --html'.
+?MAINTCLEAN?   -test -z "%MAINTCLEAN%" \
+?MAINTCLEAN?   || rm -rf %MAINTCLEAN%
 
 ?CYGNUS?.PHONY: clean-info
-?CYGNUS?clean-info: mostlyclean-aminfo
+?CYGNUS?clean-info: mostlyclean-aminfo clean-aminfo
 endif %?LOCAL-TEXIS%
index b0e1bf6..b0bb273 100644 (file)
@@ -684,6 +684,7 @@ txinfo29.test \
 txinfo30.test \
 txinfo31.test \
 txinfo32.test \
+txinfo33.test \
 transform.test \
 transform2.test \
 unused.test \
index d1813dd..e3c9206 100644 (file)
@@ -916,6 +916,7 @@ txinfo29.test \
 txinfo30.test \
 txinfo31.test \
 txinfo32.test \
+txinfo33.test \
 transform.test \
 transform2.test \
 unused.test \
diff --git a/tests/txinfo33.test b/tests/txinfo33.test
new file mode 100755 (executable)
index 0000000..38adb1e
--- /dev/null
@@ -0,0 +1,128 @@
+#! /bin/sh
+# Copyright (C) 2003, 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 3, 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/>.
+
+# DVIS, PDFS, PSS, HTMLS should not be cleaned upon `mostlyclean'.
+# Similar to txinfo25.test.
+
+required='makeinfo tex texi2dvi-o dvips'
+. ./defs || Exit 1
+
+set -e
+
+mkdir sub
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+info_TEXINFOS = main.texi other.texi sub/another.texi
+END
+
+cat > main.texi << 'END'
+\input texinfo
+@setfilename main.info
+@settitle main
+@node Top
+Hello walls.
+@include version.texi
+@bye
+END
+
+cat > other.texi << 'END'
+\input texinfo
+@setfilename other.info
+@settitle other
+@node Top
+Hello walls.
+@include version2.texi
+@bye
+END
+
+cat > sub/another.texi << 'END'
+\input texinfo
+@setfilename another.info
+@settitle another
+@node Top
+Hello walls.
+@include version3.texi
+@bye
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+# In-tree build.
+./configure
+$MAKE dvi ps pdf html
+
+test -f main.dvi
+test -f main.ps
+test -f main.html || test -d main.html
+test -f main.pdf
+test -f other.pdf
+test -f sub/another.pdf
+
+test -f other.dvi
+test -f other.html || test -d other.html
+test -f other.ps
+test -f sub/another.dvi
+test -f sub/another.html || test -d sub/another.html
+test -f sub/another.ps
+
+$MAKE mostlyclean
+
+ls *.aux && Exit 1
+ls sub/*.aux && Exit 1
+
+test -f main.dvi
+test -f main.ps
+test -f main.html || test -d main.html
+test -f main.pdf
+test -f other.pdf
+test -f sub/another.pdf
+
+test -f other.dvi
+test -f other.html || test -d other.html
+test -f other.ps
+test -f sub/another.dvi
+test -f sub/another.html || test -d sub/another.html
+test -f sub/another.ps
+
+$MAKE clean
+
+test ! -f main.dvi
+test ! -f main.ps
+test ! -f main.html && test ! -d main.html
+test ! -f main.pdf
+test ! -f other.pdf
+test ! -f sub/another.pdf
+test ! -f sub/yetanother.pdf
+
+test ! -f other.dvi
+test ! -f other.html && test ! -d other.html
+test ! -f other.ps
+test ! -f sub/another.dvi
+test ! -f sub/another.html && test ! -d sub/another.html
+test ! -f sub/another.ps
+
+./configure
+$MAKE
+
+$MAKE distcheck
+
+: