2 # Install kernel header files
6 ifeq ($(findstring Libsyscall,$(RC_ProjectName)),Libsyscall)
10 if [ $${sdk} = / ] ; then \
13 xcrun -sdk "$(SDKROOT)" xcodebuild installhdrs \
14 "SRCROOT=$(SRCROOT)/libsyscall" \
15 "OBJROOT=$(OBJROOT)" \
16 "SYMROOT=$(SYMROOT)" \
17 "DSTROOT=$(DSTROOT)" \
19 else ifeq ($(findstring libkxld,$(RC_ProjectName)),libkxld)
21 make -C libkern/kxld/ installhdrs
22 else ifeq ($(RC_ProjectName),libkmod)
25 else # xnu, xnu_debug, or xnu_headers_Sim
26 installhdrs: exporthdrs installhdrs_mi installhdrs_md setup
27 @echo "[ $(SRCROOT) ] make installhdrs installing Kernel.framework"
28 $(_v)kincpath=$(DSTROOT)/$(KINCDIR); \
29 krespath=$(DSTROOT)/$(KRESDIR); \
30 kframepath=$(DSTROOT)/$(KINCFRAME); \
31 [ -d $$krespath ] || $(MKDIR) $$krespath; \
32 [ -d $$kincpath ] || $(MKDIR) $$kincpath; \
33 cd $(SRCROOT)/EXTERNAL_HEADERS; \
34 install $(FILE_INSTALL_FLAGS) Info.plist $$krespath; \
35 $(NEWVERS) $${krespath}/Info.plist; \
36 cd $$kframepath/Versions; \
37 [ -L Current ] || $(LN) $(KINCVERS) Current; \
39 [ -L Headers ] || $(LN) Versions/Current/Headers Headers; \
40 [ -L Resources ] || $(LN) Versions/Current/Resources Resources; \
41 [ -d $(DSTROOT)/$(KPINCDIR) ] || $(MKDIR) $(DSTROOT)/$(KPINCDIR); \
42 cd $$kframepath; [ -L PrivateHeaders ] || \
43 $(LN) Versions/Current/PrivateHeaders PrivateHeaders;
44 ifeq ($(RC_ProjectName),xnu_headers_Sim)
45 @echo "[ $(SRCROOT) ] make installhdrs installing System.framework"
46 $(_v)spincpath=$(DSTROOT)/$(SPINCDIR); \
47 sframepath=$(DSTROOT)/$(SINCFRAME); \
48 [ -d $$spincpath ] || $(MKDIR) $$spincpath; \
49 cd $$sframepath/Versions; \
50 [ -L Current ] || $(LN) $(SINCVERS) Current; \
51 cd $$sframepath; [ -L PrivateHeaders ] || \
52 $(LN) Versions/Current/PrivateHeaders PrivateHeaders;
54 ifeq (iPhoneOS,$(PLATFORM))
55 $(_v)$(IPHONEOS_OPTIMIZE) $(DSTROOT)/$(KRESDIR)/Info.plist
59 .PHONY: installhdrs_embedded installhdrs_devicemap
60 installhdrs_embedded installhdrs_devicemap: installhdrs
63 # Install header files order
65 .ORDER: installhdrs_mi installhdrs_md
66 .PHONY: installhdrs_mi installhdrs_md
69 # Install machine independent header files
72 $(_v)kernel_config=$(INSTALL_TYPE); \
73 machine_config=$(MACHINE_CONFIG); \
74 arch_config=$(INSTALL_ARCH_DEFAULT); \
75 if [ $${arch_config} = ARM ] ; then \
76 if [ $${machine_config} = DEFAULT ] ; then \
77 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
80 if [ $${arch_config} = L4_ARM ] ; then \
81 if [ $${machine_config} = DEFAULT ] ; then \
82 machine_config=$(DEFAULT_L4_ARM_MACHINE_CONFIG); \
85 if [ $${machine_config} = DEFAULT ] ; then \
86 installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/${RELATIVE_SOURCE_PATH}; \
88 installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/${RELATIVE_SOURCE_PATH}; \
90 [ -d $${installinc_dir} ] || $(MKDIR) $${installinc_dir}; \
91 ${MAKE} ${MAKEJOBS} -C $${installinc_dir} \
92 KERNEL_CONFIG=$${kernel_config} \
93 ARCH_CONFIG=$${arch_config} \
94 MACHINE_CONFIG=$${machine_config} \
95 MAKEFILES=${SOURCE}/Makefile \
97 RELATIVE_SOURCE_PATH=. \
98 TARGET=$${installinc_dir}/ \
99 build_installhdrs_mi; \
102 # Install machine dependent kernel header files
103 # Uses hack for machine_config, which is not threaded through properly.
105 installhdrs_md: setup
106 $(_v)kernel_config=$(INSTALL_TYPE); \
107 machine_config=$(MACHINE_CONFIG); \
108 for arch_config in $(INSTALL_ARCHS); \
110 if [ $${arch_config} = ARM ] ; then \
111 if [ $${machine_config} = DEFAULT ] ; then \
112 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
115 if [ $${arch_config} = L4_ARM ] ; then \
116 if [ $${machine_config} = DEFAULT ] ; then \
117 machine_config=$(DEFAULT_L4_ARM_MACHINE_CONFIG); \
120 if [ $${machine_config} = DEFAULT ] ; then \
121 installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/${RELATIVE_SOURCE_PATH}; \
123 installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/${RELATIVE_SOURCE_PATH}; \
125 [ -d $${installinc_dir} ] || $(MKDIR) $${installinc_dir}; \
126 ${MAKE} ${MAKEJOBS} -C $${installinc_dir} \
127 KERNEL_CONFIG=$${kernel_config} \
128 ARCH_CONFIG=$${arch_config} \
129 MACHINE_CONFIG=$${machine_config} \
130 MAKEFILES=${SOURCE}/Makefile \
132 RELATIVE_SOURCE_PATH=. \
133 TARGET=$${installinc_dir}/ \
134 build_installhdrs_md; \
138 # Install machine independent kernel header files
142 BUILD_INSTALLHDRS_MI_SUBDIRS_TARGETS = $(addprefix build_installhdrs_mi_,$(INSTINC_SUBDIRS))
144 .PHONY: $(BUILD_INSTALLHDRS_MI_SUBDIRS_TARGETS)
146 $(BUILD_INSTALLHDRS_MI_SUBDIRS_TARGETS):
147 $(_v)installinc_subdir="$(patsubst build_installhdrs_mi_%,%,$@)"; \
148 [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir}; \
149 ${MAKE} -C $${installinc_subdir} \
150 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
151 SOURCE=$(SOURCE)$${installinc_subdir}/ \
152 RELATIVE_SOURCE_PATH=$(RELATIVE_SOURCE_PATH)/$${installinc_subdir} \
153 TARGET=$(TARGET)$${installinc_subdir}/ \
154 build_installhdrs_mi;
156 build_installhdrs_mi: $(BUILD_INSTALLHDRS_MI_SUBDIRS_TARGETS)
157 $(_v)${MAKE} do_installhdrs_mi;
160 # Install machine dependent kernel header files
164 BUILD_INSTALLHDRS_MD_SUBDIRS_TARGETS = $(addprefix build_installhdrs_md_,$($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG))))
166 .PHONY: $(BUILD_INSTALLHDRS_MD_SUBDIRS_TARGETS)
168 $(BUILD_INSTALLHDRS_MD_SUBDIRS_TARGETS):
169 $(_v)installinc_subdir="$(patsubst build_installhdrs_md_%,%,$@)"; \
170 [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir}; \
171 ${MAKE} -C $${installinc_subdir} \
172 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
173 SOURCE=$(SOURCE)$${installinc_subdir}/ \
174 RELATIVE_SOURCE_PATH=$(RELATIVE_SOURCE_PATH)/$${installinc_subdir} \
175 TARGET=$(TARGET)$${installinc_subdir}/ \
176 build_installhdrs_md;
178 build_installhdrs_md: $(BUILD_INSTALLHDRS_MD_SUBDIRS_TARGETS)
179 $(_v)${MAKE} do_installhdrs_md;
182 # Install kernel header files
186 exporthdrs: exporthdrs_mi exporthdrs_md
189 # Install header files order
191 .ORDER: exporthdrs_mi exporthdrs_md
192 .PHONY: exporthdrs_mi exporthdrs_md
195 # Install machine independent header files
200 $(_v)kernel_config=$(INSTALL_TYPE); \
201 arch_config=$(INSTALL_ARCH_DEFAULT); \
202 machine_config=DEFAULT; \
203 if [ $${arch_config} = ARM ] ; then \
204 if [ $${machine_config} = DEFAULT ] ; then \
205 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
208 if [ $${arch_config} = L4_ARM ] ; then \
209 if [ $${machine_config} = DEFAULT ] ; then \
210 machine_config=$(DEFAULT_L4_ARM_MACHINE_CONFIG);\
213 if [ $${machine_config} = DEFAULT ] ; then \
214 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/${RELATIVE_SOURCE_PATH}; \
216 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/${RELATIVE_SOURCE_PATH}; \
218 [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir}; \
219 ${MAKE} ${MAKEJOBS} -C $${exportinc_dir} \
220 KERNEL_CONFIG=$${kernel_config} \
221 ARCH_CONFIG=$${arch_config} \
222 MACHINE_CONFIG=$${machine_config} \
223 MAKEFILES=${SOURCE}/Makefile \
225 RELATIVE_SOURCE_PATH=. \
226 TARGET=$${exportinc_dir}/ \
227 build_exporthdrs_mi; \
230 # Install machine dependent kernel header files
232 # Note - installation of machine dependent kernel header files only occurs for architecture
233 # defined in INSTALL_TYPE. We use skipit variable to skip over architectures that are not
234 # equal to what is in the INSTALL_TYPE variable.
235 # TARGET_CONFIGS_UC variable holds sets of three configuration options. The first item in the
236 # set is the kernel configuration. The second item in the set is the architecture and the
237 # third item is the machine configuration. There may be multiple sets to build.
240 for my_config in $(TARGET_CONFIGS_UC); \
242 if [ $${my_counter} -eq 1 ] ; then \
245 kernel_config=$${my_config}; \
246 if [ $${kernel_config} = DEFAULT ] ; then \
247 kernel_config=$(DEFAULT_KERNEL_CONFIG); \
249 if [ $${kernel_config} != $(INSTALL_TYPE) ] ; then \
252 elif [ $${my_counter} -eq 2 ] ; then \
254 arch_config=$${my_config}; \
255 if [ $${arch_config} = DEFAULT ] ; then \
256 arch_config=`arch | $(TR) a-z A-Z`; \
260 machine_config=$${my_config}; \
261 if [ $${skipit} -eq 0 ] ; then \
262 if [ $${arch_config} = ARM ] ; then \
263 if [ $${machine_config} = DEFAULT ] ; then \
264 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
267 if [ $${arch_config} = L4_ARM ] ; then \
268 if [ $${machine_config} = DEFAULT ] ; then \
269 machine_config=$(DEFAULT_L4_ARM_MACHINE_CONFIG); \
272 if [ $${machine_config} = DEFAULT ] ; then \
273 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/${RELATIVE_SOURCE_PATH}; \
275 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/${RELATIVE_SOURCE_PATH}; \
277 [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir}; \
278 ${MAKE} ${MAKEJOBS} -C $${exportinc_dir} \
279 KERNEL_CONFIG=$${kernel_config} \
280 ARCH_CONFIG=$${arch_config} \
281 MACHINE_CONFIG=$${machine_config} \
282 MAKEFILES=${SOURCE}/Makefile \
284 RELATIVE_SOURCE_PATH=. \
285 TARGET=$${exportinc_dir}/ \
286 build_exporthdrs_md; \
292 # Install machine independent kernel header files
296 BUILD_EXPORTHDRS_MI_SUBDIRS_TARGETS = $(addprefix build_exporthdrs_mi_,$(EXPINC_SUBDIRS))
298 .PHONY: $(BUILD_EXPORTHDRS_MI_SUBDIRS_TARGETS)
300 $(BUILD_EXPORTHDRS_MI_SUBDIRS_TARGETS):
301 $(_v)exportinc_subdir="$(patsubst build_exporthdrs_mi_%,%,$@)"; \
302 [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir}; \
303 ${MAKE} -C $${exportinc_subdir} \
304 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
305 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
306 RELATIVE_SOURCE_PATH=$(RELATIVE_SOURCE_PATH)/$${exportinc_subdir} \
307 TARGET=$(TARGET)$${exportinc_subdir}/ \
310 build_exporthdrs_mi: $(BUILD_EXPORTHDRS_MI_SUBDIRS_TARGETS)
311 $(_v)${MAKE} do_exporthdrs_mi;
314 # Install machine dependent kernel header files
318 BUILD_EXPORTHDRS_MD_SUBDIRS_TARGETS = $(addprefix build_exporthdrs_md_,$($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG))))
320 .PHONY: $(BUILD_EXPORTHDRS_MD_SUBDIRS_TARGETS)
322 $(BUILD_EXPORTHDRS_MD_SUBDIRS_TARGETS):
323 $(_v)exportinc_subdir="$(patsubst build_exporthdrs_md_%,%,$@)"; \
324 [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir}; \
325 ${MAKE} -C $${exportinc_subdir} \
326 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
327 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
328 RELATIVE_SOURCE_PATH=$(RELATIVE_SOURCE_PATH)/$${exportinc_subdir} \
329 TARGET=$(TARGET)$${exportinc_subdir}/ \
332 build_exporthdrs_md: $(BUILD_EXPORTHDRS_MD_SUBDIRS_TARGETS)
333 $(_v)${MAKE} do_exporthdrs_md;
336 # Setup pass for all architectures for all Configuration/Architecture options
341 $(_v)kernel_config=$(INSTALL_TYPE); \
342 arch_config=$(INSTALL_ARCH_DEFAULT); \
343 setup_subdir=${OBJROOT}/$${RELATIVE_SOURCE_PATH}; \
344 [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir}; \
345 ${MAKE} ${MAKEJOBS} -C $${setup_subdir} \
346 KERNEL_CONFIG=$${kernel_config} \
347 ARCH_CONFIG=$${arch_config} \
348 MACHINE_CONFIG=$${machine_config} \
349 MAKEFILES=${SOURCE}/Makefile \
351 RELATIVE_SOURCE_PATH=. \
352 TARGET=$${setup_subdir}/ \
357 BUILD_SETUP_SUBDIRS_TARGETS = $(addprefix build_setup_,$(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG))))
359 .PHONY: $(BUILD_SETUP_SUBDIRS_TARGETS)
361 $(BUILD_SETUP_SUBDIRS_TARGETS):
362 $(_v)setup_subdir="$(patsubst build_setup_%,%,$@)"; \
363 [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir}; \
364 ${MAKE} -C $${setup_subdir} \
365 MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile \
366 SOURCE=${SOURCE}/$${setup_subdir}/ \
367 RELATIVE_SOURCE_PATH=${RELATIVE_SOURCE_PATH}/$${setup_subdir} \
368 TARGET=${TARGET}/$${setup_subdir}/ \
371 build_setup: $(BUILD_SETUP_SUBDIRS_TARGETS)
372 $(_v)${MAKE} do_build_setup;
376 # Build all architectures for all Configuration/Architecture options
378 # Note - TARGET_CONFIGS_UC variable holds sets of three configuration options. The first
379 # item in the set is the kernel configuration. The second item in the set is the architecture
380 # and the third item is the machine configuration. There may be multiple sets to build.
384 ifeq ($(RC_ProjectName),Libsyscall)
388 if [ $${sdk} = / ] ; then \
391 xcrun -sdk "$(SDKROOT)" xcodebuild install \
392 "SRCROOT=$(SRCROOT)/libsyscall" \
393 "OBJROOT=$(OBJROOT)" \
394 "SYMROOT=$(SYMROOT)" \
395 "DSTROOT=$(DSTROOT)" \
397 else ifeq ($(RC_ProjectName),libkxld)
399 make -C libkern/kxld/ install
400 else ifeq ($(RC_ProjectName),libkxld_host)
402 make -C libkern/kxld/ install PRODUCT_TYPE=ARCHIVE
403 else ifeq ($(RC_ProjectName),libkmod)
407 if [ $${sdk} = / ] ; then \
410 xcrun -sdk "$(SDKROOT)" xcodebuild install \
411 "SRCROOT=$(SRCROOT)/libkern/kmod" \
412 "OBJROOT=$(OBJROOT)" \
413 "SYMROOT=$(SYMROOT)" \
414 "DSTROOT=$(DSTROOT)" \
416 else ifeq ($(findstring _headers_Sim,$(RC_ProjectName)),_headers_Sim) # Libsyscall/xnu _headers_Sim
418 else # xnu or xnu_debug
419 ifeq ($(COMPONENT), .)
420 all: exporthdrs setup
425 for my_config in $(TARGET_CONFIGS_UC); \
427 if [ $${my_counter} -eq 1 ] ; then \
429 kernel_config=$${my_config}; \
430 if [ $${kernel_config} = DEFAULT ] ; then \
431 kernel_config=$(DEFAULT_KERNEL_CONFIG); \
433 elif [ $${my_counter} -eq 2 ] ; then \
435 arch_config=$${my_config}; \
436 if [ $${arch_config} = DEFAULT ] ; then \
437 arch_config=`arch | $(TR) a-z A-Z`; \
441 machine_config=$${my_config}; \
442 if [ $${arch_config} = ARM ] ; then \
443 if [ $${machine_config} = DEFAULT ] ; then \
444 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
447 if [ $${arch_config} = L4_ARM ] ; then \
448 if [ $${machine_config} = DEFAULT ] ; then \
449 machine_config=$(DEFAULT_L4_ARM_MACHINE_CONFIG); \
452 if [ $${machine_config} = DEFAULT ] ; then \
453 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/${RELATIVE_SOURCE_PATH}; \
455 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/${RELATIVE_SOURCE_PATH}; \
457 [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \
458 ${MAKE} ${MAKEJOBS} -C $${build_subdir} \
459 KERNEL_CONFIG=$${kernel_config} \
460 ARCH_CONFIG=$${arch_config} \
461 MACHINE_CONFIG=$${machine_config} \
462 MAKEFILES=${SOURCE}/Makefile \
464 RELATIVE_SOURCE_PATH=${RELATIVE_SOURCE_PATH} \
470 .PHONY: all_embedded all_devicemap
471 all_embedded all_devicemap: all
474 # Build all architectures for all Configuration/Architecture options
478 BUILD_ALL_SUBDIRS_TARGETS = $(addprefix build_all_,$(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG))))
480 .PHONY: $(BUILD_ALL_SUBDIRS_TARGETS)
482 $(BUILD_ALL_SUBDIRS_TARGETS):
483 $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \
484 TARGET=$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
486 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)"; \
488 comp_subdir="$(patsubst build_all_%,%,$@)"; \
489 [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir}; \
490 ${MAKE} -C $${comp_subdir} \
491 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
492 SOURCE=${SOURCE}$${comp_subdir}/ \
493 RELATIVE_SOURCE_PATH=$(RELATIVE_SOURCE_PATH)/$${comp_subdir} \
497 build_all: $(BUILD_ALL_SUBDIRS_TARGETS)
498 $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \
499 TARGET=$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
501 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)"; \
503 ${MAKE} INCL_MAKEDEP=TRUE TARGET=$${TARGET} do_build_all; \
504 _TMP_comp_subdir="$(CONFIG_SUBDIRS) $($(addprefix CONFIG_SUBDIRS_, $(ARCH_CONFIG)))"; \
505 for comp_subdir in $${_TMP_comp_subdir}; \
507 [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir}; \
508 ${MAKE} -C $${comp_subdir} \
509 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
510 SOURCE=${SOURCE}$${comp_subdir}/ \
511 RELATIVE_SOURCE_PATH=$(RELATIVE_SOURCE_PATH)/$${comp_subdir} \
518 # Build all architectures for all Configuration/Architecture options
520 # Note - TARGET_CONFIGS_UC variable holds sets of three configuration options. The first
521 # item in the set is the kernel configuration. The second item is the architecture
522 # and the third item is the machine configuration. There may be multiple sets to build.
526 for my_config in $(TARGET_CONFIGS_UC); \
528 if [ $${my_counter} -eq 1 ] ; then \
530 kernel_config=$${my_config}; \
531 if [ $${kernel_config} = DEFAULT ] ; then \
532 kernel_config=$(DEFAULT_KERNEL_CONFIG); \
534 elif [ $${my_counter} -eq 2 ] ; then \
536 arch_config=$${my_config}; \
537 if [ $${arch_config} = DEFAULT ] ; then \
538 arch_config=`arch | $(TR) a-z A-Z`; \
542 machine_config=$${my_config}; \
543 if [ $${arch_config} = ARM ] ; then \
544 if [ $${machine_config} = DEFAULT ] ; then \
545 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
548 if [ $${arch_config} = L4_ARM ] ; then \
549 if [ $${machine_config} = DEFAULT ] ; then \
550 machine_config=$(DEFAULT_L4_ARM_MACHINE_CONFIG); \
553 if [ $${machine_config} = DEFAULT ] ; then \
554 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}; \
556 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}; \
558 [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \
559 ${MAKE} ${MAKEJOBS} -C $${build_subdir} \
560 KERNEL_CONFIG=$${kernel_config} \
561 ARCH_CONFIG=$${arch_config} \
562 MACHINE_CONFIG=$${machine_config} \
563 MAKEFILES=${SOURCE}/Makefile \
565 TARGET=$${build_subdir}/ \
571 # Build all architectures for all Configuration/Architecture options
573 do_build_mach_kernel:
576 $(_v)${MAKE} do_build_mach_kernel;
581 # Install dependencies order
583 .ORDER: installhdrs exporthdrs all
586 # Install kernel based on RC_ARCHS for all INSTALL_TYPES
587 # Install kernel header files based on RC_ARCHS
589 install: installhdrs all installman installmachinekernels
590 ifeq ($(findstring Libsyscall,$(RC_ProjectName)),Libsyscall)
592 else ifeq ($(findstring libkxld,$(RC_ProjectName)),libkxld)
593 # nothing to do, work performed in "all" action
594 else ifeq ($(RC_ProjectName),libkmod)
595 # nothing to do, work performed in "all" action
596 else ifeq ($(findstring _headers_Sim,$(RC_ProjectName)),_headers_Sim)
598 else # xnu or xnu_debug
599 # A bit of a hack for machine_config: machine configs aren't really threaded through properly.
600 $(_v)machine_config=$(MACHINE_CONFIG); \
601 for kernel_config in $(INSTALL_TYPE); \
603 for arch_config in $(INSTALL_ARCHS); \
605 if [ $${arch_config} = ARM ] ; then \
606 if [ $${machine_config} = DEFAULT ] ; then \
607 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
610 if [ $${arch_config} = L4_ARM ] ; then \
611 if [ $${machine_config} = DEFAULT ] ; then \
612 machine_config=$(DEFAULT_L4_ARM_MACHINE_CONFIG); \
615 if [ $${machine_config} = DEFAULT ] ; then \
616 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/${RELATIVE_SOURCE_PATH}; \
618 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/${RELATIVE_SOURCE_PATH}; \
620 [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir}; \
621 ${MAKE} ${MAKEJOBS} -C $${install_subdir} \
622 KERNEL_CONFIG=$${kernel_config} \
623 ARCH_CONFIG=$${arch_config} \
624 MACHINE_CONFIG=$${machine_config} \
625 MAKEFILES=${SOURCE}/Makefile \
627 RELATIVE_SOURCE_PATH=${RELATIVE_SOURCE_PATH} \
631 ifeq ($(RC_ProjectName),xnu_debug)
632 $(_v)$(MKDIR) $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
633 $(_v)$(MV) $(DSTROOT)/mach_kernel* $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
634 $(_v)$(CP) $(SYMROOT)/kgmacros $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
635 $(_v)$(CP) -r $(SYMROOT)/System.kext $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
636 $(_v)$(CP) -r $(SYMROOT)/mach_kernel.dSYM $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
637 $(_v)$(CP) $(SRCROOT)/config/README.DEBUG-kernel.txt $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
638 $(_v)$(MV) $(DSTROOT)/System $(DSTROOT)/usr $(OBJROOT)/
642 .PHONY: install_embedded install_devicemap
643 install_embedded install_devicemap: install
645 installmachinekernels:
646 @echo "[ $(SOURCE) ] make installmachinekernels"; \
648 for my_config in $(TARGET_CONFIGS_UC); \
650 if [ $${my_counter} -eq 1 ] ; then \
652 kernel_config=$${my_config}; \
653 if [ $${kernel_config} = DEFAULT ] ; then \
654 kernel_config=$(DEFAULT_KERNEL_CONFIG); \
656 elif [ $${my_counter} -eq 2 ] ; then \
658 arch_config=$${my_config}; \
659 if [ $${arch_config} = DEFAULT ] ; then \
660 arch_config=`arch | $(TR) a-z A-Z`; \
664 machine_config=$${my_config}; \
665 if [ $${machine_config} != DEFAULT ] ; then \
666 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}; \
667 install_kernel_file=mach.`printf "%s" "$${kernel_config}" | $(TR) A-Z a-z`.`printf "%s" "$${machine_config}" | $(TR) A-Z a-z`; \
668 [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \
669 ${MAKE} ${MAKEJOBS} -C $${build_subdir} \
670 INSTALL_KERNEL_FILE=$${install_kernel_file} \
671 KERNEL_CONFIG=$${kernel_config} \
672 ARCH_CONFIG=$${arch_config} \
673 MACHINE_CONFIG=$${machine_config} \
674 MAKEFILES=${SOURCE}/Makefile \
676 RELATIVE_SOURCE_PATH=${RELATIVE_SOURCE_PATH} \
677 TARGET=$${build_subdir}/ \
684 # Install for all architectures for all Configuration/Architecture options
690 BUILD_INSTALL_SUBDIRS_TARGETS = $(addprefix build_install_,$(INST_SUBDIRS))
692 .PHONY: $(BUILD_INSTALL_SUBDIRS_TARGETS)
694 $(BUILD_INSTALL_SUBDIRS_TARGETS):
695 $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \
696 TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
698 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)"; \
700 ${MAKE} TARGET=$${TARGET} setup_build_install; \
701 kernel_config=$(KERNEL_CONFIG); \
702 install_subdir="$(patsubst build_install_%,%,$@)"; \
703 [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir}; \
704 ${MAKE} -C $${install_subdir} \
705 KERNEL_CONFIG=$${kernel_config} \
706 MAKEFILES=${SOURCE}/$${install_subdir}/Makefile \
707 SOURCE=${SOURCE}$${install_subdir}/ \
708 RELATIVE_SOURCE_PATH=${RELATIVE_SOURCE_PATH}/$${install_subdir} \
712 build_install: $(BUILD_INSTALL_SUBDIRS_TARGETS)
713 $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \
714 TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
716 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)"; \
718 ${MAKE} TARGET=$${TARGET} do_build_install;
722 # Install source tree
727 $(_v)($(TAR) -c --mode go=r,+X --no-ignore-case --exclude .svn --exclude .git --exclude cscope.\* --exclude BUILD --exclude \*~ -f - .) | (cd $(SRCROOT) && $(TAR) --no-same-owner -xf -)
731 # Clean up source tree
738 # Build source file list for cscope database and tags
741 @echo "Building file list for cscope and tags"
742 @find . -name '*.h' -type f | grep -v ^..BUILD > _cscope.files 2> /dev/null
743 @find . -name '*.defs' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
744 @find . -name '*.c' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
745 @find . -name '*.cpp' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
746 @find . -name '*.s' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
747 @find . -name '*.h.template' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
748 @echo -k -q -c > cscope.files 2> /dev/null
749 @sort -u < _cscope.files >> cscope.files 2> /dev/null
750 @rm -f _cscope.files _cscope.files2 2> /dev/null
753 # Build cscope database
756 @echo "Building cscope database"
757 @cscope -bvU 2> /dev/null
764 @echo "Building ctags"
765 @-sed 1d cscope.files | xargs ctags -dtw 2> /dev/null || \
766 echo "Phantom files detected!" 2>&1 > /dev/null
767 @-[ -f TAGS ] || ${MAKE} TAGS
770 @echo "Building etags"
771 @-cat cscope.files | etags -l auto -S - 2> /dev/null
779 ifeq ($(findstring Libsyscall,$(RC_ProjectName)),Libsyscall)
781 else ifeq ($(findstring libkxld,$(RC_ProjectName)),libkxld)
783 else ifeq ($(RC_ProjectName),libkmod)
785 else ifeq ($(findstring xnu_,$(RC_ProjectName)),xnu_)
789 @echo "[ $(SRCROOT) ] Installing man pages"
790 $(_v)manpath=$(DSTROOT)/$(MANDIR); \
791 [ -d $$manpath ] || $(MKDIR) $$manpath; \
792 ${MAKE} ${MAKEJOBS} MAKEFILES=${SOURCE}/Makefile \
794 RELATIVE_SOURCE_PATH=${RELATIVE_SOURCE_PATH} \
797 ${SRCROOT}/config/compress-man-pages.pl ${DSTROOT}/${MANDIR}
802 BUILD_INSTALLMAN_SUBDIRS_TARGETS = $(addprefix build_installman_,$(INSTMAN_SUBDIRS))
804 .PHONY: $(BUILD_INSTALLMAN_SUBDIRS_TARGETS)
806 $(BUILD_INSTALLMAN_SUBDIRS_TARGETS):
807 $(_v)installman_subdir="$(patsubst build_installman_%,%,$@)"; \
808 ${MAKE} -C $${installman_subdir} -r \
809 MAKEFILES=$(SOURCE)$${installman_subdir}/Makefile \
810 SOURCE=$(SOURCE)$${installman_subdir}/ \
811 RELATIVE_SOURCE_PATH=$(RELATIVE_SOURCE_PATH)/$${installman_subdir} \
812 TARGET=$(TARGET)$${installman_subdir}/ \
815 build_installman: $(BUILD_INSTALLMAN_SUBDIRS_TARGETS)
816 $(_v)if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \
817 ${MAKE} do_installman; \