2001-01-31 Akim Demaille <akim@epita.fr>
- * automake.in: maintainer-check fixes.
+ * automake.in (%factored_dependencies): New.
+ (file_contents): Use it.
+ (handle_phony): Rename as...
+ (handle_factored_dependencies): this.
+ * subdirs.am: No need for convolved syntax to declare .PHONY.
+
+2001-01-31 Akim Demaille <akim@epita.fr>
+ * automake.in: maintainer-check fixes.
2001-01-31 Akim Demaille <akim@epita.fr>
# in the top-level Makefile.in.
%configure_dist_common = ();
+# Holds the dependencies of target which dependencies are factored.
+# Typically, `.PHONY' will appear in plenty of *.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 Makefile: keeping related stuff altogether.
+%dependencies =
+(
+ ".PHONY" => []
+);
\f
# Initialize global constants and our list of languages that are
&handle_merge_targets ($output);
&handle_installdirs;
&handle_clean;
- &handle_phony;
+ &handle_factored_dependencies;
&check_typos;
}
# Handle .PHONY target.
-sub handle_phony
+sub handle_factored_dependencies
{
- &pretty_print_rule ('.PHONY:', "", sort @phony);
- $output_rules .= "\n";
+ # FIXME: @PHONY must die!
+ push (@{${dependencies{".PHONY"}}}, @phony);
+
+ my ($category);
+ foreach $category (sort keys %dependencies)
+ {
+ &pretty_print_rule ("$category:", "",
+ sort @{${dependencies{$category}}});
+ $output_rules .= "\n";
+ }
}
# Stick comments before the incoming macro or rule.
$comment = $_;
}
- elsif (/^\.PHONY: (.*)$/mso)
+ elsif (/$RULE_PATTERN/mso && !/\t/ && /^([^:]+): ([^:]+)$/som)
{
- # Having a special case for PHONY upstream seems much easier than
- # trying to have it fit in RULE_PATTERN and extract it later.
- push (@phony, split (/\s/, $1));
+ # Pure dependencies: take some Dude, it's good stuff!
+ my ($dependers, $dependees) = ($1, $2);
+ $dependers =~ s/\\\n//somg;
+ $dependees =~ s/\\\n//somg;
+ foreach (split (/\s/ , $dependers))
+ {
+ if (defined $dependencies{$_})
+ {
+ print STDERR "Pushing $dependees into $_\n";
+ push (@{$dependencies{$_}}, split (/\s/, $dependees));
+ }
+ else
+ {
+ # Free lance dependency.
+ $result_rules .= "$comment$separator$1: $2\n"
+ unless defined $contents{$1};
+ $comment = $separator = '';
+ }
+ }
}
elsif (/$RULE_PATTERN/mso)
{
# (2) otherwise, pass the desired values on the `make' command line.
-.PHONY: all-recursive install-data-recursive install-exec-recursive
-.PHONY: installdirs-recursive install-recursive uninstall-recursive
-.PHONY: @INSTALLINFO@ check-recursive installcheck-recursive info-recursive
-.PHONY: dvi-recursive
+.PHONY: all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive @INSTALLINFO@ \
+check-recursive installcheck-recursive info-recursive dvi-recursive
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive @INSTALLINFO@ \
# (2) otherwise, pass the desired values on the `make' command line.
-.PHONY: all-recursive install-data-recursive install-exec-recursive
-.PHONY: installdirs-recursive install-recursive uninstall-recursive
-.PHONY: @INSTALLINFO@ check-recursive installcheck-recursive info-recursive
-.PHONY: dvi-recursive
+.PHONY: all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive @INSTALLINFO@ \
+check-recursive installcheck-recursive info-recursive dvi-recursive
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive @INSTALLINFO@ \