source: rtems/cpukit/automake/subdirs.am @ a2a71b5

5
Last change on this file since a2a71b5 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: 1.6 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_wrapup           = $(filter     wrapup,$(SUBDIRS_no_dot))
16
17preinstall: $(preintstall_targets)
18
19define 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;
36endef
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
52all-local:   $(if "$(SUBDIRS_dot)" ".",dot) $(SUBDIRS_no_dot)
53clean-local: $(if "$(SUBDIRS_dot)" ".",dot) $(SUBDIRS_no_dot)
Note: See TracBrowser for help on using the repository browser.