2 # Install kernel header files
4 ifeq ($(RC_ProjectName),Libsyscall)
6 bsdmake -C libsyscall installhdrs
8 installhdrs: exporthdrs installhdrs_mi installhdrs_md
9 @echo "[ $(SRCROOT) ] make installhdrs installing Kernel.framework"
10 $(_v)kincpath=$(DSTROOT)/$(KINCDIR); \
11 krespath=$(DSTROOT)/$(KRESDIR); \
12 kframepath=$(DSTROOT)/$(KINCFRAME); \
13 [ -d $$krespath ] || $(MKDIR) $$krespath; \
14 [ -d $$kincpath ] || $(MKDIR) $$kincpath; \
15 cd $(SRCROOT)/EXTERNAL_HEADERS; \
16 install $(FILE_INSTALL_FLAGS) Info.plist $$krespath; \
17 $(SRCROOT)/config/newvers.pl $${krespath}/Info.plist; \
18 cd $$kframepath/Versions; \
19 [ -L Current ] || $(LN) $(KINCVERS) Current; \
21 [ -L Headers ] || $(LN) Versions/Current/Headers Headers; \
22 [ -L Resources ] || $(LN) Versions/Current/Resources Resources; \
23 [ -d $(DSTROOT)/$(KPINCDIR) ] || $(MKDIR) $(DSTROOT)/$(KPINCDIR); \
24 cd $$kframepath; [ -L PrivateHeaders ] || \
25 $(LN) Versions/Current/PrivateHeaders PrivateHeaders;
29 # Install header files order
31 .ORDER: installhdrs_mi installhdrs_md
34 # Install machine independent header files
37 $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
38 kernel_config=$(INSTALL_TYPE); \
39 arch_config=$(INSTALL_ARCH_DEFAULT); \
40 installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
41 [ -d $${installinc_dir} ] ||$(MKDIR) $${installinc_dir}; \
42 ${MAKE} -C $${installinc_dir} \
43 KERNEL_CONFIG=$${kernel_config} \
44 ARCH_CONFIG=$${arch_config} \
45 MAKEFILES=${SOURCE}/Makefile \
47 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
48 build_installhdrs_mi; \
51 # Install machine dependent kernel header files
54 $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
55 kernel_config=$(INSTALL_TYPE); \
56 machine_config=$(MACHINE_CONFIG); \
57 for arch_config in $(INSTALL_ARCHS); \
59 if [ $${arch_config} = ARM ] ; then \
60 if [ $${machine_config} = DEFAULT ] ; then \
61 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
64 if [ $${machine_config} = DEFAULT ] ; then \
65 objpath=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
67 objpath=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \
69 [ -d $${objpath} ] || $(MKDIR) $${objpath}; \
70 ${MAKE} -C $${objpath} \
71 KERNEL_CONFIG=$${kernel_config} \
72 ARCH_CONFIG=$${arch_config} \
73 MAKEFILES=${SOURCE}/Makefile \
76 build_installhdrs_md; \
80 # Install machine independent kernel header files
84 build_installhdrs_mi::
85 @echo "[ $(SOURCE) ] make build_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
86 $(_v)for installinc_subdir in $(INSTINC_SUBDIRS); \
88 [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir}; \
89 ${MAKE} -C $${installinc_subdir} \
90 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
91 SOURCE=$(SOURCE)$${installinc_subdir}/ \
92 TARGET=$(TARGET)$${installinc_subdir}/ \
93 build_installhdrs_mi; \
95 ${MAKE} ${MAKEJOBS} do_installhdrs_mi;
98 # Install machine dependent kernel header files
102 build_installhdrs_md::
103 @echo "[ $(SOURCE) ] make installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"
104 $(_v)for installinc_subdir in $($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG))); \
106 [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir}; \
107 ${MAKE} -C $${installinc_subdir} \
108 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
109 SOURCE=$(SOURCE)$${installinc_subdir}/ \
110 TARGET=$(TARGET)$${installinc_subdir}/ \
111 build_installhdrs_md; \
113 ${MAKE} ${MAKEJOBS} do_installhdrs_md;
116 # Install kernel header files
118 exporthdrs: exporthdrs_mi exporthdrs_md
121 # Install header files order
123 .ORDER: exporthdrs_mi exporthdrs_md
126 # Install machine independent header files
131 $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
132 kernel_config=$(INSTALL_TYPE); \
133 arch_config=$(INSTALL_ARCH_DEFAULT); \
134 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
135 [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir}; \
136 ${MAKE} -C $${exportinc_dir} \
137 KERNEL_CONFIG=$${kernel_config} \
138 ARCH_CONFIG=$${arch_config} \
139 MAKEFILES=${SOURCE}/Makefile \
141 TARGET=$${exportinc_dir}/ \
142 build_exporthdrs_mi; \
145 # Install machine dependent kernel header files
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.
154 $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
156 for my_config in $(TARGET_CONFIGS_UC); \
158 if [ $${my_counter} -eq 1 ] ; then \
161 kernel_config=$${my_config}; \
162 if [ $${kernel_config} = DEFAULT ] ; then \
163 kernel_config=$(DEFAULT_KERNEL_CONFIG); \
165 if [ $${kernel_config} != $(INSTALL_TYPE) ] ; then \
168 elif [ $${my_counter} -eq 2 ] ; then \
170 arch_config=$${my_config}; \
171 if [ $${arch_config} = DEFAULT ] ; then \
172 arch_config=`arch | $(TR) a-z A-Z`; \
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); \
183 if [ $${machine_config} = DEFAULT ] ; then \
184 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
186 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \
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 \
194 TARGET=$${exportinc_dir}/ \
195 build_exporthdrs_md; \
201 # Install machine independent kernel header files
206 $(_v)_TMP_EXPINC_SUBDIRS="$(EXPINC_SUBDIRS)"; \
207 for exportinc_subdir in $${_TMP_EXPINC_SUBDIRS}; \
209 [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir}; \
210 ${MAKE} -C $${exportinc_subdir} \
211 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
212 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
213 TARGET=$(TARGET)$${exportinc_subdir}/ \
214 build_exporthdrs_mi; \
216 ${MAKE} ${MAKEJOBS} do_exporthdrs_mi;
219 # Install machine dependent kernel header files
224 $(_v)_TMP_exportinc_subdir="$($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG)))"; \
225 for exportinc_subdir in $${_TMP_exportinc_subdir}; \
227 [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir}; \
228 ${MAKE} -C $${exportinc_subdir} \
229 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
230 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
231 TARGET=$(TARGET)$${exportinc_subdir}/ \
232 build_exporthdrs_md; \
234 ${MAKE} ${MAKEJOBS} do_exporthdrs_md;
237 # Setup pass for all architectures for all Configuration/Architecture options
240 $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
241 for kernel_config in $(KERNEL_CONFIGS); \
243 for arch_config in $(ARCH_CONFIGS); \
245 setup_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
246 [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir}; \
247 ${MAKE} -C $${setup_subdir} \
248 KERNEL_CONFIG=$${kernel_config} \
249 ARCH_CONFIG=$${arch_config} \
250 MAKEFILES=${SOURCE}/Makefile \
252 TARGET=$${setup_subdir}/ \
260 $(_v)_TMP_setup_subdir="$(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG)))"; \
261 for setup_subdir in $${_TMP_setup_subdir}; \
263 [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir}; \
264 ${MAKE} -C $${setup_subdir} \
265 MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile \
266 SOURCE=${SOURCE}/$${setup_subdir}/ \
267 TARGET=${TARGET}/$${setup_subdir}/ \
270 ${MAKE} do_build_setup;
274 # Build all architectures for all Configuration/Architecture options
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.
280 ifeq ($(RC_ProjectName),Libsyscall)
282 bsdmake -C libsyscall install
284 ifeq ($(COMPONENT), .)
290 for my_config in $(TARGET_CONFIGS_UC); \
292 if [ $${my_counter} -eq 1 ] ; then \
294 kernel_config=$${my_config}; \
295 if [ $${kernel_config} = DEFAULT ] ; then \
296 kernel_config=$(DEFAULT_KERNEL_CONFIG); \
298 elif [ $${my_counter} -eq 2 ] ; then \
300 arch_config=$${my_config}; \
301 if [ $${arch_config} = DEFAULT ] ; then \
302 arch_config=`arch | $(TR) a-z A-Z`; \
306 machine_config=$${my_config}; \
307 if [ $${arch_config} = ARM ] ; then \
308 if [ $${machine_config} = DEFAULT ] ; then \
309 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
312 if [ $${machine_config} = DEFAULT ] ; then \
313 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
315 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \
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 \
330 # Build all architectures for all Configuration/Architecture options
335 $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \
336 TARGET=$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
338 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)"; \
340 _TMP_comp_subdir="$(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG)))"; \
341 for comp_subdir in $${_TMP_comp_subdir}; \
343 [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir}; \
344 ${MAKE} -C $${comp_subdir} \
345 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
346 SOURCE=${SOURCE}$${comp_subdir}/ \
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}; \
354 [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir}; \
355 ${MAKE} -C $${comp_subdir} \
356 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
357 SOURCE=${SOURCE}$${comp_subdir}/ \
364 # Build all architectures for all Configuration/Architecture options
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.
372 for my_config in $(TARGET_CONFIGS_UC); \
374 if [ $${my_counter} -eq 1 ] ; then \
376 kernel_config=$${my_config}; \
377 if [ $${kernel_config} = DEFAULT ] ; then \
378 kernel_config=$(DEFAULT_KERNEL_CONFIG); \
380 elif [ $${my_counter} -eq 2 ] ; then \
382 arch_config=$${my_config}; \
383 if [ $${arch_config} = DEFAULT ] ; then \
384 arch_config=`arch | $(TR) a-z A-Z`; \
388 machine_config=$${my_config}; \
389 if [ $${arch_config} = ARM ] ; then \
390 if [ $${machine_config} = DEFAULT ] ; then \
391 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
394 if [ $${machine_config} = DEFAULT ] ; then \
395 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}; \
397 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}; \
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 \
406 TARGET=$${build_subdir}/ \
412 # Build all architectures for all Configuration/Architecture options
414 do_build_mach_kernel:
417 $(_v)${MAKE} ${MAKEJOBS} do_build_mach_kernel;
422 # Install dependencies order
424 .ORDER: installhdrs exporthdrs all
427 # Install kernel based on RC_ARCHS for all INSTALL_TYPES
428 # Install kernel header files based on RC_ARCHS
430 install: installhdrs all installman installmachinekernels
431 ifeq ($(RC_ProjectName),Libsyscall)
434 $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
435 machine_config=$(MACHINE_CONFIG); \
436 for kernel_config in $(INSTALL_TYPE); \
438 for arch_config in $(INSTALL_ARCHS); \
440 if [ $${arch_config} = ARM ] ; then \
441 if [ $${machine_config} = DEFAULT ] ; then \
442 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
445 if [ $${machine_config} = DEFAULT ] ; then \
446 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
448 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \
450 [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir}; \
451 ${MAKE} -C $${install_subdir} \
452 KERNEL_CONFIG=$${kernel_config} \
453 ARCH_CONFIG=$${arch_config} \
454 MACHINE_CONFIG=$${machine_config} \
455 MAKEFILES=${SOURCE}/Makefile \
462 installmachinekernels:
463 @echo "[ $(SOURCE) ] make installmachinekernels"; \
465 for my_config in $(TARGET_CONFIGS_UC); \
467 if [ $${my_counter} -eq 1 ] ; then \
469 kernel_config=$${my_config}; \
470 if [ $${kernel_config} = DEFAULT ] ; then \
471 kernel_config=$(DEFAULT_KERNEL_CONFIG); \
473 elif [ $${my_counter} -eq 2 ] ; then \
475 arch_config=$${my_config}; \
476 if [ $${arch_config} = DEFAULT ] ; then \
477 arch_config=`arch | $(TR) a-z A-Z`; \
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 \
493 TARGET=$${build_subdir}/ \
500 # Install for all architectures for all Configuration/Architecture options
507 $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \
508 TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
510 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)"; \
512 ${MAKE} TARGET=$${TARGET} setup_build_install; \
513 kernel_config=$(KERNEL_CONFIG); \
514 for install_subdir in $(INST_SUBDIRS); \
516 [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir}; \
517 ${MAKE} -C $${install_subdir} \
518 KERNEL_CONFIG=$${kernel_config} \
519 MAKEFILES=${SOURCE}/$${install_subdir}/Makefile \
520 SOURCE=${SOURCE}$${install_subdir}/ \
524 ${MAKE} ${MAKEJOBS} TARGET=$${TARGET} do_build_install;
528 # Install source tree
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 -)
535 # Clean up source tree
540 # Build source file list for cscope database and tags
543 @echo "Building file list for cscope and tags"
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
555 # Build cscope database
558 @echo "Building cscope database"
559 @cscope -bvU 2> /dev/null
566 @echo "Building ctags"
567 @-sed 1d cscope.files | xargs ctags -dtw 2> /dev/null || \
568 echo "Phantom files detected!" 2>&1 > /dev/null
569 @-[ -f TAGS ] || ${MAKE} TAGS
572 @echo "Building etags"
573 @-cat cscope.files | etags -l auto -S - 2> /dev/null
579 ifeq ($(RC_ProjectName),Libsyscall)
580 bsdmake -C libsyscall install-man
582 @echo "[ $(SRCROOT) ] Installing man pages"
583 $(_v)manpath=$(DSTROOT)/$(MANDIR); \
584 [ -d $$manpath ] || $(MKDIR) $$manpath; \
585 ${MAKE} MAKEFILES=${SOURCE}/Makefile \
589 ${SOURCE}/config/compress-man-pages.pl ${DSTROOT}/${MANDIR}
595 @echo "[ $(SOURCE) ] make build_installman"
596 $(_v)if [ -n "$(strip $(INSTMAN_SUBDIRS))" ]; then \
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}/ \
605 if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \
606 ${MAKE} ${MAKEJOBS} do_installman; \