This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

75-simplifications.patch


Index: ChangeLog
from  Akim Demaille  <akim@epita.fr>
	* automake.in (&handle_single_transform_list): Remove $xbase,
	unused.
	(&handle_source_transform): All the variables have conditions now,
	simplify.
	(&variable_delete): Admit an argument @conds.
	(&am_install_var): When adding `$(EXEEXT)' to PROGRAMS, merge the
	`build' and `set' loops into one.

Index: automake.in
--- automake.in Thu, 15 Mar 2001 21:13:31 +0100 akim (am/f/39_automake.i 1.197 755)
+++ automake.in Thu, 15 Mar 2001 21:38:46 +0100 akim (am/f/39_automake.i 1.197 755)
@@ -1431,8 +1431,6 @@ sub handle_single_transform_list ($$$@)
         my $base = $2;
         my $extension = $3;

-        my $xbase = $base;
-
         # We must generate a rule for the object if it requires
         # its own flags.
         my $rule = '';
@@ -1522,7 +1520,6 @@ sub handle_single_transform_list ($$$@)
             if ($r == $LANG_SUBDIR && $directory ne '')
             {
                 $object = $directory . '/' . $object;
-                $xbase = $directory . '/' . $base;
             }

             # If doing dependency tracking, then we can't print
@@ -1768,7 +1763,6 @@ sub handle_source_transform
 sub handle_lib_objects
 {
     my ($xname, $var, $lex_seen) = @_;
-    my $ret;

     &prog_error ("handle_lib_objects: $var undefined")
 	if ! &variable_defined ($var);
@@ -1776,23 +1770,14 @@ sub handle_lib_objects
     &prog_error ("handle_lib_objects: lex_seen and $var =~ /LIBADD/")
 	if $lex_seen && $var =~ /LIBADD/;

-    my @conds = &variable_conditions ($var);
-    if (! @conds)
-    {
-	$ret = &handle_lib_objects_cond ($xname, $var, $lex_seen, '');
-    }
-    else
-    {
-	$ret = 0;
-	foreach my $cond (@conds)
-	{
-	    if (&handle_lib_objects_cond ($xname, $var, $lex_seen, $cond))
-	    {
-		$ret = 1;
-	    }
-	}
-    }
-
+    my $ret = 0;
+    foreach my $cond (&variable_conditions ($var))
+      {
+	if (&handle_lib_objects_cond ($xname, $var, $lex_seen, $cond))
+	  {
+	    $ret = 1;
+	  }
+      }
     return $ret;
 }

@@ -5587,18 +5572,29 @@ sub variable_define ($$$$$$)
 }


-# &variable_delete ($VAR)
-# -----------------------
-# Forget about a variable.
-sub variable_delete ($)
+# &variable_delete ($VAR, [@CONDS])
+# ---------------------------------
+# Forget about $VAR under the conditions @CONDS, or completely if
+# @CONDS is empty.
+sub variable_delete ($@)
 {
-  my ($var) = @_;
+  my ($var, @conds) = @_;

-  delete $var_value{$var};
-  delete $var_line{$var};
-  delete $var_is_am{$var};
-  delete $var_comment{$var};
-  delete $var_type{$var};
+  if (!@conds)
+    {
+      delete $var_value{$var};
+      delete $var_line{$var};
+      delete $var_is_am{$var};
+      delete $var_comment{$var};
+      delete $var_type{$var};
+    }
+  else
+    {
+      foreach my $cond (@conds)
+	{
+	  delete $var_value{$var}{$cond};
+	}
+    }
 }


@@ -7086,37 +7082,21 @@ sub am_install_var
 	    # include EXEEXT when in Cygwin32 mode.
 	    if ($primary eq 'PROGRAMS')
 	    {
-		my @conds = &variable_conditions ($one_name);
-
-		my @condvals;
-		foreach my $cond (@conds)
-		  {
-		    my @one_binlist = ();
-		    my @condval = &variable_value_as_list ($one_name,
-							   $cond);
-		    foreach my $rcurs (@condval)
-		      {
-			if ($rcurs =~ /\./ || $rcurs =~ /^\@.*\@$/)
-			  {
-			    push (@one_binlist, $rcurs);
-			  }
-			else
-			  {
-			    push (@one_binlist, $rcurs . '$(EXEEXT)');
-			  }
-		      }
-
-		    push (@condvals, $cond);
-		    push (@condvals, join (' ', @one_binlist));
-		  }
-
-		variable_delete ($one_name);
-		while (@condvals)
-		  {
-		    my $cond = shift (@condvals);
-		    my @val = split (' ', shift (@condvals));
-		    &define_pretty_variable ($one_name, $cond, @val);
-		  }
+	      foreach my $cond (&variable_conditions ($one_name))
+		{
+		  my @sources;
+		  foreach my $source (&variable_value_as_list ($one_name,
+							       $cond))
+		    {
+		      if ($source !~ /\./ && $source !~ /^\@.*\@$/)
+			{
+			  $source .= '$(EXEEXT)';
+			}
+		      push (@sources, $source);
+		    }
+		  variable_delete ($one_name, $cond);
+		  &define_pretty_variable ($one_name, $cond, @sources);
+		}
 	    }

 	    # "EXTRA" shouldn't be used when generating clean targets,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]