automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [FYI] [ng] cleanup: remove two almost-unused global vars:


From: Stefano Lattarini
Subject: [Automake-NG] [FYI] [ng] cleanup: remove two almost-unused global vars: {am, in}_file_name
Date: Mon, 30 Jul 2012 20:52:39 +0200

* 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 <address@hidden>
---
 automake.in | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/automake.in b/automake.in
index f8e5c9b..b746b8a 100644
--- a/automake.in
+++ b/automake.in
@@ -497,11 +497,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;
 
 # Relative path to the top directory.
@@ -620,10 +617,7 @@ sub initialize_per_input ()
 {
     reset_local_duplicates ();
 
-    $am_file_name = undef;
     $am_relative_dir = undef;
-
-    $in_file_name = undef;
     $relative_dir = undef;
     $topsrcdir = undef;
 
@@ -5624,9 +5618,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 
())
@@ -5634,8 +5628,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;
 
@@ -6810,11 +6804,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,
@@ -6826,7 +6815,7 @@ sub generate_makefile ($$)
   $am_relative_dir = dirname ($makefile_am);
   $topsrcdir = backname ($relative_dir);
 
-  read_main_am_file ($makefile_am);
+  read_main_am_file ($makefile_am, $makefile_in);
   if (handle_options)
     {
       # Process buffered warnings.
-- 
1.7.12.rc0




reply via email to

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