summaryrefslogtreecommitdiff
path: root/lib/am/subdirs.am
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>1997-04-30 01:30:40 +0000
committerTom Tromey <tromey@redhat.com>1997-04-30 01:30:40 +0000
commit447031fe12d5cd5edead99215d21ce9828fb0d7a (patch)
tree43bc737121a7c0b209e135d1637de3f43c9be717 /lib/am/subdirs.am
parentaffd1ba9198b57c4931f34f4ffdc5f26b2b0630e (diff)
downloadautomake-447031fe12d5cd5edead99215d21ce9828fb0d7a.tar.gz
run clean subdirs in reverse order
Diffstat (limited to 'lib/am/subdirs.am')
-rw-r--r--lib/am/subdirs.am22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/am/subdirs.am b/lib/am/subdirs.am
index 5b7571de3..0622e8dda 100644
--- a/lib/am/subdirs.am
+++ b/lib/am/subdirs.am
@@ -1,5 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+## Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -26,10 +26,26 @@
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive @INSTALLINFO@ \
-check-recursive installcheck-recursive info-recursive dvi-recursive \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+ @for subdir in $(SUBDIRS); do \
+ target=`echo $@ | sed s/-recursive//`; \
+ echo "Making $$target in $$subdir"; \
+ (cd $$subdir && $(MAKE) $$target) \
+## This trick allows "-k" to keep its natural meaning when running a
+## recursive rule.
+ || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+
+## We run all `clean' targets in reverse order. Why? It's an attempt
+## to alleviate a problem that can happen when dependencies are
+## enabled. In this case, the .P file in one directory can depend on
+## some automatically generated header in an earlier directory. Since
+## the dependencies are required before any target is examined, make
+## bombs.
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
- @for subdir in $(SUBDIRS); do \
+ @rev=''; for subdir in $(SUBDIRS); do rev="$$rev $$subdir"; done; \
+ for subdir in $$rev; do \
target=`echo $@ | sed s/-recursive//`; \
echo "Making $$target in $$subdir"; \
(cd $$subdir && $(MAKE) $$target) \