Tom Tromey <[EMAIL PROTECTED]> writes:

> Akim> -clean: clean-recursive
> Akim> +clean: clean-recursive clean-recursive
> 
> This seems wrong.

Ooops.  Thanks.

> Note that the clean-am rules are run from the clean-recursive rules in
> subdirs.am.  That happens so that we can force the ordering, and it is
> important.  This is true for the ordinary (all, install, etc)
> -recursive rules in subdirs.am as well.

!!!

Do we have specific tests?  Are the rules written down somewhere?
Can't we imagine having some higher level construct specifying the
constraints over the ordering instead of relying on the order in which
things are processed?

So instead of the patch validated here, but buggy, I apply the patch
below.

I have a question: sometimes I see `&defined_variable ('SUBDIRS')',
and sometimes $recursive_install, and I couldn't determine the
relationship between the two.  Aren't they the same?

------------------------------------------------------------

Index: ChangeLog
from  Akim Demaille  <[EMAIL PROTECTED]>
        * subdirs.am: This file is the exception: clean recursive targets
        are called by the clean targets, not the clean-am targets.
        Otherwise we have a circular dependency: clean -> clean-am ->
        clean-recursive -> clean.
        * automake.in (handle_clean): Don't declare -recursive
        dependencies of the clean targets: `subdirs.am' did it.
        Less hard coded knowledge, transfered into...
        * clean.am: here.

Index: Makefile.in
===================================================================
RCS file: /cvs/automake/automake/Makefile.in,v
retrieving revision 1.251
diff -u -u -r1.251 Makefile.in
--- Makefile.in 2001/02/06 09:09:36 1.251
+++ Makefile.in 2001/02/06 10:04:12
@@ -574,25 +574,22 @@
        -rm -f Makefile.in
 clean: clean-recursive
 
-clean-am: clean-generic clean-recursive mostlyclean-am
+clean-am: clean-generic mostlyclean-am
 
 distclean: distclean-recursive
        -rm -f config.status
 
-distclean-am: clean-am distclean-generic distclean-recursive \
-       distclean-tags
+distclean-am: clean-am distclean-generic distclean-tags
 
 maintainer-clean: maintainer-clean-recursive
        -rm -f config.status
 
 maintainer-clean-am: distclean-am maintainer-clean-aminfo \
-       maintainer-clean-generic maintainer-clean-recursive \
-       maintainer-clean-vti
+       maintainer-clean-generic maintainer-clean-vti
 
 mostlyclean: mostlyclean-recursive
 
-mostlyclean-am: mostlyclean-aminfo mostlyclean-generic \
-       mostlyclean-recursive mostlyclean-vti
+mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti
 
 .PHONY: all all-am all-recursive all-redirect check check-am \
        check-recursive clean clean-generic clean-recursive distclean \
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.862
diff -u -u -r1.862 automake.in
--- automake.in 2001/02/06 09:22:15 1.862
+++ automake.in 2001/02/06 10:05:26
@@ -3910,18 +3910,21 @@
                   . 's,\@MFILES\@,' . join (' ', @maintainer_clean_files)
                   . ',;');
     }
+    if ($recursive_install)
+    {
+       $xform .= 's/^NSUBDIRS.*$//;';
+    }
+    else
+    {
+       $xform .= 's/^NSUBDIRS//;';
+    }
 
     $output_rules .= &file_contents ('clean', $xform);
-    &depend ('clean-am', 'mostlyclean-am');
-    &depend ('distclean-am', 'clean-am');
-    &depend ('maintainer-clean-am', 'distclean-am');
 
     foreach ('clean', 'distclean', 'mostlyclean', 'maintainer-clean')
       {
-       &depend ($_, $_ . '-local')
-         if &target_defined ($_ . '-local');
-       &depend ($_,
-                $_ . ($recursive_install ? '-recursive' : '-am'));
+       &depend ($_, "$_-local")
+         if &target_defined ("$_-local");
       }
 
     # We special-case config.status here.  If we do it as part of the
Index: clean.am
===================================================================
RCS file: /cvs/automake/automake/clean.am,v
retrieving revision 1.34
diff -u -u -r1.34 clean.am
--- clean.am 2001/02/06 09:09:36 1.34
+++ clean.am 2001/02/06 10:05:31
@@ -23,17 +23,17 @@
 mostlyclean-generic:
 MOSTLYCLEAN    -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
-clean-am: clean-generic
+clean-am: clean-generic mostlyclean-am
 clean-generic:
 CLEAN  -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
-distclean-am: distclean-generic
+distclean-am: distclean-generic clean-am
 distclean-generic:
        -rm -f Makefile $(CONFIG_CLEAN_FILES)
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
 DISTCLEAN      -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
-maintainer-clean-am: maintainer-clean-generic
+maintainer-clean-am: maintainer-clean-generic distclean-am
 maintainer-clean-generic:
 ## FIXME: shouldn't we really print these messages before running
 ## the dependencies?
@@ -44,3 +44,8 @@
 
 .PHONY: clean mostlyclean distclean maintainer-clean \
 clean-generic mostlyclean-generic distclean-generic maintainer-clean-generic
+
+NSUBDIRSclean: clean-am
+NSUBDIRSdistclean: distclean-am
+NSUBDIRSmostlyclean: mostlyclean-am
+NSUBDIRSmaintainer-clean: maintainer-clean-am
Index: subdirs.am
===================================================================
RCS file: /cvs/automake/automake/subdirs.am,v
retrieving revision 1.47
diff -u -u -r1.47 subdirs.am
--- subdirs.am 2001/02/06 09:09:36 1.47
+++ subdirs.am 2001/02/06 10:05:44
@@ -52,10 +52,10 @@
        fi; test -z "$$fail"
 
 
-mostlyclean-am: mostlyclean-recursive
-clean-am: clean-recursive
-distclean-am: distclean-recursive
-maintainer-clean-am: maintainer-clean-recursive
+mostlyclean: mostlyclean-recursive
+clean: clean-recursive
+distclean: distclean-recursive
+maintainer-clean: maintainer-clean-recursive
 
 .PHONY: mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive

Reply via email to