]> sourceware.org Git - automake.git/commitdiff
* automake.in (%factored_dependencies): New.
authorAkim Demaille <akim@epita.fr>
Wed, 31 Jan 2001 14:36:21 +0000 (14:36 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 31 Jan 2001 14:36:21 +0000 (14:36 +0000)
(file_contents): Use it.
(handle_phony): Rename as...
(handle_factored_dependencies): this.
* subdirs.am: No need for convolved syntax to declare .PHONY.

ChangeLog
automake.in
lib/am/subdirs.am
subdirs.am

index 02aa701bb8fc62183b3b78797fb6941eb612aff9..2b1f9a6544709c08a775b01dee0aa1b55f9ef647 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,14 @@
 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>
 
index daf311c745c91b67fa313d053fe65b65f954b2c0..d5152acf100c066a55cb5a6a44d900fc9e7596db 100755 (executable)
@@ -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" => []
+);
 \f
 
 # 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)
        {
index 54d3f0d19ddb33d8eeb110e58c952115510254fc..12041462ebbe0c3c7ca53740e3de430c267992ef 100644 (file)
 # (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@ \
index 54d3f0d19ddb33d8eeb110e58c952115510254fc..12041462ebbe0c3c7ca53740e3de430c267992ef 100644 (file)
 # (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@ \
This page took 0.036783 seconds and 5 git commands to generate.