]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | # |
2 | # Install kernel header files | |
3 | # | |
2d21ac55 A |
4 | ifeq ($(RC_ProjectName),Libsyscall) |
5 | installhdrs: | |
6 | bsdmake -C libsyscall installhdrs | |
7 | else # xnu | |
9bccf70c | 8 | installhdrs: exporthdrs installhdrs_mi installhdrs_md |
2d21ac55 A |
9 | @echo "[ $(SRCROOT) ] make installhdrs installing Kernel.framework" |
10 | $(_v)kincpath=$(DSTROOT)/$(KINCDIR); \ | |
91447636 | 11 | krespath=$(DSTROOT)/$(KRESDIR); \ |
1c79356b | 12 | kframepath=$(DSTROOT)/$(KINCFRAME); \ |
91447636 A |
13 | [ -d $$krespath ] || $(MKDIR) $$krespath; \ |
14 | [ -d $$kincpath ] || $(MKDIR) $$kincpath; \ | |
1c79356b | 15 | cd $(SRCROOT)/EXTERNAL_HEADERS; \ |
91447636 A |
16 | install $(FILE_INSTALL_FLAGS) Info.plist $$krespath; \ |
17 | $(SRCROOT)/config/newvers.pl $${krespath}/Info.plist; \ | |
1c79356b A |
18 | cd $$kframepath/Versions; \ |
19 | [ -L Current ] || $(LN) $(KINCVERS) Current; \ | |
20 | cd $$kframepath; \ | |
21 | [ -L Headers ] || $(LN) Versions/Current/Headers Headers; \ | |
91447636 A |
22 | [ -L Resources ] || $(LN) Versions/Current/Resources Resources; \ |
23 | [ -d $(DSTROOT)/$(KPINCDIR) ] || $(MKDIR) $(DSTROOT)/$(KPINCDIR); \ | |
0b4e3aa0 | 24 | cd $$kframepath; [ -L PrivateHeaders ] || \ |
91447636 | 25 | $(LN) Versions/Current/PrivateHeaders PrivateHeaders; |
2d21ac55 | 26 | endif |
1c79356b A |
27 | |
28 | # | |
29 | # Install header files order | |
30 | # | |
31 | .ORDER: installhdrs_mi installhdrs_md | |
32 | ||
33 | # | |
34 | # Install machine independent header files | |
35 | # | |
0b4e3aa0 | 36 | installhdrs_mi: |
2d21ac55 | 37 | $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \ |
1c79356b A |
38 | kernel_config=$(INSTALL_TYPE); \ |
39 | arch_config=$(INSTALL_ARCH_DEFAULT); \ | |
40 | installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \ | |
91447636 | 41 | [ -d $${installinc_dir} ] ||$(MKDIR) $${installinc_dir}; \ |
9bccf70c A |
42 | ${MAKE} -C $${installinc_dir} \ |
43 | KERNEL_CONFIG=$${kernel_config} \ | |
1c79356b A |
44 | ARCH_CONFIG=$${arch_config} \ |
45 | MAKEFILES=${SOURCE}/Makefile \ | |
46 | SOURCE=${SOURCE}/ \ | |
47 | TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \ | |
9bccf70c | 48 | build_installhdrs_mi; \ |
1c79356b A |
49 | |
50 | # | |
51 | # Install machine dependent kernel header files | |
52 | # | |
0b4e3aa0 | 53 | installhdrs_md: |
2d21ac55 | 54 | $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \ |
1c79356b | 55 | kernel_config=$(INSTALL_TYPE); \ |
2d21ac55 | 56 | machine_config=$(MACHINE_CONFIG); \ |
1c79356b A |
57 | for arch_config in $(INSTALL_ARCHS); \ |
58 | do \ | |
2d21ac55 A |
59 | if [ $${arch_config} = ARM ] ; then \ |
60 | if [ $${machine_config} = DEFAULT ] ; then \ | |
61 | machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \ | |
62 | fi; \ | |
63 | fi; \ | |
64 | if [ $${machine_config} = DEFAULT ] ; then \ | |
65 | objpath=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \ | |
66 | else \ | |
67 | objpath=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \ | |
68 | fi; \ | |
69 | [ -d $${objpath} ] || $(MKDIR) $${objpath}; \ | |
70 | ${MAKE} -C $${objpath} \ | |
9bccf70c | 71 | KERNEL_CONFIG=$${kernel_config} \ |
1c79356b A |
72 | ARCH_CONFIG=$${arch_config} \ |
73 | MAKEFILES=${SOURCE}/Makefile \ | |
74 | SOURCE=${SOURCE}/ \ | |
2d21ac55 | 75 | TARGET=$${objpath}/ \ |
9bccf70c | 76 | build_installhdrs_md; \ |
1c79356b A |
77 | done; |
78 | ||
79 | # | |
80 | # Install machine independent kernel header files | |
81 | # | |
82 | do_installhdrs_mi: | |
83 | ||
84 | build_installhdrs_mi:: | |
2d21ac55 A |
85 | @echo "[ $(SOURCE) ] make build_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" |
86 | $(_v)for installinc_subdir in $(INSTINC_SUBDIRS); \ | |
1c79356b | 87 | do \ |
91447636 | 88 | [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir}; \ |
9bccf70c A |
89 | ${MAKE} -C $${installinc_subdir} \ |
90 | MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \ | |
1c79356b A |
91 | SOURCE=$(SOURCE)$${installinc_subdir}/ \ |
92 | TARGET=$(TARGET)$${installinc_subdir}/ \ | |
9bccf70c | 93 | build_installhdrs_mi; \ |
1c79356b | 94 | done; \ |
9bccf70c | 95 | ${MAKE} ${MAKEJOBS} do_installhdrs_mi; |
1c79356b A |
96 | |
97 | # | |
98 | # Install machine dependent kernel header files | |
99 | # | |
100 | do_installhdrs_md: | |
101 | ||
102 | build_installhdrs_md:: | |
2d21ac55 A |
103 | @echo "[ $(SOURCE) ] make installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" |
104 | $(_v)for installinc_subdir in $($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG))); \ | |
1c79356b | 105 | do \ |
91447636 | 106 | [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir}; \ |
9bccf70c A |
107 | ${MAKE} -C $${installinc_subdir} \ |
108 | MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \ | |
1c79356b A |
109 | SOURCE=$(SOURCE)$${installinc_subdir}/ \ |
110 | TARGET=$(TARGET)$${installinc_subdir}/ \ | |
9bccf70c | 111 | build_installhdrs_md; \ |
1c79356b | 112 | done; \ |
9bccf70c | 113 | ${MAKE} ${MAKEJOBS} do_installhdrs_md; |
1c79356b A |
114 | |
115 | # | |
116 | # Install kernel header files | |
117 | # | |
9bccf70c | 118 | exporthdrs: exporthdrs_mi exporthdrs_md |
1c79356b A |
119 | |
120 | # | |
121 | # Install header files order | |
122 | # | |
123 | .ORDER: exporthdrs_mi exporthdrs_md | |
124 | ||
125 | # | |
126 | # Install machine independent header files | |
127 | # | |
128 | do_exporthdrs_mi: | |
129 | ||
0b4e3aa0 | 130 | exporthdrs_mi: |
2d21ac55 | 131 | $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \ |
1c79356b A |
132 | kernel_config=$(INSTALL_TYPE); \ |
133 | arch_config=$(INSTALL_ARCH_DEFAULT); \ | |
134 | exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \ | |
91447636 | 135 | [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir}; \ |
9bccf70c A |
136 | ${MAKE} -C $${exportinc_dir} \ |
137 | KERNEL_CONFIG=$${kernel_config} \ | |
1c79356b A |
138 | ARCH_CONFIG=$${arch_config} \ |
139 | MAKEFILES=${SOURCE}/Makefile \ | |
140 | SOURCE=${SOURCE}/ \ | |
141 | TARGET=$${exportinc_dir}/ \ | |
9bccf70c | 142 | build_exporthdrs_mi; \ |
1c79356b A |
143 | |
144 | # | |
145 | # Install machine dependent kernel header files | |
146 | # | |
2d21ac55 A |
147 | # Note - installation of machine dependent kernel header files only occurs for architecture |
148 | # defined in INSTALL_TYPE. We use skipit variable to skip over architectures that are not | |
149 | # equal to what is in the INSTALL_TYPE variable. | |
150 | # TARGET_CONFIGS_UC variable holds sets of three configuration options. The first item in the | |
151 | # set is the kernel configuration. The second item in the set is the architecture and the | |
152 | # third item is the machine configuration. There may be multiple sets to build. | |
0b4e3aa0 | 153 | exporthdrs_md: |
2d21ac55 A |
154 | $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \ |
155 | my_counter=1; \ | |
156 | for my_config in $(TARGET_CONFIGS_UC); \ | |
157 | do \ | |
158 | if [ $${my_counter} -eq 1 ] ; then \ | |
159 | skipit=0; \ | |
160 | my_counter=2; \ | |
161 | kernel_config=$${my_config}; \ | |
162 | if [ $${kernel_config} = DEFAULT ] ; then \ | |
163 | kernel_config=$(DEFAULT_KERNEL_CONFIG); \ | |
164 | fi; \ | |
165 | if [ $${kernel_config} != $(INSTALL_TYPE) ] ; then \ | |
166 | skipit=1; \ | |
167 | fi; \ | |
168 | elif [ $${my_counter} -eq 2 ] ; then \ | |
169 | my_counter=3; \ | |
170 | arch_config=$${my_config}; \ | |
171 | if [ $${arch_config} = DEFAULT ] ; then \ | |
172 | arch_config=`arch | $(TR) a-z A-Z`; \ | |
173 | fi; \ | |
174 | else \ | |
175 | my_counter=1; \ | |
176 | machine_config=$${my_config}; \ | |
177 | if [ $${skipit} -eq 0 ] ; then \ | |
178 | if [ $${arch_config} = ARM ] ; then \ | |
179 | if [ $${machine_config} = DEFAULT ] ; then \ | |
180 | machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \ | |
181 | fi; \ | |
182 | fi; \ | |
183 | if [ $${machine_config} = DEFAULT ] ; then \ | |
184 | exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \ | |
185 | else \ | |
186 | exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \ | |
187 | fi; \ | |
188 | [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir}; \ | |
189 | ${MAKE} -C $${exportinc_dir} \ | |
190 | KERNEL_CONFIG=$${kernel_config} \ | |
191 | ARCH_CONFIG=$${arch_config} \ | |
192 | MAKEFILES=${SOURCE}/Makefile \ | |
193 | SOURCE=${SOURCE}/ \ | |
194 | TARGET=$${exportinc_dir}/ \ | |
195 | build_exporthdrs_md; \ | |
196 | fi; \ | |
197 | fi; \ | |
1c79356b A |
198 | done; |
199 | ||
200 | # | |
201 | # Install machine independent kernel header files | |
202 | # | |
203 | do_exporthdrs_mi: | |
204 | ||
205 | build_exporthdrs_mi: | |
2d21ac55 | 206 | $(_v)_TMP_EXPINC_SUBDIRS="$(EXPINC_SUBDIRS)"; \ |
9bccf70c | 207 | for exportinc_subdir in $${_TMP_EXPINC_SUBDIRS}; \ |
1c79356b | 208 | do \ |
91447636 | 209 | [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir}; \ |
9bccf70c A |
210 | ${MAKE} -C $${exportinc_subdir} \ |
211 | MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \ | |
1c79356b A |
212 | SOURCE=$(SOURCE)$${exportinc_subdir}/ \ |
213 | TARGET=$(TARGET)$${exportinc_subdir}/ \ | |
9bccf70c | 214 | build_exporthdrs_mi; \ |
1c79356b | 215 | done; \ |
9bccf70c | 216 | ${MAKE} ${MAKEJOBS} do_exporthdrs_mi; |
1c79356b A |
217 | |
218 | # | |
219 | # Install machine dependent kernel header files | |
220 | # | |
221 | do_exporthdrs_md: | |
222 | ||
223 | build_exporthdrs_md: | |
2d21ac55 | 224 | $(_v)_TMP_exportinc_subdir="$($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG)))"; \ |
9bccf70c | 225 | for exportinc_subdir in $${_TMP_exportinc_subdir}; \ |
1c79356b | 226 | do \ |
91447636 | 227 | [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir}; \ |
9bccf70c A |
228 | ${MAKE} -C $${exportinc_subdir} \ |
229 | MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \ | |
1c79356b A |
230 | SOURCE=$(SOURCE)$${exportinc_subdir}/ \ |
231 | TARGET=$(TARGET)$${exportinc_subdir}/ \ | |
9bccf70c | 232 | build_exporthdrs_md; \ |
1c79356b | 233 | done; \ |
9bccf70c | 234 | ${MAKE} ${MAKEJOBS} do_exporthdrs_md; |
1c79356b A |
235 | |
236 | # | |
237 | # Setup pass for all architectures for all Configuration/Architecture options | |
238 | # | |
9bccf70c | 239 | setup: |
2d21ac55 | 240 | $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \ |
1c79356b A |
241 | for kernel_config in $(KERNEL_CONFIGS); \ |
242 | do \ | |
243 | for arch_config in $(ARCH_CONFIGS); \ | |
244 | do \ | |
245 | setup_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \ | |
91447636 | 246 | [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir}; \ |
9bccf70c A |
247 | ${MAKE} -C $${setup_subdir} \ |
248 | KERNEL_CONFIG=$${kernel_config} \ | |
1c79356b A |
249 | ARCH_CONFIG=$${arch_config} \ |
250 | MAKEFILES=${SOURCE}/Makefile \ | |
251 | SOURCE=${SOURCE}/ \ | |
252 | TARGET=$${setup_subdir}/ \ | |
9bccf70c | 253 | build_setup; \ |
1c79356b A |
254 | done; \ |
255 | done; | |
256 | ||
257 | do_build_setup: | |
258 | ||
259 | build_setup: | |
2d21ac55 | 260 | $(_v)_TMP_setup_subdir="$(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG)))"; \ |
9bccf70c | 261 | for setup_subdir in $${_TMP_setup_subdir}; \ |
1c79356b | 262 | do \ |
91447636 | 263 | [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir}; \ |
9bccf70c A |
264 | ${MAKE} -C $${setup_subdir} \ |
265 | MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile \ | |
1c79356b A |
266 | SOURCE=${SOURCE}/$${setup_subdir}/ \ |
267 | TARGET=${TARGET}/$${setup_subdir}/ \ | |
9bccf70c | 268 | build_setup; \ |
1c79356b A |
269 | done; \ |
270 | ${MAKE} do_build_setup; | |
271 | ||
272 | ||
273 | # | |
274 | # Build all architectures for all Configuration/Architecture options | |
275 | # | |
2d21ac55 A |
276 | # Note - TARGET_CONFIGS_UC variable holds sets of three configuration options. The first |
277 | # item in the set is the kernel configuration. The second item in the set is the architecture | |
278 | # and the third item is the machine configuration. There may be multiple sets to build. | |
279 | # | |
280 | ifeq ($(RC_ProjectName),Libsyscall) | |
281 | all: | |
282 | bsdmake -C libsyscall install | |
283 | else # xnu | |
9bccf70c A |
284 | ifeq ($(COMPONENT), .) |
285 | all: exporthdrs | |
286 | else | |
287 | all: | |
288 | endif | |
2d21ac55 A |
289 | $(_v)my_counter=1; \ |
290 | for my_config in $(TARGET_CONFIGS_UC); \ | |
291 | do \ | |
292 | if [ $${my_counter} -eq 1 ] ; then \ | |
293 | my_counter=2; \ | |
294 | kernel_config=$${my_config}; \ | |
295 | if [ $${kernel_config} = DEFAULT ] ; then \ | |
296 | kernel_config=$(DEFAULT_KERNEL_CONFIG); \ | |
297 | fi; \ | |
298 | elif [ $${my_counter} -eq 2 ] ; then \ | |
299 | my_counter=3; \ | |
300 | arch_config=$${my_config}; \ | |
301 | if [ $${arch_config} = DEFAULT ] ; then \ | |
302 | arch_config=`arch | $(TR) a-z A-Z`; \ | |
303 | fi; \ | |
304 | else \ | |
305 | my_counter=1; \ | |
306 | machine_config=$${my_config}; \ | |
307 | if [ $${arch_config} = ARM ] ; then \ | |
308 | if [ $${machine_config} = DEFAULT ] ; then \ | |
309 | machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \ | |
310 | fi; \ | |
311 | fi; \ | |
312 | if [ $${machine_config} = DEFAULT ] ; then \ | |
313 | build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \ | |
314 | else \ | |
315 | build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \ | |
316 | fi; \ | |
317 | [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \ | |
318 | ${MAKE} -C $${build_subdir} \ | |
319 | KERNEL_CONFIG=$${kernel_config} \ | |
320 | ARCH_CONFIG=$${arch_config} \ | |
321 | MACHINE_CONFIG=$${machine_config} \ | |
322 | MAKEFILES=${SOURCE}/Makefile \ | |
323 | SOURCE=${SOURCE}/ \ | |
324 | build_all; \ | |
325 | fi; \ | |
1c79356b | 326 | done; |
2d21ac55 | 327 | endif |
1c79356b A |
328 | |
329 | # | |
330 | # Build all architectures for all Configuration/Architecture options | |
331 | # | |
332 | do_build_all: | |
333 | ||
334 | build_all: | |
2d21ac55 A |
335 | $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \ |
336 | TARGET=$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \ | |
337 | else \ | |
338 | TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)"; \ | |
339 | fi; \ | |
9bccf70c A |
340 | _TMP_comp_subdir="$(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG)))"; \ |
341 | for comp_subdir in $${_TMP_comp_subdir}; \ | |
1c79356b | 342 | do \ |
91447636 | 343 | [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir}; \ |
9bccf70c A |
344 | ${MAKE} -C $${comp_subdir} \ |
345 | MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \ | |
1c79356b | 346 | SOURCE=${SOURCE}$${comp_subdir}/ \ |
0b4e3aa0 | 347 | TARGET=$${TARGET} \ |
9bccf70c | 348 | build_all; \ |
1c79356b | 349 | done; \ |
55e303ae A |
350 | ${MAKE} ${MAKEJOBS} INCL_MAKEDEP=TRUE TARGET=$${TARGET} do_build_all; \ |
351 | _TMP_comp_subdir="$(CONFIG_SUBDIRS) $($(addprefix CONFIG_SUBDIRS_, $(ARCH_CONFIG)))"; \ | |
352 | for comp_subdir in $${_TMP_comp_subdir}; \ | |
353 | do \ | |
91447636 | 354 | [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir}; \ |
55e303ae A |
355 | ${MAKE} -C $${comp_subdir} \ |
356 | MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \ | |
357 | SOURCE=${SOURCE}$${comp_subdir}/ \ | |
358 | TARGET=$${TARGET} \ | |
359 | build_all; \ | |
2d21ac55 | 360 | done; |
55e303ae | 361 | |
1c79356b A |
362 | |
363 | # | |
364 | # Build all architectures for all Configuration/Architecture options | |
365 | # | |
2d21ac55 A |
366 | # Note - TARGET_CONFIGS_UC variable holds sets of three configuration options. The first |
367 | # item in the set is the kernel configuration. The second item is the architecture | |
368 | # and the third item is the machine configuration. There may be multiple sets to build. | |
369 | # | |
9bccf70c | 370 | mach_kernel: |
2d21ac55 A |
371 | $(_v)my_counter=1; \ |
372 | for my_config in $(TARGET_CONFIGS_UC); \ | |
373 | do \ | |
374 | if [ $${my_counter} -eq 1 ] ; then \ | |
375 | my_counter=2; \ | |
376 | kernel_config=$${my_config}; \ | |
377 | if [ $${kernel_config} = DEFAULT ] ; then \ | |
378 | kernel_config=$(DEFAULT_KERNEL_CONFIG); \ | |
379 | fi; \ | |
380 | elif [ $${my_counter} -eq 2 ] ; then \ | |
381 | my_counter=3; \ | |
382 | arch_config=$${my_config}; \ | |
383 | if [ $${arch_config} = DEFAULT ] ; then \ | |
384 | arch_config=`arch | $(TR) a-z A-Z`; \ | |
385 | fi; \ | |
386 | else \ | |
387 | my_counter=1; \ | |
388 | machine_config=$${my_config}; \ | |
389 | if [ $${arch_config} = ARM ] ; then \ | |
390 | if [ $${machine_config} = DEFAULT ] ; then \ | |
391 | machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \ | |
392 | fi; \ | |
393 | fi; \ | |
394 | if [ $${machine_config} = DEFAULT ] ; then \ | |
395 | build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}; \ | |
396 | else \ | |
397 | build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}; \ | |
398 | fi; \ | |
399 | [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \ | |
400 | ${MAKE} -C $${build_subdir} \ | |
401 | KERNEL_CONFIG=$${kernel_config} \ | |
402 | ARCH_CONFIG=$${arch_config} \ | |
403 | MACHINE_CONFIG=$${machine_config} \ | |
404 | MAKEFILES=${SOURCE}/Makefile \ | |
405 | SOURCE=${SOURCE}/ \ | |
406 | TARGET=$${build_subdir}/ \ | |
407 | build_mach_kernel; \ | |
408 | fi; \ | |
1c79356b A |
409 | done; |
410 | ||
411 | # | |
412 | # Build all architectures for all Configuration/Architecture options | |
413 | # | |
414 | do_build_mach_kernel: | |
415 | ||
416 | build_mach_kernel: | |
2d21ac55 | 417 | $(_v)${MAKE} ${MAKEJOBS} do_build_mach_kernel; |
1c79356b | 418 | |
55e303ae | 419 | |
1c79356b A |
420 | # |
421 | # | |
422 | # Install dependencies order | |
423 | # | |
9bccf70c | 424 | .ORDER: installhdrs exporthdrs all |
1c79356b A |
425 | |
426 | # | |
427 | # Install kernel based on RC_ARCHS for all INSTALL_TYPES | |
428 | # Install kernel header files based on RC_ARCHS | |
429 | # | |
2d21ac55 A |
430 | install: installhdrs all installman installmachinekernels |
431 | ifeq ($(RC_ProjectName),Libsyscall) | |
432 | # nothing to do | |
433 | else # xnu | |
434 | $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \ | |
435 | machine_config=$(MACHINE_CONFIG); \ | |
1c79356b A |
436 | for kernel_config in $(INSTALL_TYPE); \ |
437 | do \ | |
438 | for arch_config in $(INSTALL_ARCHS); \ | |
439 | do \ | |
2d21ac55 A |
440 | if [ $${arch_config} = ARM ] ; then \ |
441 | if [ $${machine_config} = DEFAULT ] ; then \ | |
442 | machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \ | |
443 | fi; \ | |
444 | fi; \ | |
445 | if [ $${machine_config} = DEFAULT ] ; then \ | |
446 | install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \ | |
447 | else \ | |
448 | install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \ | |
449 | fi; \ | |
91447636 | 450 | [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir}; \ |
9bccf70c A |
451 | ${MAKE} -C $${install_subdir} \ |
452 | KERNEL_CONFIG=$${kernel_config} \ | |
1c79356b | 453 | ARCH_CONFIG=$${arch_config} \ |
2d21ac55 | 454 | MACHINE_CONFIG=$${machine_config} \ |
1c79356b A |
455 | MAKEFILES=${SOURCE}/Makefile \ |
456 | SOURCE=${SOURCE}/ \ | |
9bccf70c | 457 | build_install; \ |
1c79356b A |
458 | done; \ |
459 | done; | |
2d21ac55 A |
460 | endif |
461 | ||
462 | installmachinekernels: | |
463 | @echo "[ $(SOURCE) ] make installmachinekernels"; \ | |
464 | my_counter=1; \ | |
465 | for my_config in $(TARGET_CONFIGS_UC); \ | |
466 | do \ | |
467 | if [ $${my_counter} -eq 1 ] ; then \ | |
468 | my_counter=2; \ | |
469 | kernel_config=$${my_config}; \ | |
470 | if [ $${kernel_config} = DEFAULT ] ; then \ | |
471 | kernel_config=$(DEFAULT_KERNEL_CONFIG); \ | |
472 | fi; \ | |
473 | elif [ $${my_counter} -eq 2 ] ; then \ | |
474 | my_counter=3; \ | |
475 | arch_config=$${my_config}; \ | |
476 | if [ $${arch_config} = DEFAULT ] ; then \ | |
477 | arch_config=`arch | $(TR) a-z A-Z`; \ | |
478 | fi; \ | |
479 | else \ | |
480 | my_counter=1; \ | |
481 | machine_config=$${my_config}; \ | |
482 | if [ $${machine_config} != DEFAULT ] ; then \ | |
483 | build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}; \ | |
484 | install_file_list=mach.`printf "%s" "$${kernel_config}" | $(TR) A-Z a-z`.`printf "%s" "$${machine_config}" | $(TR) A-Z a-z`; \ | |
485 | [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \ | |
486 | ${MAKE} -C $${build_subdir} \ | |
487 | INSTALL_FILE_LIST=$${install_file_list} \ | |
488 | KERNEL_CONFIG=$${kernel_config} \ | |
489 | ARCH_CONFIG=$${arch_config} \ | |
490 | MACHINE_CONFIG=$${machine_config} \ | |
491 | MAKEFILES=${SOURCE}/Makefile \ | |
492 | SOURCE=${SOURCE}/ \ | |
493 | TARGET=$${build_subdir}/ \ | |
494 | do_build_install; \ | |
495 | fi; \ | |
496 | fi; \ | |
497 | done; | |
1c79356b A |
498 | |
499 | # | |
500 | # Install for all architectures for all Configuration/Architecture options | |
501 | # | |
502 | setup_build_install: | |
503 | ||
504 | do_build_install: | |
505 | ||
506 | build_install: | |
2d21ac55 A |
507 | $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \ |
508 | TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \ | |
509 | else \ | |
510 | TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)"; \ | |
511 | fi; \ | |
0b4e3aa0 | 512 | ${MAKE} TARGET=$${TARGET} setup_build_install; \ |
1c79356b | 513 | kernel_config=$(KERNEL_CONFIG); \ |
1c79356b A |
514 | for install_subdir in $(INST_SUBDIRS); \ |
515 | do \ | |
91447636 | 516 | [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir}; \ |
9bccf70c A |
517 | ${MAKE} -C $${install_subdir} \ |
518 | KERNEL_CONFIG=$${kernel_config} \ | |
1c79356b A |
519 | MAKEFILES=${SOURCE}/$${install_subdir}/Makefile \ |
520 | SOURCE=${SOURCE}$${install_subdir}/ \ | |
0b4e3aa0 | 521 | TARGET=$${TARGET} \ |
9bccf70c | 522 | build_install; \ |
1c79356b | 523 | done; \ |
9bccf70c | 524 | ${MAKE} ${MAKEJOBS} TARGET=$${TARGET} do_build_install; |
1c79356b A |
525 | |
526 | ||
527 | # | |
528 | # Install source tree | |
529 | # | |
9bccf70c | 530 | installsrc: |
2d21ac55 | 531 | $(_v)(tar -c --mode go=r,+X --no-ignore-case --exclude .svn --exclude cscope.\* --exclude BUILD --exclude \*~ -f - .) | (cd $(SRCROOT) && tar --no-same-owner -xf -) |
1c79356b A |
532 | |
533 | ||
534 | # | |
535 | # Clean up source tree | |
536 | # | |
9bccf70c | 537 | clean: |
1c79356b A |
538 | |
539 | # | |
540 | # Build source file list for cscope database and tags | |
541 | # | |
542 | cscope.files: | |
543 | @echo "Building file list for cscope and tags" | |
0c530ab8 A |
544 | @find . -name '*.h' -type f | grep -v ^..BUILD > _cscope.files 2> /dev/null |
545 | @find . -name '*.defs' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null | |
546 | @find . -name '*.c' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null | |
547 | @find . -name '*.cpp' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null | |
548 | @find . -name '*.s' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null | |
549 | @find . -name '*.h.template' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null | |
550 | @echo -k -q -c > cscope.files 2> /dev/null | |
551 | @sort -u < _cscope.files >> cscope.files 2> /dev/null | |
552 | @rm -f _cscope.files _cscope.files2 2> /dev/null | |
1c79356b A |
553 | |
554 | # | |
555 | # Build cscope database | |
556 | # | |
557 | cscope: cscope.files | |
558 | @echo "Building cscope database" | |
0c530ab8 | 559 | @cscope -bvU 2> /dev/null |
1c79356b A |
560 | |
561 | # | |
562 | # Build tags | |
563 | # | |
564 | ||
565 | tags: cscope.files | |
566 | @echo "Building ctags" | |
2d21ac55 | 567 | @-sed 1d cscope.files | xargs ctags -dtw 2> /dev/null || \ |
1c79356b | 568 | echo "Phantom files detected!" 2>&1 > /dev/null |
2d21ac55 A |
569 | @-[ -f TAGS ] || ${MAKE} TAGS |
570 | ||
571 | TAGS: cscope.files | |
1c79356b A |
572 | @echo "Building etags" |
573 | @-cat cscope.files | etags -l auto -S - 2> /dev/null | |
574 | ||
9bccf70c A |
575 | # |
576 | # Install Man Pages | |
577 | # | |
578 | installman: | |
2d21ac55 A |
579 | ifeq ($(RC_ProjectName),Libsyscall) |
580 | bsdmake -C libsyscall install-man | |
581 | else # xnu | |
582 | @echo "[ $(SRCROOT) ] Installing man pages" | |
583 | $(_v)manpath=$(DSTROOT)/$(MANDIR); \ | |
91447636 | 584 | [ -d $$manpath ] || $(MKDIR) $$manpath; \ |
9bccf70c A |
585 | ${MAKE} MAKEFILES=${SOURCE}/Makefile \ |
586 | SOURCE=${SOURCE}/ \ | |
587 | TARGET=${DSTROOT}/ \ | |
588 | build_installman | |
2d21ac55 A |
589 | ${SOURCE}/config/compress-man-pages.pl ${DSTROOT}/${MANDIR} |
590 | endif | |
9bccf70c A |
591 | |
592 | do_installman: | |
593 | ||
594 | build_installman: | |
2d21ac55 A |
595 | @echo "[ $(SOURCE) ] make build_installman" |
596 | $(_v)if [ -n "$(strip $(INSTMAN_SUBDIRS))" ]; then \ | |
9bccf70c A |
597 | for installman_subdir in $(INSTMAN_SUBDIRS); do \ |
598 | ${MAKE} -C $${installman_subdir} -r \ | |
599 | MAKEFILES=$(SOURCE)$${installman_subdir}/Makefile \ | |
600 | SOURCE=$(SOURCE)$${installman_subdir}/ \ | |
601 | TARGET=$(TARGET)$${installman_subdir}/ \ | |
602 | build_installman; \ | |
603 | done; \ | |
604 | fi; \ | |
605 | if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \ | |
606 | ${MAKE} ${MAKEJOBS} do_installman; \ | |
1c79356b | 607 | fi |
2d21ac55 A |
608 | |
609 | # vim: set ft=make: |