1 | ## Copyright 2017 Chris Johns <chrisj@rtems.org> |
---|
2 | |
---|
3 | ## |
---|
4 | ## The following builds in parallel. The subdirectories are |
---|
5 | ## expanded into separate rules and all the targets are listed |
---|
6 | ## and make runs as many as it can. |
---|
7 | ## |
---|
8 | ## A macro is defined and evaluated once for each directory. This |
---|
9 | ## creates the instance of the rule. Use $(info ...) to print them. |
---|
10 | ## |
---|
11 | |
---|
12 | SUBDIRS_dot = $(filter .,$(_SUBDIRS)) |
---|
13 | SUBDIRS_no_dot = $(filter-out .,$(_SUBDIRS)) |
---|
14 | SUBDIRS_no_dot_no_wrapup = $(filter-out wrapup,$(SUBDIRS_no_dot)) |
---|
15 | SUBDIRS_wrapup = $(filter wrapup,$(SUBDIRS_no_dot)) |
---|
16 | |
---|
17 | preinstall: $(preintstall_targets) |
---|
18 | |
---|
19 | define CPUKITDIR |
---|
20 | .PHONY: $1 |
---|
21 | $1: $(preintstall_targets) |
---|
22 | @+set fnord $(MAKEFLAGS); amf=$$$$2; \ |
---|
23 | subdir=$(2); \ |
---|
24 | target=`echo $(MAKECMDGOALS) | sed s/-recursive//`; \ |
---|
25 | if test "$$$$target" = "all-local-am"; then \ |
---|
26 | target="all-am"; \ |
---|
27 | fi; \ |
---|
28 | if test "$$$$target" = "all-local"; then \ |
---|
29 | target="all"; \ |
---|
30 | fi; \ |
---|
31 | echo "Making $$$$target in $$$$subdir"; \ |
---|
32 | if test "$$$$subdir" != "."; then \ |
---|
33 | cd $$$$subdir; \ |
---|
34 | $(MAKE) $(AM_MAKEFLAGS) $$$$target; \ |
---|
35 | fi; |
---|
36 | endef |
---|
37 | |
---|
38 | # |
---|
39 | # This GNU make syntax is being used to stop automake thinking the code is for |
---|
40 | # it. |
---|
41 | # |
---|
42 | $(if "$(SUBDIRS_dot)" ".",$(eval $(call CPUKITDIR,dot,.))) |
---|
43 | |
---|
44 | $(foreach D,$(SUBDIRS_no_dot),$(eval $(call CPUKITDIR,$(D),$(D)))) |
---|
45 | |
---|
46 | # |
---|
47 | # If there is a wrapup make it depend on all other directories so it is not |
---|
48 | # entered until they have finished. |
---|
49 | # |
---|
50 | $(if "$(SUBDIRS_wrapup)" "wrapup",wrapup: dot $(foreach D,$(SUBDIRS_no_dot_no_wrapup),$(D)),) |
---|
51 | |
---|
52 | all-local: $(if "$(SUBDIRS_dot)" ".",dot) $(SUBDIRS_no_dot) |
---|
53 | clean-local: $(if "$(SUBDIRS_dot)" ".",dot) $(SUBDIRS_no_dot) |
---|