[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
75-2-simplifications.patch
From: |
Akim Demaille |
Subject: |
75-2-simplifications.patch |
Date: |
28 Mar 2001 09:33:00 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley) |
I withdraw this part of the patch:
Index: ChangeLog
from Akim Demaille <address@hidden>
* automake.in (&am_install_var): When adding `$(EXEEXT)' to PROGRAMS,
merge the `build' and `set' loops into one.
@@ -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 =~ /address@hidden@$/)
- {
- 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 !~ /address@hidden@$/)
+ {
+ $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,
This is yet another bug found by Robert. There was no change in the
Makefile.in, but here is what happened (doubled line are debugging
messages).
|| BEFORE
|| bin_PROGRAMS (User, where = 21) =
|| {
||
|| TRUE => hell hell.static $(BUILD_helldl)
|| }
|| -> BINARY_HELLDL_TRUE
| Makefile.am:21: bin_PROGRAMS was already defined in condition TRUE, which
implies condition BINARY_HELLDL_TRUE
| bin_PROGRAMS (User, where = 21) =
| {
|
| TRUE => hell hell.static $(BUILD_helldl)
| }
|| -> BINARY_HELLDL_FALSE
|| AFTER
|| bin_PROGRAMS (User, where = 21) =
|| {
||
|| TRUE => hell hell.static $(BUILD_helldl)
|| BINARY_HELLDL_TRUE => hell$(EXEEXT) hell.static helldl$(EXEEXT)
|| BINARY_HELLDL_FALSE =>
|| }
I had not understood this loop was in charge of expanding PROGRAMS
into its closed set of conditionals. I thought it was here just to
append EXEEXT everywhere needed (*including* in the sub variables),
but no redefine it. Since it was already defined to TRUE adding any
new definition (but under FALSE) will necessarily cause a conflict
(good to see all work properly and catch it :).
In fact, to be honest, I no longer understand very well why we perform
such a closure. I mean, as is, Automake transforms (this is
cond3.test)
| bin_PROGRAMS = targ
|
| if ONE
| SONE = one.c
| else
| SONE =
| endif
|
| if TWO
| STWO = two.c
| else
| STWO =
| endif
|
| if THREE
| STHREE = three.c
| else
| STHREE =
| endif
|
| targ_SOURCES = $(SONE) $(STWO) $(STHREE)
into
| @ONE_FALSE@@THREE_FALSE@@address@hidden = two.$(OBJEXT)
| @ONE_FALSE@@THREE_FALSE@@address@hidden =
| @ONE_FALSE@@THREE_TRUE@@address@hidden = two.$(OBJEXT) \
| @ONE_FALSE@@THREE_TRUE@@TWO_TRUE@ three.$(OBJEXT)
| @ONE_FALSE@@THREE_TRUE@@address@hidden = three.$(OBJEXT)
| @ONE_TRUE@@THREE_FALSE@@address@hidden = one.$(OBJEXT) \
| @ONE_TRUE@@THREE_FALSE@@TWO_TRUE@ two.$(OBJEXT)
| @ONE_TRUE@@THREE_FALSE@@address@hidden = one.$(OBJEXT)
| @ONE_TRUE@@THREE_TRUE@@address@hidden = one.$(OBJEXT) \
| @ONE_TRUE@@THREE_TRUE@@TWO_TRUE@ two.$(OBJEXT) three.$(OBJEXT)
| @ONE_TRUE@@THREE_TRUE@@address@hidden = one.$(OBJEXT) \
| @ONE_TRUE@@THREE_TRUE@@TWO_FALSE@ three.$(OBJEXT)
why don't we just output
| @address@hidden = one.$(OBJEXT)
| @address@hidden =
|
| @address@hidden = two.$(OBJEXT)
| @address@hidden =
|
| @address@hidden = three.$(OBJEXT)
| @address@hidden =
|
| am_targ_OBJECTS = $(am_SONE_OBJECTS) $(am_STWO_OBJECTS) $(am_STHREE_OBJECTS)
which means also, why do we look for the closure of PROGRAMS, instead
of just adding $(EXEEXT) to all its components and sub components
(i.e., inside sub vars such as $(SONE) above being a sub var of
targ_SOURCES)?
I don't think the handling of `+=' is the origin of this. Indeed we
transform
| FOO = foo
| if BAR
| FOO += BAR
| endif
into
| @address@hidden = foo bar
| @address@hidden = foo
but this seems good to me too?
| FOO = foo $(BAR_FOO)
| @address@hidden = bar
| @address@hidden =
Index: ChangeLog
from Akim Demaille <address@hidden>
* 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.
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 macro_define ($$$$$$)
}
-# &variable_delete ($VAR)
-# -----------------------
-# Forget about a variable.
-sub variable_delete ($)
+# &variable_delete ($VAR, address@hidden)
+# ---------------------------------
+# 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 (address@hidden)
+ {
+ 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};
+ }
+ }
}