automake-patches
[Top][All Lists]
Advanced

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

FYI: more XFiles


From: Akim Demaille
Subject: FYI: more XFiles
Date: 26 Oct 2001 11:50:17 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * automake.in: Use &verbose.
        (&generate_makefile, &scan_texinfo_file, &scan_aclocal_m4): Use
        Automake::XFile.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1207
diff -u -u -r1.1207 automake.in
--- automake.in 2001/10/24 12:02:46 1.1207
+++ automake.in 2001/10/26 09:50:25
@@ -113,7 +113,6 @@
 use strict 'vars', 'subs';
 use Automake::General;
 use Automake::XFile;
-use IO::File;
 use File::Basename;
 use Carp;
 
@@ -1291,33 +1290,15 @@
        }
     }
 
-    my $gm_file = new IO::File "> $out_file";
-    if (! $gm_file)
-    {
-       warn "$me: ${am_file}.in: cannot write: $!\n";
-       $exit_status = 1;
-       return;
-    }
-    print "$me: creating ", $makefile, ".in\n" if $verbose;
+    my $gm_file = new Automake::XFile "> $out_file";
+    verbose "creating ", $makefile, ".in";
 
-    # In case we're running under MSWindows, don't write with CRLF
-    # (as it causes problems for the dependency-file extraction in
-    # AM_OUTPUT_DEPENDENCY_COMMANDS).
-    binmode $gm_file;
-
     print $gm_file $output_vars;
     # We make sure that `all:' is the first target.
     print $gm_file $output_all;
     print $gm_file $output_header;
     print $gm_file $output_rules;
     print $gm_file $output_trailer;
-
-    if (! $gm_file->close)
-      {
-       warn "$me: $am_file.in: cannot close: $!\n";
-       $exit_status = 1;
-       return;
-      }
 }
 
 ################################################################
@@ -2956,13 +2937,8 @@
     # is not created.
     my @syncodeindexes = ();
 
-    my $texi = new IO::File ("< $filename");
-    if (! $texi)
-      {
-       &am_error ("couldn't open `$filename': $!");
-       return '';
-    }
-    print "$me: reading $filename\n" if $verbose;
+    my $texi = new Automake::XFile "< $filename";
+    verbose "reading $filename";
 
     my ($outfile, $vfile);
     while ($_ = $texi->getline)
@@ -3011,7 +2987,6 @@
       }
 
     }
-    $texi->close;
 
     if ($outfile eq '')
       {
@@ -3579,18 +3554,10 @@
     {
        &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4');
        &push_dist_common ('aclocal.m4');
-
-       my $aclocal = new IO::File ("< aclocal.m4");
-       if ($aclocal)
-       {
-           my $line = $aclocal->getline;
-           $aclocal->close;
 
-           if ($line =~ 'generated automatically by aclocal')
-           {
-               $regen_aclocal = 1;
-           }
-       }
+       my $aclocal = new Automake::XFile "< aclocal.m4";
+       my $line = $aclocal->getline;
+       $regen_aclocal = $line =~ 'generated automatically by aclocal';
     }
 
     my @ac_deps = ();
@@ -4614,7 +4581,7 @@
       );
 
     my $configfh = new Automake::XFile ("< $filename");
-    print "$me: reading $filename\n" if $verbose;
+    verbose "reading $filename";
 
     my ($in_ac_output, $in_ac_replace) = (0, 0);
     while ($_ = $configfh->getline)
@@ -4904,8 +4871,6 @@
            $configure_vars{'FLIBS'} = $here;
        }
     }
-
-    $configfh->close;
 }
 
 
@@ -6670,8 +6635,7 @@
   if ((my ($source_suffix, $object_suffix)) = ($target =~ 
$SUFFIX_RULE_PATTERN))
   {
       $suffix_rules{$source_suffix} = $object_suffix;
-      print "Sources ending in .$source_suffix become .$object_suffix\n"
-         if $verbose;
+      verbose "Sources ending in .$source_suffix become .$object_suffix";
       # Set SUFFIXES from suffix_rules.
       push @suffixes, ".$source_suffix", ".$object_suffix";
   }
@@ -7052,10 +7016,9 @@
          . 's/\n{3,}/\n\n/g';
 
     # Swallow the file and apply the COMMAND.
-    my $fc_file = new Automake::XFile ("< $file");
+    my $fc_file = new Automake::XFile "< $file";
     # Looks stupid?
-    print "$me: reading $file\n"
-      if $verbose;
+    verbose "reading $file";
     my $saved_dollar_slash = $/;
     undef $/;
     $_ = $fc_file->getline;
@@ -7976,6 +7939,7 @@
 # Ensure a file exists.
 sub create
 {
+    use IO::File;
     my ($file) = @_;
 
     my $touch = new IO::File (">> $file");



reply via email to

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