From: Stefano Lattarini Date: Thu, 10 May 2012 08:24:55 +0000 (+0200) Subject: [ng] rules: can pass deps to &Automake::Rule::define X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=245be387d3eefe5d1b39577ded1aa9d2345f4cff;p=thirdparty%2Fautomake.git [ng] rules: can pass deps to &Automake::Rule::define This change is only useful in view of future changes. * lib/Automake/Rule.pm (define): Add parameter '$deps' (still unused). Adjust comments and POD documentation. * automake.in (file_contents_internal, read_am_file) [/$RULE_PATTERN/]: Also pass the list of dependencies to the 'Automake::Rule::define' invocation. Signed-off-by: Stefano Lattarini --- diff --git a/automake.in b/automake.in index a47aedc00..69925c816 100644 --- a/automake.in +++ b/automake.in @@ -6526,11 +6526,15 @@ sub read_am_file ($$) { # Found a rule. $prev_state = IN_RULE_DEF; + my $targ = $1; + (my $deps = $2) =~ s/^\s*//; # For now we have to output all definitions of user rules # and can't diagnose duplicates (see the comment in - # Automake::Rule::define). So we go on and ignore the return value. - Automake::Rule::define ($1, $amfile, RULE_USER, $cond, $where); + # Automake::Rule::define). So we go on and ignore the return + # value. + Automake::Rule::define ($targ, $amfile, RULE_USER, $cond, + $where, $deps); $output_trailer .= $comment . $spacing; my $cond = new Automake::Condition @cond_stack; @@ -7009,7 +7013,7 @@ sub file_contents_internal ($$$%) my @undefined_conds = Automake::Rule::define ($targets, $file, $is_am ? RULE_AUTOMAKE : RULE_USER, - $cond, $where); + $cond, $where, "@deps"); for my $undefined_cond (@undefined_conds) { my $condparagraph = $paragraph; diff --git a/lib/Automake/Rule.pm b/lib/Automake/Rule.pm index 27df7ebb6..ed44a6522 100644 --- a/lib/Automake/Rule.pm +++ b/lib/Automake/Rule.pm @@ -744,22 +744,24 @@ sub _conditionals_for_rule ($$$$) return @conds; } -=item C<@conds = define ($rulename, $source, $owner, $cond, $where)> +=item C<@conds = define ($rulename, $source, $owner, $cond, $where, [$deps])> Define a new rule. C<$rulename> is the list of targets. C<$source> is the filename the rule comes from. C<$owner> is the owner of the rule (C or C). C<$cond> is the C under which the rule is defined. C<$where> is -the C where the rule is defined. +the C where the rule is defined. C<$deps> is a +withespace-separated list of dependencies (currently unused). Returns a (possibly empty) list of Cs where the rule's definition should be output. =cut -sub define ($$$$$) +sub define ($$$$$;$) { - my ($target, $source, $owner, $cond, $where) = @_; + my ($target, $source, $owner, $cond, $where, $deps) = @_; + $deps = '' unless defined $deps; prog_error "$where is not a reference" unless ref $where; @@ -772,9 +774,9 @@ sub define ($$$$$) my $tdef = _rule_defn_with_exeext_awareness ($target, $cond, $where); # See whether this is a duplicated target declaration. - # Ignore '%'-style pattern rules. We'd need the dependencies to detect - # duplicates, and would be overkill anyway, worth the possibility of - # annoying false positives. + # Ignore '%'-style pattern rules. We'd need to scan the dependencies + # to detect duplicates, and doing so would be overkill anyway, not + # worth the possibility of annoying false positives. if ($tdef && $target !~ /%/) { # Diagnose invalid target redefinitions, if any. Note that some