2 ##################################################################
6 ##################################################################
8 # Here are the diabolically clever rules that
10 # (a) for each "recursive target" <t>
11 # propagates "make <t>" to directories in SUBDIRS
13 # (b) when SUBDIRS is empty,
14 # for each "multi-way-target" <t>
15 # calls "make way=w <t>" for each w in $(WAYS)
17 # This has the effect of making the standard target
18 # in each of the specified ways (as well as in the normal way
20 # Controlling variables
21 # WAYS = extra (beyond the normal way) ways to build things in
22 # SUBDIRS = subdirectories to recurse into
24 # No ways, so iterate over the SUBDIRS
26 # note about recursively invoking make: we'd like make to drop all the
27 # way back to the top level if it fails in any of the
28 # sub(sub-...)directories. This is done by setting the -e flag to the
29 # shell during the loop, which causes an immediate failure if any of
30 # the shell commands fail.
32 # One exception: if the user gave the -i or -k flag to make in the
33 # first place, we'd like to reverse this behaviour. So we check for
34 # these flags, and set the -e flag appropriately. NOTE: watch out for
35 # the --no-print-directory flag which is passed to recursive
36 # invocations of make.
41 # we override the 'boot', 'all' and 'install' targets in the top
42 # level Makefile. Some of the sub-projects also set 'boot' to empty.
44 ifeq "$(NO_ALL_TARGET)" "YES"
50 ifeq "$(NO_BOOT_TARGET)" "YES"
56 ifeq "$(NO_INSTALL_TARGET)" "YES"
60 INSTALL_TARGET = install
61 INSTALL_DOCS_TARGET = install-docs
64 $(ALL_TARGET) docs runtests $(BOOT_TARGET) TAGS clean distclean mostlyclean maintainer-clean $(INSTALL_TARGET) $(INSTALL_DOCS_TARGET) html chm HxS ps dvi txt::
65 @echo "------------------------------------------------------------------------"
66 @echo "== Recursively making \`$@' in $(SUBDIRS) ..."
67 @echo "PWD = $(shell pwd)"
68 @echo "------------------------------------------------------------------------"
69 # Don't rely on -e working, instead we check exit return codes from sub-makes.
70 @case '${MFLAGS}' in *-[ik]*) x_on_err=0;; *-r*[ik]*) x_on_err=0;; *) x_on_err=1;; esac; \
71 if [ $$x_on_err -eq 0 ]; \
72 then echo "Won't exit on error due to MFLAGS: ${MFLAGS}"; \
74 for i in $(SUBDIRS); do \
75 echo "------------------------------------------------------------------------"; \
76 echo "== $(MAKE) $@ $(MFLAGS);"; \
77 echo " in $(shell pwd)/$$i"; \
78 echo "------------------------------------------------------------------------"; \
79 $(MAKE) --no-print-directory -C $$i $(MFLAGS) $@; \
80 if [ $$? -eq 0 -o $$x_on_err -eq 0 ]; \
81 then echo "Finished making $@ in $$i": $$?; \
82 else echo "Failed making $@ in $$i": $$?; exit 1; \
85 @echo "------------------------------------------------------------------------"
86 @echo "== Finished making \`$@' in $(SUBDIRS) ..."
87 @echo "PWD = $(shell pwd)"
88 @echo "------------------------------------------------------------------------"
94 # Selectively building subdirectories.
99 $(MAKE) -C $@ $(MFLAGS)