]> sourceware.org Git - automake.git/commitdiff
* automake.in (&scan_texinfo_file): Also compute the list of files
authorAkim Demaille <akim@epita.fr>
Mon, 26 Feb 2001 09:48:03 +0000 (09:48 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 26 Feb 2001 09:48:03 +0000 (09:48 +0000)
to clean.
Handle local errors.
(&handle_texinfo): Use it.

ChangeLog
Makefile.in
automake.in

index f4d2255d3029111159d76b1ad96ed90461158bdb..44e93acb8622974e69ec4be8eea5918d66e7cae2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-02-26  Akim Demaille  <akim@epita.fr>
+
+       * automake.in (&scan_texinfo_file): Also compute the list of files
+       to clean.
+       Handle local errors.
+       (&handle_texinfo): Use it.
+
+       
 2001-02-26  Akim Demaille  <akim@epita.fr>
 
        * automake.in: Don't pass arguments to...
index ad3843fc9996120036f2895017abd7aef7999553..3f12b6480fbc200a8035a9630375386cd242df54 100644 (file)
@@ -274,11 +274,10 @@ dist-info: $(INFO_DEPS)
        done
 
 mostlyclean-aminfo:
-       -rm -f automake.aux automake.cp automake.cps automake.dvi automake.fn \
-         automake.fns automake.pgs automake.ky automake.kys \
-         automake.ps automake.log automake.pg automake.toc automake.tp \
-         automake.tps automake.vr automake.vrs automake.op automake.tr \
-         automake.cv automake.cn automake.cm automake.ov
+       -rm -f automake.aux automake.cm automake.cp automake.cps automake.cv \
+         automake.dvi automake.fn automake.ky automake.log automake.op \
+         automake.ov automake.pg automake.ps automake.toc automake.tp \
+         automake.tr automake.vr automake.vrs
 
 maintainer-clean-aminfo:
        cd $(srcdir) && \
index 7b3d5b75ce58f967eed8151e75b5821114c15c40..18430b27e56ebbc482d59420ea907aa8af178648 100755 (executable)
@@ -2157,13 +2157,19 @@ sub handle_scripts
     }
 }
 
-# Search a file for a "version.texi" Texinfo include.  Return the name
-# of the include file if found, or the empty string if not.  A
-# "version.texi" file is actually any file whose name matches
-# "vers*.texi".
+
+# ($OUTFILE, $VFILE, @CLEAN_FILES)
+# &scan_texinfo_file ($FILENAME)
+# ------------------------------
+# $OUTFILE is the name of the info file produced by $FILENAME.
+# $VFILE is the name of the version.texi file used (empty if none).
+# @CLEAN_FILES is the list of by products (indexes etc.)
 sub scan_texinfo_file
 {
     my ($filename) = @_;
+    my @clean_suffixes = ('aux', 'dvi', 'log', 'ps', 'toc',
+                         # grep new.*index texinfo.tex
+                         'cp', 'fn', 'ky', 'vr', 'tp', 'pg');
 
     my $texi = new IO::File ("< $filename");
     if (! $texi)
@@ -2176,22 +2182,44 @@ sub scan_texinfo_file
     my ($outfile, $vfile);
     while ($_ = $texi->getline)
     {
-       if (/^\@setfilename +(\S+)/)
-       {
-           $outfile = $1;
-           last if ($vfile);
-       }
-
-       if (/^\@include\s+(vers[^.]*\.texi)\s*$/)
-       {
-           # Found version.texi include.
-           $vfile = $1;
-           last if $outfile;
-       }
+      if (/^\@setfilename +(\S+)/)
+      {
+        $outfile = $1;
+        if ($outfile =~ /\.(.+)$/ && $1 ne 'info')
+          {
+            &am_file_error ($filename, "$.: ",
+                            "output \`$outfile' has unrecognized extension");
+            return;
+          }
+      }
+      # A "version.texi" file is actually any file whose name
+      # matches "vers*.texi".
+      elsif (/^\@include\s+(vers[^.]*\.texi)\s*$/)
+      {
+        $vfile = $1;
+      }
+      elsif (/^\@defcodeindex (\w*)/)
+      {
+        push @clean_suffixes, $1;
+      }
+      elsif (/^\@syncodeindex \w+ (\w*)/)
+      {
+        push @clean_suffixes, "$1s";
+      }
     }
-
     $texi->close;
-    return ($outfile, $vfile);
+
+    if ($outfile eq '')
+      {
+       &am_error ("\`$filename' missing \@setfilename");
+       return;
+      }
+
+    my $infobase = basename ($filename);
+    $infobase =~ s/\.te?xi(nfo)?$//;
+    my %clean_files;
+    grep { $clean_files{"$infobase.$_"} = 1 } @clean_suffixes;
+    return ($outfile, $vfile, (sort keys %clean_files));
 }
 
 
@@ -2237,21 +2265,10 @@ sub handle_texinfo
 
        # If 'version.texi' is referenced by input file, then include
        # automatic versioning capability.
-       my ($out_file, $vtexi) = &scan_texinfo_file ($relative_dir
-                                                    . "/" . $info_cursor);
-
-       if ($out_file eq '')
-       {
-           &am_error ("\`$info_cursor' missing \@setfilename");
-           next;
-       }
-
-       if ($out_file =~ /\.(.+)$/ && $1 ne 'info')
-       {
-           # FIXME should report line number in input file.
-           &am_error ("output of \`$info_cursor', \`$out_file', has unrecognized extension");
-           next;
-       }
+       my ($out_file, $vtexi, @clean_files) =
+         &scan_texinfo_file ("$relative_dir/$info_cursor")
+           or next;
+       push (@texi_cleans, @clean_files);
 
        if ($vtexi)
        {
@@ -2312,19 +2329,6 @@ sub handle_texinfo
 
        push (@info_deps_list, $out_file);
        push (@dvis_list, $infobase . '.dvi');
-
-       # Generate list of things to clean for this target.  We do
-       # this explicitly because otherwise too many things could be
-       # removed.  In particular the ".log" extension might
-       # reasonably be used in other contexts by the user.
-       # FIXME: this is really out of control.
-       foreach my $tc_cursor ('aux', 'cp', 'cps', 'dvi', 'fn', 'fns', 'pgs',
-                              'ky', 'kys', 'ps', 'log', 'pg', 'toc', 'tp',
-                              'tps', 'vr', 'vrs', 'op', 'tr', 'cv', 'cn',
-                              'cm', 'ov')
-       {
-           push (@texi_cleans, $infobase . '.' . $tc_cursor);
-       }
     }
 
     # Find these programs wherever they may lie.  Yes, this has
This page took 0.051631 seconds and 5 git commands to generate.