]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] rules: can pass deps to &Automake::Rule::define
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 10 May 2012 08:24:55 +0000 (10:24 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 10 May 2012 11:18:12 +0000 (13:18 +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 <stefano.lattarini@gmail.com>
automake.in
lib/Automake/Rule.pm

index a47aedc007466594031a73aec5be633e0ecb58f7..69925c816d4cab8d81038b8477c9ed24e9ef462b 100644 (file)
@@ -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;
index 27df7ebb6ed34d179898a3acd559ef564d258606..ed44a6522d4e0df63e8a1a407727180501084851 100644 (file)
@@ -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