summaryrefslogtreecommitdiff
path: root/mk/sub-makefile.mk
blob: 989c0c91b9ab93052cdc7c0414f4414dcc8a9267 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# This file is included by all the "stub makefiles" in every directory
# in the tree except the root.  Its job is to invoke $(MAKE) on the
# top-level Makefile, but modifying the target so that it applies to
# the current directory only.
#
# eg.
#  make foo.o  ==>  make -C $(TOP) dir/foo.o
#  make all    ==>  make -C $(TOP) all_dir
#  make clean  ==>  make -C $(TOP) clean_dir
#

# Important, otherwise we get silly built-in rules:
.SUFFIXES:

TOPMAKE = $(MAKE) -C $(TOP)

default: all

fast :
	+$(TOPMAKE) all_$(dir) $(dir)_dist-install_NO_BUILD_DEPS=YES \
	   OMIT_PHASE_1=YES OMIT_PHASE_2=YES OMIT_PHASE_3=YES

# We must not execute multiple recursive invocations of make in parallel.
.NOTPARALLEL:

STD_TARGETS = all clean distclean maintainer_clean install html ps pdf

# The + tells make that we're recursively invoking make, otherwise 'make -j2'
# goes wrong.
$(STD_TARGETS): 
	+$(TOPMAKE) $@_$(dir)

OTHERTARGETS=$(filter-out fast help $(STD_TARGETS) $(SPEC_TARGETS),$(MAKECMDGOALS))
.PHONY: $(OTHERTARGETS)
$(OTHERTARGETS):
	+$(TOPMAKE) $(dir)/$@

.PHONY: help
help : sub-help

.PHONY: sub-help
sub-help :
	@echo "You are in subdirectory \"$(dir)\"."
	@echo "Useful targets in this directory:"
	@cat $(TOP)/SUBMAKEHELP