summaryrefslogtreecommitdiff
path: root/include/makeinclude/recurse.bor
blob: 77c878e6ab7529336d665a4c99859ea42ce9ae38 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#
# Macros for recursive invocations of make
#
# Inputs: 
# ~~~~~~~ 
# DIRS - list of sub-directories to invoke make in
# MAKEFILES - list of makefiles to be run
#

!include <$(ACE_ROOT)\include\makeinclude\make_flags.bor>

!ifdef DIRS

all: $(DIRS)

# We use an extra level of make recursion to ensure the current directory is
# automatically restored when the sub-directory is finished.
$(DIRS):
	@echo Entering directory $<
	@$(MAKE) $(MAKE_FLAGS) -f&&!
all:
	@cd $<
	$(MAKE) $(MAKE_FLAGS) -fMakefile.bor
!

# This ugliness is to remove extra spaces from between the items in the list.
DIRS_CLEAN_1 = $(DIRS) $(BLANK_SPACE)
DIRS_CLEAN_2 = $(DIRS_CLEAN_1: =%)
DIRS_CLEAN_3 = $(DIRS_CLEAN_2:%%=%)
DIRS_CLEAN_4 = $(DIRS_CLEAN_3:%%=%)
DIRS_CLEAN = $(DIRS_CLEAN_4:%=.Clean )

clean: $(DIRS_CLEAN)

# We use an extra level of make recursion to ensure the current directory is
# automatically restored when the sub-directory is finished.
$(DIRS_CLEAN):
	@echo Cleaning directory $(<:.Clean=)
	@$(MAKE) $(MAKE_FLAGS) -f&&!
all:
	@cd $(<:.Clean=)
	$(MAKE) $(MAKE_FLAGS) -fMakefile.bor clean
!

!endif

!ifdef MAKEFILES

# This ugliness is to remove extra spaces from between the items in the list.
MAKEFILES_ALL_1 = $(MAKEFILES) $(BLANK_SPACE)
MAKEFILES_ALL_2 = $(MAKEFILES_ALL_1: =%)
MAKEFILES_ALL_3 = $(MAKEFILES_ALL_2:%%=%)
MAKEFILES_ALL_4 = $(MAKEFILES_ALL_3:%%=%)
MAKEFILES_ALL = $(MAKEFILES_ALL_4:%=.All )

all: $(MAKEFILES_ALL)

$(MAKEFILES_ALL):
	$(MAKE) $(MAKE_FLAGS) -f$(<:.All=)

# This ugliness is to remove extra spaces from between the items in the list.
MAKEFILES_CLEAN_1 = $(MAKEFILES) $(BLANK_SPACE)
MAKEFILES_CLEAN_2 = $(MAKEFILES_CLEAN_1: =%)
MAKEFILES_CLEAN_3 = $(MAKEFILES_CLEAN_2:%%=%)
MAKEFILES_CLEAN_4 = $(MAKEFILES_CLEAN_3:%%=%)
MAKEFILES_CLEAN = $(MAKEFILES_CLEAN_4:%=.Clean )

clean: $(MAKEFILES_CLEAN)

$(MAKEFILES_CLEAN):
	$(MAKE) $(MAKE_FLAGS) -f$(<:.Clean=) clean

!endif