From 7b9844b762a9d39b93e8924a3376805908755894 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 31 Jan 2001 14:36:21 +0000 Subject: [PATCH] * 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. --- ChangeLog | 9 ++++++++- automake.in | 49 +++++++++++++++++++++++++++++++++++++++-------- lib/am/subdirs.am | 7 +++---- subdirs.am | 7 +++---- 4 files changed, 55 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02aa701b..2b1f9a65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,14 @@ 2001-01-31 Akim Demaille - * 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 + * automake.in: maintainer-check fixes. 2001-01-31 Akim Demaille diff --git a/automake.in b/automake.in index daf311c7..d5152acf 100755 --- a/automake.in +++ b/automake.in @@ -325,6 +325,15 @@ $obsolete_rx = '(\b' . join ('\b|\b', keys %obsolete_macros) . '\b)'; # 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" => [] +); # Initialize global constants and our list of languages that are @@ -680,7 +689,7 @@ sub generate_makefile &handle_merge_targets ($output); &handle_installdirs; &handle_clean; - &handle_phony; + &handle_factored_dependencies; &check_typos; @@ -4028,10 +4037,18 @@ sub do_one_clean_target } # 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"; + } } @@ -7053,11 +7070,27 @@ sub file_contents # 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) { diff --git a/lib/am/subdirs.am b/lib/am/subdirs.am index 54d3f0d1..12041462 100644 --- a/lib/am/subdirs.am +++ b/lib/am/subdirs.am @@ -24,10 +24,9 @@ # (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@ \ diff --git a/subdirs.am b/subdirs.am index 54d3f0d1..12041462 100644 --- a/subdirs.am +++ b/subdirs.am @@ -24,10 +24,9 @@ # (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.43.5