cleanup: remove two almost-unused global variables: {am,in}_file_name
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 30 Jul 2012 18:30:23 +0000 (20:30 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 10 Aug 2012 09:50:56 +0000 (11:50 +0200)
Cherry picked from commit v1.12.2-739-gbf2a8b0 of Automake-NG.

* automake.in ($am_file_name, $in_file_name): Delete these, which were
used only in the 'read_main_am_file' subroutine; instead ...
(read_main_am_file): ... modify it to only work from the '$makefile_am'
argument (which it was already receiving), and the new '$makefile_in'
argument, which is now passed to it ...
(generate_makefile): ... from here.
(initialize_per_input): Don't reset the two deleted variables anymore.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
automake.in

index d85d361..1ae5470 100644 (file)
@@ -477,11 +477,8 @@ my $am_file = 'BUG';
 ## ------------------------------------------ ##
 
 # Basename and relative dir of the input file.
-my $am_file_name;
 my $am_relative_dir;
-
 # Same but wrt Makefile.in.
-my $in_file_name;
 my $relative_dir;
 
 # Greatest timestamp of the output's dependencies (excluding
@@ -632,10 +629,7 @@ sub initialize_per_input ()
 {
     reset_local_duplicates ();
 
-    $am_file_name = undef;
     $am_relative_dir = undef;
-
-    $in_file_name = undef;
     $relative_dir = undef;
 
     $output_deps_greatest_timestamp = 0;
@@ -6896,9 +6890,9 @@ sub define_standard_variables
 }
 
 # Read main am file.
-sub read_main_am_file
+sub read_main_am_file ($$)
 {
-    my ($amfile) = @_;
+    my ($amfile, $infile) = @_;
 
     # This supports the strange variable tricks we are about to play.
     prog_error ("variable defined before read_main_am_file\n" . variables_dump ())
@@ -6906,8 +6900,8 @@ sub read_main_am_file
 
     # Generate copyright header for generated Makefile.in.
     # We do discard the output of predefined variables, handled below.
-    $output_vars = ("# $in_file_name generated by automake "
-                  . $VERSION . " from $am_file_name.\n");
+    $output_vars = ("# " . basename ($infile) . " generated by automake "
+                  . $VERSION . " from " . basename ($amfile) . ".\n");
     $output_vars .= '# ' . subst ('configure_input') . "\n";
     $output_vars .= $gen_copyright;
 
@@ -8095,11 +8089,6 @@ sub generate_makefile ($$)
   # we have processed AUTOMAKE_OPTIONS.
   buffer_messages ('warning');
 
-  # Name of input file ("Makefile.am") and output file
-  # ("Makefile.in").  These have no directory components.
-  $am_file_name = basename ($makefile_am);
-  $in_file_name = basename ($makefile_in);
-
   # $OUTPUT is encoded.  If it contains a ":" then the first element
   # is the real output file, and all remaining elements are input
   # files.  We don't scan or otherwise deal with these input files,
@@ -8110,7 +8099,7 @@ sub generate_makefile ($$)
   $relative_dir = dirname ($makefile);
   $am_relative_dir = dirname ($makefile_am);
 
-  read_main_am_file ($makefile_am);
+  read_main_am_file ($makefile_am, $makefile_in);
   if (handle_options)
     {
       # Process buffered warnings.