Index: ChangeLog
from Akim Demaille <[EMAIL PROTECTED]>
* automake.in (&variable_define, &read_am_file): More work for the
former from the latter. Reorganize the latter.
Index: automake.in
--- automake.in Thu, 08 Mar 2001 22:47:46 +0100 akim (am/f/39_automake.i 1.128 755)
+++ automake.in Thu, 08 Mar 2001 22:55:30 +0100 akim (am/f/39_automake.i 1.128 755)
@@ -5615,6 +5615,15 @@ sub variable_define ($$$$$$)
{
my ($var, $var_is_am, $type, $cond_string, $value, $where) = @_;
+ if (defined $contents{$1}
+ && ($cond_string
+ ? ! defined $conditional{$1}
+ : defined $conditional{$1}))
+ {
+ &am_line_error ($1,
+ "$1 defined both conditionally and unconditionally");
+ }
+
if (! defined $contents{$var})
{
# The first assignment to a macro sets the line
@@ -5670,6 +5679,11 @@ sub variable_define ($$$$$$)
${$conditional{$var}}{$cond_string} = $value;
}
}
+
+ # FIXME: I don't understand what's so special wrt `:', nor
+ # why we forget the `+' nature of a var.
+ $def_type{$var} = ($type eq ':') ? ':' : '';
+ push (@var_list, $var);
}
@@ -6427,18 +6441,15 @@ sub read_am_file
elsif (($is_ok_macro = /$MACRO_PATTERN/o)
|| /$BOGUS_MACRO_PATTERN/o)
{
+ # Error if bogus.
+ &am_line_error ($., "bad macro name `$last_var_name'")
+ if ! $is_ok_macro;
+
# Found a macro definition.
$was_rule = 0;
$last_var_name = $1;
- if (defined $contents{$1}
- && (@conditional_stack
- ? ! defined $conditional{$1}
- : defined $conditional{$1}))
- {
- &am_line_error ($1,
- "$1 defined both conditionally and unconditionally");
- }
- my $value;
+ my $type = $2;
+ my $value = $3;
if ($3 ne '' && substr ($3, -1) eq "\\")
{
# We preserve the `\' because otherwise the long lines
@@ -6446,11 +6457,6 @@ sub read_am_file
# `sed's.
$value = $3 . "\n";
}
- else
- {
- $value = $3;
- }
- my $type = $2;
variable_define ($last_var_name, 0, $type,
conditional_string (@conditional_stack),
@@ -6460,14 +6466,9 @@ sub read_am_file
# all comments for a given variable, no matter where
# defined.
$am_vars{$last_var_name} = $comment . $spacing;
- $def_type{$last_var_name} = ($type eq ':') ? ':' : '';
- push (@var_list, $last_var_name);
+
$comment = $spacing = '';
$saw_bk = /\\$/;
-
- # Error if bogus.
- &am_line_error ($., "bad macro name `$last_var_name'")
- if ! $is_ok_macro;
}
elsif (/$INCLUDE_PATTERN/o)
{