[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [PATCH 2/4] [ng] rules: can pass deps to &Automake::Rule::
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [PATCH 2/4] [ng] rules: can pass deps to &Automake::Rule::define |
Date: |
Thu, 10 May 2012 14:29:48 +0200 |
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 <address@hidden>
---
automake.in | 10 +++++++---
lib/Automake/Rule.pm | 16 +++++++++-------
2 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/automake.in b/automake.in
index a47aedc..69925c8 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 27df7eb..ed44a65 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<RULE_AUTOMAKE> or C<RULE_USER>). C<$cond> is the
C<Automake::Condition> under which the rule is defined. C<$where> is
-the C<Automake::Location> where the rule is defined.
+the C<Automake::Location> where the rule is defined. C<$deps> is a
+withespace-separated list of dependencies (currently unused).
Returns a (possibly empty) list of C<Automake::Condition>s 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
--
1.7.9.5
- [Automake-NG] [PATCH 0/4] Prefer pattern rules over suffix rules, Stefano Lattarini, 2012/05/10
- [Automake-NG] [PATCH 1/4] [ng] am: prefer pattern rules over old-fashioned suffix rules, Stefano Lattarini, 2012/05/10
- [Automake-NG] [PATCH 2/4] [ng] rules: can pass deps to &Automake::Rule::define,
Stefano Lattarini <=
- [Automake-NG] [PATCH 4/4] [ng] cleanup: &Automake::Variable::hook is unused, remove it, Stefano Lattarini, 2012/05/10
- [Automake-NG] [PATCH 3/4] [ng] rules: forbid old-fashioned suffix rules, prefer pattern rules, Stefano Lattarini, 2012/05/10
- Re: [Automake-NG] [PATCH 0/4] Prefer pattern rules over suffix rules, Akim Demaille, 2012/05/10