From e6e90c5ff42d8eca9daff3fbda798c16a685d442 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Fri, 23 Mar 2001 16:40:13 +0000 Subject: [PATCH] * automake.in (&rule_define): Extract from... (&read_am_file): here. --- ChangeLog | 6 ++++ automake.in | 88 ++++++++++++++++++++++++++++++----------------------- 2 files changed, 56 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b1fea63..01fde17f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-03-23 Akim Demaille + + * automake.in (&rule_define): Extract from... + (&read_am_file): here. + + 2001-03-23 Akim Demaille * automake.in (¯o_define, &read_am_file): More work for the diff --git a/automake.in b/automake.in index c7362d61..4ee88a18 100755 --- a/automake.in +++ b/automake.in @@ -6243,6 +6243,53 @@ sub define_program_variable } +################################################################ + +## ---------------- ## +## Handling rules. ## +## ---------------- ## + +sub rule_define ($$$$) +{ + my ($target, $rule_is_am, $cond_string, $where) = @_; + + if (defined $targets{$target} + && ($cond_string + ? ! defined $target_conditional{$target} + : defined $target_conditional{$target})) + { + &am_line_error ($target, + "$target defined both conditionally and unconditionally"); + } + + # Value here doesn't matter; for targets we only note existence. + $targets{$target} = $where; + if ($cond_string) + { + if ($target_conditional{$target}) + { + &check_ambiguous_conditional ($target, $cond_string); + } + ${$target_conditional{$target}}{$cond_string} = $where; + } + + + # Check the rule for being a suffix rule. If so, store in a hash. + my $source_suffix; + my $object_suffix; + + if (($source_suffix, $object_suffix) = ($1 =~ $SUFFIX_RULE_PATTERN)) + { + $suffix_rules{$source_suffix} = $object_suffix; + print "Sources ending in .$source_suffix become .$object_suffix\n" + if $verbose; + $source_suffix_pattern = "(" . join ('|', keys %suffix_rules) . ")"; + } + + # FIXME: make sure both suffixes are in SUFFIXES? Or set SUFFIXES from + # suffix_rules? +} + ################################################################ # Read Makefile.am and set up %contents. Simultaneously copy lines @@ -6393,50 +6440,15 @@ sub read_am_file { # Found a rule. $was_rule = 1; - if (defined $targets{$1} - && (@conditional_stack - ? ! defined $target_conditional{$1} - : defined $target_conditional{$1})) - { - &am_line_error ($1, - "$1 defined both conditionally and unconditionally"); - } - # Value here doesn't matter; for targets we only note - # existence. - $targets{$1} = 1; - if (@conditional_stack) - { - my $cond_string = conditional_string (@conditional_stack); - if ($target_conditional{$1}) - { - &check_ambiguous_conditional ($1, $cond_string); - } - ${$target_conditional{$1}}{$cond_string} = '1'; - } + + rule_define ($1, 0, conditional_string (@conditional_stack), $.); + $content_lines{$1} = $.; $output_trailer .= $comment . $spacing; $output_trailer .= &make_condition (@conditional_stack); $output_trailer .= $_; $comment = $spacing = ''; $saw_bk = /\\$/; - - # Check the rule for being a suffix rule. If so, store in - # a hash. - - my $source_suffix; - my $object_suffix; - - if (($source_suffix, $object_suffix) - = ($1 =~ $SUFFIX_RULE_PATTERN)) - { - $suffix_rules{$source_suffix} = $object_suffix; - print "Sources ending in .$source_suffix become .$object_suffix\n" - if $verbose; - $source_suffix_pattern = "(" . join ('|', keys %suffix_rules) . ")"; - } - - # FIXME: make sure both suffixes are in SUFFIXES? Or set - # SUFFIXES from suffix_rules? } elsif (($is_ok_macro = /$MACRO_PATTERN/o) || /$BOGUS_MACRO_PATTERN/o) -- 2.43.5