2007-11-25 Akim Demaille <akim@lrde.epita.fr>
+ Define and use register_action.
+ * lib/Automake/Rule.pm: Fix a few typos in the doc.
+ (&rule): Use || to simplify the code.
+ (®ister_action): New.
+ Export it.
+ * automake.in (&handle_factored_dependencies, &file_contents_internal):
+ Use it.
+
+2007-11-25 Akim Demaille <akim@lrde.epita.fr>
+
* bootstrap: Fix typos on redirections.
2007-11-24 Akim Demaille <akim@lrde.epita.fr>
{
if (user_phony_rule "$_-hook")
{
- $actions{"$_-am"} .=
- ("\t\@\$(NORMAL_INSTALL)\n"
- . "\t" . '$(MAKE) $(AM_MAKEFLAGS) ' . "$_-hook\n");
depend ('.MAKE', "$_-am");
+ register_action("$_-am",
+ ("\t\@\$(NORMAL_INSTALL)\n"
+ . "\t\$(MAKE) \$(AM_MAKEFLAGS) $_-hook"));
}
}
if (defined $dependencies{$_} && $cond != FALSE)
{
&depend ($_, @deps);
- if ($actions{$_})
- {
- $actions{$_} .= "\n$actions" if $actions;
- }
- else
- {
- $actions{$_} = $actions;
- }
+ register_action ($_, $actions);
}
else
{
@ISA = qw/Automake::Item Exporter/;
@EXPORT = qw (reset register_suffix_rule suffix_rules_count
suffixes rules $suffix_rules $KNOWN_EXTENSIONS_PATTERN
- depend %dependencies %actions accept_extensions
+ depend %dependencies %actions register_action
+ accept_extensions
reject_rule msg_rule msg_cond_rule err_rule err_cond_rule
rule rrule ruledef rruledef);
{
my $def = $rule->def ($cond);
if ($def)
- {
- return $def->location;
- }
+ {
+ return $def->location;
+ }
...
}
...
but is better written
- return rrule ($name)->rrule ($cond)->location;
+ return rrule ($name)->rdef ($cond)->location;
or even
Holds the dependencies of targets which dependencies are factored.
Typically, C<.PHONY> will appear in plenty of F<*.am> files, but must
be output once. Arguably all pure dependencies could be subject to
-this factorization, but it is not unpleasant to have paragraphs in
+this factoring, but it is not unpleasant to have paragraphs in
Makefile: keeping related stuff altogether.
=cut
=item C<rules>
-Returns the list of all L<Automake::Rule> instances. (I.e., all
+Return the list of all L<Automake::Rule> instances. (I.e., all
rules defined so far.)
=cut
}
+=item C<register_action($target, $action)>
+
+Append the C<$action> to C<$actions{$target}> taking care of special
+cases.
+
+=cut
+
+sub register_action ($$)
+{
+ my ($target, $action) = @_;
+ if ($actions{$target})
+ {
+ $actions{$target} .= "\n$action" if $action;
+ }
+ else
+ {
+ $actions{$target} = $action;
+ }
+}
+
+
=item C<Automake::Rule::reset>
The I<forget all> function. Clears all know rules and reset some
# Strip $(EXEEXT) from $name, so we can diagnose
# a clash if `ctags$(EXEEXT):' is redefined after `ctags:'.
$name =~ s,\$\(EXEEXT\)$,,;
- return $_rule_dict{$name} if exists $_rule_dict{$name};
- return 0;
+ return $_rule_dict{$name} || 0;
}
=item C<ruledef ($rulename, $cond)>
# msg ('syntax', $where,
# "redefinition of `$target'$condmsg...", partial => 1);
# msg_cond_rule ('syntax', $cond, $target,
- # "... `$target' previously defined here");
+ # "... `$target' previously defined here");
}
# Return so we don't redefine the rule in our tables,
# don't check for ambiguous condition, etc. The rule