source: rtems/c/src/automake/subdirs.am @ af6168c6

5
Last change on this file since af6168c6 was b8c59353, checked in by Chris Johns <chrisj@…>, on 04/11/18 at 03:26:58

build: Fix make clean.

Update #3254.

  • Property mode set to 100644
File size: 2.2 KB
Line 
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
12SUBDIRS_dot                            = $(filter     .,$(_SUBDIRS))
13SUBDIRS_no_dot                         = $(filter-out .,$(_SUBDIRS))
14SUBDIRS_no_dot_no_wrapup               = $(filter-out wrapup,$(SUBDIRS_no_dot))
15SUBDIRS_no_dot_no_testsuites           = $(filter-out testsuites,$(SUBDIRS_no_dot))
16SUBDIRS_no_dot_no_wrapup_no_testsuites = $(filter-out testsuites,$(SUBDIRS_no_dot_no_wrapup))
17SUBDIRS_wrapup                         = $(filter     wrapup,$(SUBDIRS_no_dot))
18SUBDIRS_testsuites                     = $(filter     testsuites,$(SUBDIRS_no_dot))
19
20define CPUKITDIR
21.PHONY: $1
22$1:
23        @+set fnord $(MAKEFLAGS); amf=$$$$2; \
24        subdir=$(2); \
25        target=`echo $(MAKECMDGOALS) | sed s/-recursive//`; \
26        if test "$$$$target" = "all-local-am"; then \
27          target="all-am"; \
28        fi; \
29        if test "$$$$target" = "all-local"; then \
30          target="all"; \
31        fi; \
32        echo "Making $$$$target in $$$$subdir"; \
33        if test "$$$$subdir" != "."; then \
34          cd $$$$subdir; \
35          $(MAKE) $(AM_MAKEFLAGS) $$$$target; \
36        fi;
37endef
38
39#
40# This GNU make syntax is being used to stop automake thinking the code is for
41# it.
42#
43$(if "$(SUBDIRS_dot)" ".",$(eval $(call CPUKITDIR,dot,.)))
44
45$(foreach D,$(SUBDIRS_no_dot),$(eval $(call CPUKITDIR,$(D),$(D))))
46
47#
48# If there is a wrapup make it depend on all other directories except the
49# testsuite so it is not entered until everything but the testsuite has
50# finished.
51#
52$(if "$(SUBDIRS_wrapup)" "wrapup",wrapup: dot $(SUBDIRS_no_dot_no_wrapup_no_testsuites))
53
54#
55# If there is a testsuite make it depend on all other directories so it is not
56# entered until everything else has finished.
57#
58$(if "$(SUBDIRS_testsuites)" "testsuites",testsuites: dot $(SUBDIRS_no_dot_no_testsuites))
59
60#
61# The general build all rule for automake.
62#
63all-local:   $(if "$(SUBDIRS_dot)" ".",dot) $(SUBDIRS_no_dot)
64clean-local: $(if "$(SUBDIRS_dot)" ".",dot) $(SUBDIRS_no_dot)
Note: See TracBrowser for help on using the repository browser.