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