bug-automake
[Top][All Lists]
Advanced

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

Re: mostlyclean and texinfo outputs


From: Ralf Wildenhues
Subject: Re: mostlyclean and texinfo outputs
Date: Tue, 7 Apr 2009 23:03:02 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

> * Bruno Haible wrote on Fri, Apr 03, 2009 at 12:58:26PM CEST:
> > 
> > > > For the {dvi,ps} formats this is (arguably) a bug in automake,
> > > 
> > > I agree; automake should remove {html,dvi,ps,pdf} only upon 'clean', but
> > > not upon 'mostlyclean'.  Only the latex by-products should be removed
> > > upon 'mostlyclean'.
> > 
> > OK, this is issue #1.

The following patch fixes this first issue.  I've pushed it to the
'next' branch of git Automake.

Cheers,
Ralf

    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.

diff --git a/NEWS b/NEWS
index 1f88963..962a93a 100644
--- 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.
+
 
 New in 1.10b:
 
diff --git a/automake.in b/automake.in
index 0460a44..1be3e18 100755
--- a/automake.in
+++ b/automake.in
@@ -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);
 }
 
diff --git a/lib/am/texinfos.am b/lib/am/texinfos.am
index e9a8483..5dda4ab 100644
--- a/lib/am/texinfos.am
+++ b/lib/am/texinfos.am
@@ -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%
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b0e1bf6..b0bb273 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -684,6 +684,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
index 0000000..38adb1e
--- /dev/null
+++ b/tests/txinfo33.test
@@ -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
address@hidden main.info
address@hidden main
address@hidden Top
+Hello walls.
address@hidden version.texi
address@hidden
+END
+
+cat > other.texi << 'END'
+\input texinfo
address@hidden other.info
address@hidden other
address@hidden Top
+Hello walls.
address@hidden version2.texi
address@hidden
+END
+
+cat > sub/another.texi << 'END'
+\input texinfo
address@hidden another.info
address@hidden another
address@hidden Top
+Hello walls.
address@hidden version3.texi
address@hidden
+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
+
+:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]