summaryrefslogtreecommitdiff
path: root/include/makeinclude/recurse.bor
blob: 8ef992d43e901395dbf58412dcff2a081b0bb519 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#
# Macros for recursive invocations of make
#
# Inputs: 
# ~~~~~~~ 
# DIRS - list of sub-directories to invoke make in
# MAKEFILES - list of makefiles to be run
# NAMES - list of names of targets to be built
#

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

# We want to avoid all of this recursion if this is a multi-target sub-make.
!ifndef TARGET_NAME
# This is not a multi-target sub-make ...

!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) -$(MAKEFLAGS) $(MAKE_FLAGS) -f&&!
all:
	@cd $<
	$(MAKE) -$(MAKEFLAGS) $(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) -$(MAKEFLAGS) $(MAKE_FLAGS) -f&&!
all:
	@cd $(<:.Clean=)
	$(MAKE) -$(MAKEFLAGS) $(MAKE_FLAGS) -fMakefile.bor clean
!

# This ugliness is to remove extra spaces from between the items in the list.
DIRS_REALCLEAN_1 = $(DIRS) $(BLANK_SPACE)
DIRS_REALCLEAN_2 = $(DIRS_REALCLEAN_1: =%)
DIRS_REALCLEAN_3 = $(DIRS_REALCLEAN_2:%%=%)
DIRS_REALCLEAN_4 = $(DIRS_REALCLEAN_3:%%=%)
DIRS_REALCLEAN = $(DIRS_REALCLEAN_4:%=.RealClean )

realclean: $(DIRS_REALCLEAN)

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

# This ugliness is to remove extra spaces from between the items in the list.
DIRS_INSTALL_1 = $(DIRS) $(BLANK_SPACE)
DIRS_INSTALL_2 = $(DIRS_INSTALL_1: =%)
DIRS_INSTALL_3 = $(DIRS_INSTALL_2:%%=%)
DIRS_INSTALL_4 = $(DIRS_INSTALL_3:%%=%)
DIRS_INSTALL = $(DIRS_INSTALL_4:%=.Install )

install: $(DIRS_INSTALL)

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

!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) -$(MAKEFLAGS) $(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) -$(MAKEFLAGS) $(MAKE_FLAGS) -f$(<:.Clean=) clean

# This ugliness is to remove extra spaces from between the items in the list.
MAKEFILES_REALCLEAN_1 = $(MAKEFILES) $(BLANK_SPACE)
MAKEFILES_REALCLEAN_2 = $(MAKEFILES_REALCLEAN_1: =%)
MAKEFILES_REALCLEAN_3 = $(MAKEFILES_REALCLEAN_2:%%=%)
MAKEFILES_REALCLEAN_4 = $(MAKEFILES_REALCLEAN_3:%%=%)
MAKEFILES_REALCLEAN = $(MAKEFILES_REALCLEAN_4:%=.RealClean )

realclean: $(MAKEFILES_REALCLEAN)

$(MAKEFILES_REALCLEAN):
	$(MAKE) -$(MAKEFLAGS) $(MAKE_FLAGS) -f$(<:.RealClean=) realclean

# This ugliness is to remove extra spaces from between the items in the list.
MAKEFILES_INSTALL_1 = $(MAKEFILES) $(BLANK_SPACE)
MAKEFILES_INSTALL_2 = $(MAKEFILES_INSTALL_1: =%)
MAKEFILES_INSTALL_3 = $(MAKEFILES_INSTALL_2:%%=%)
MAKEFILES_INSTALL_4 = $(MAKEFILES_INSTALL_3:%%=%)
MAKEFILES_INSTALL = $(MAKEFILES_INSTALL_4:%=.Install )

install: $(MAKEFILES_INSTALL)

$(MAKEFILES_INSTALL):
       $(MAKE) -$(MAKEFLAGS) $(MAKE_FLAGS) -f$(<:.Install=) install

!endif

!ifdef NAMES

# This macro may be defined in the environment (e.g. the nightly build
# scripts) so we need to remove it.
!undef NAME

# Multi-target recursion assumes Makefile.bor. For multiple targets in
# makefiles with other names, you must set the MAKEFILE variable to the
# name of the file.
!ifndef MAKEFILE
MAKEFILE = Makefile.bor
!endif

# This ugliness is to remove extra spaces from between the items in the list.
NAMES_ALL_1 = $(NAMES) $(BLANK_SPACE)
NAMES_ALL_2 = $(NAMES_ALL_1: =%)
NAMES_ALL_3 = $(NAMES_ALL_2:%%=%)
NAMES_ALL_4 = $(NAMES_ALL_3:%%=%)
NAMES_ALL = $(NAMES_ALL_4:%=.All )

all: $(NAMES_ALL)

$(NAMES_ALL):
	$(MAKE) -$(MAKEFLAGS) $(MAKE_FLAGS) -f$(MAKEFILE) -DTARGET_NAME=$(<:.All=)

# This ugliness is to remove extra spaces from between the items in the list.
NAMES_CLEAN_1 = $(NAMES) $(BLANK_SPACE)
NAMES_CLEAN_2 = $(NAMES_CLEAN_1: =%)
NAMES_CLEAN_3 = $(NAMES_CLEAN_2:%%=%)
NAMES_CLEAN_4 = $(NAMES_CLEAN_3:%%=%)
NAMES_CLEAN = $(NAMES_CLEAN_4:%=.Clean )

clean: $(NAMES_CLEAN)

$(NAMES_CLEAN):
	$(MAKE) -$(MAKEFLAGS) $(MAKE_FLAGS) -f$(MAKEFILE) -DTARGET_NAME=$(<:.Clean=) clean

# This ugliness is to remove extra spaces from between the items in the list.
NAMES_REALCLEAN_1 = $(NAMES) $(BLANK_SPACE)
NAMES_REALCLEAN_2 = $(NAMES_REALCLEAN_1: =%)
NAMES_REALCLEAN_3 = $(NAMES_REALCLEAN_2:%%=%)
NAMES_REALCLEAN_4 = $(NAMES_REALCLEAN_3:%%=%)
NAMES_REALCLEAN = $(NAMES_REALCLEAN_4:%=.RealClean )

realclean: $(NAMES_REALCLEAN)

$(NAMES_REALCLEAN):
	$(MAKE) -$(MAKEFLAGS) $(MAKE_FLAGS) -f$(MAKEFILE) -DTARGET_NAME=$(<:.RealClean=) realclean

# This ugliness is to remove extra spaces from between the items in the list.
NAMES_INSTALL_1 = $(NAMES) $(BLANK_SPACE)
NAMES_INSTALL_2 = $(NAMES_INSTALL_1: =%)
NAMES_INSTALL_3 = $(NAMES_INSTALL_2:%%=%)
NAMES_INSTALL_4 = $(NAMES_INSTALL_3:%%=%)
NAMES_INSTALL = $(NAMES_INSTALL_4:%=.Install )

install: $(NAMES_INSTALL)

$(NAMES_INSTALL):
       $(MAKE) -$(MAKEFLAGS) $(MAKE_FLAGS) -f$(MAKEFILE) -DTARGET_NAME=$(<:.Install=) install

!endif

!else
# This is a multi-target sub-make ...

# Set the name of the current target.
NAME = $(TARGET_NAME)

!endif