Add a test to the unpulled patches in darcs-all
[ghc.git] / mk / sub-makefile.mk
1 # This file is included by all the "stub makefiles" in every directory
2 # in the tree except the root. Its job is to invoke $(MAKE) on the
3 # top-level Makefile, but modifying the target so that it applies to
4 # the current directory only.
5 #
6 # eg.
7 # make foo.o ==> make -C $(TOP) dir/foo.o
8 # make all ==> make -C $(TOP) all_dir
9 # make clean ==> make -C $(TOP) clean_dir
10 #
11
12 # Important, otherwise we get silly built-in rules:
13 .SUFFIXES:
14
15 TOPMAKE = $(MAKE) -C $(TOP)
16
17 default: all
18
19 fast: all
20
21 FAST_MAKE_OPTS =\
22 $(dir)_dist_NO_BUILD_DEPS=YES \
23 $(dir)_dist-boot_NO_BUILD_DEPS=YES \
24 $(dir)_dist-install_NO_BUILD_DEPS=YES \
25 OMIT_PHASE_1=YES OMIT_PHASE_2=YES OMIT_PHASE_3=YES
26
27 ifneq "$(filter fast,$(MAKECMDGOALS))" ""
28 EXTRA_MAKE_OPTS += $(FAST_MAKE_OPTS)
29 else
30 ifeq "$(FAST)" "YES"
31 EXTRA_MAKE_OPTS += $(FAST_MAKE_OPTS)
32 endif
33 endif
34
35 # We must not execute multiple recursive invocations of make in parallel.
36 .NOTPARALLEL:
37
38 STD_TARGETS = all clean distclean maintainer_clean install html ps pdf
39
40 # The + tells make that we're recursively invoking make, otherwise 'make -j2'
41 # goes wrong.
42 $(STD_TARGETS):
43 +$(TOPMAKE) $@_$(dir) $(EXTRA_MAKE_OPTS)
44
45 OTHERTARGETS=$(filter-out fast help $(STD_TARGETS) $(SPEC_TARGETS),$(MAKECMDGOALS))
46 .PHONY: $(OTHERTARGETS)
47 $(OTHERTARGETS):
48 +$(TOPMAKE) $(dir)/$@ $(EXTRA_MAKE_OPTS)
49
50 .PHONY: help
51 help : sub-help
52
53 .PHONY: sub-help
54 sub-help :
55 @echo "You are in subdirectory \"$(dir)\"."
56 @echo "Useful targets in this directory:"
57 @cat $(TOP)/SUBMAKEHELP