2 # Install kernel header files
4 installhdrs: exporthdrs installhdrs_mi installhdrs_md
5 @echo "[ $(SRCROOT) ] make installhdrs installing Kernel.framework"; \
6 kincpath=$(DSTROOT)/$(KINCDIR); \
7 krespath=$(DSTROOT)/$(KRESDIR); \
8 kframepath=$(DSTROOT)/$(KINCFRAME); \
9 [ -d $$krespath ] || $(MKDIR) $$krespath; \
10 [ -d $$kincpath ] || $(MKDIR) $$kincpath; \
11 cd $(SRCROOT)/EXTERNAL_HEADERS; \
12 install $(FILE_INSTALL_FLAGS) Info.plist $$krespath; \
13 $(SRCROOT)/config/newvers.pl $${krespath}/Info.plist; \
14 cd $$kframepath/Versions; \
15 [ -L Current ] || $(LN) $(KINCVERS) Current; \
17 [ -L Headers ] || $(LN) Versions/Current/Headers Headers; \
18 [ -L Resources ] || $(LN) Versions/Current/Resources Resources; \
19 [ -d $(DSTROOT)/$(KPINCDIR) ] || $(MKDIR) $(DSTROOT)/$(KPINCDIR); \
20 cd $$kframepath; [ -L PrivateHeaders ] || \
21 $(LN) Versions/Current/PrivateHeaders PrivateHeaders;
24 # Install header files order
26 .ORDER: installhdrs_mi installhdrs_md
29 # Install machine independent header files
32 @echo "[ $(SOURCE) ] make installhdrs_mi "; \
33 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
34 kernel_config=$(INSTALL_TYPE); \
35 arch_config=$(INSTALL_ARCH_DEFAULT); \
36 installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
37 [ -d $${installinc_dir} ] ||$(MKDIR) $${installinc_dir}; \
38 ${MAKE} -C $${installinc_dir} \
39 KERNEL_CONFIG=$${kernel_config} \
40 ARCH_CONFIG=$${arch_config} \
41 MAKEFILES=${SOURCE}/Makefile \
43 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
44 build_installhdrs_mi; \
47 # Install machine dependent kernel header files
50 @echo "[ $(SOURCE) ] make installhdrs_md "; \
51 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
52 kernel_config=$(INSTALL_TYPE); \
53 for arch_config in $(INSTALL_ARCHS); \
55 [ -d ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path} ] || \
56 $(MKDIR) ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
57 ${MAKE} -C ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path} \
58 KERNEL_CONFIG=$${kernel_config} \
59 ARCH_CONFIG=$${arch_config} \
60 MAKEFILES=${SOURCE}/Makefile \
62 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
63 build_installhdrs_md; \
67 # Install machine independent kernel header files
71 build_installhdrs_mi::
72 @echo "[ $(SOURCE) ] make build_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
73 for installinc_subdir in $(INSTINC_SUBDIRS); \
75 [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir}; \
76 ${MAKE} -C $${installinc_subdir} \
77 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
78 SOURCE=$(SOURCE)$${installinc_subdir}/ \
79 TARGET=$(TARGET)$${installinc_subdir}/ \
80 build_installhdrs_mi; \
82 ${MAKE} ${MAKEJOBS} do_installhdrs_mi;
85 # Install machine dependent kernel header files
89 build_installhdrs_md::
90 @echo "[ $(SOURCE) ] make installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
91 for installinc_subdir in $($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG))); \
93 [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir}; \
94 ${MAKE} -C $${installinc_subdir} \
95 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
96 SOURCE=$(SOURCE)$${installinc_subdir}/ \
97 TARGET=$(TARGET)$${installinc_subdir}/ \
98 build_installhdrs_md; \
100 ${MAKE} ${MAKEJOBS} do_installhdrs_md;
103 # Install kernel header files
105 exporthdrs: exporthdrs_mi exporthdrs_md
108 # Install header files order
110 .ORDER: exporthdrs_mi exporthdrs_md
113 # Install machine independent header files
118 @echo "[ ${SOURCE} ] make exporthdrs_mi "; \
119 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
120 kernel_config=$(INSTALL_TYPE); \
121 arch_config=$(INSTALL_ARCH_DEFAULT); \
122 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
123 [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir}; \
124 ${MAKE} -C $${exportinc_dir} \
125 KERNEL_CONFIG=$${kernel_config} \
126 ARCH_CONFIG=$${arch_config} \
127 MAKEFILES=${SOURCE}/Makefile \
129 TARGET=$${exportinc_dir}/ \
130 build_exporthdrs_mi; \
133 # Install machine dependent kernel header files
136 @echo "[ $(SOURCE) ] make exporthdrs_md "; \
137 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
138 kernel_config=$(INSTALL_TYPE); \
139 for arch_config in $(ARCH_CONFIGS); \
141 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
142 [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir}; \
143 ${MAKE} -C $${exportinc_dir} \
144 KERNEL_CONFIG=$${kernel_config} \
145 ARCH_CONFIG=$${arch_config} \
146 MAKEFILES=${SOURCE}/Makefile \
148 TARGET=$${exportinc_dir}/ \
149 build_exporthdrs_md; \
153 # Install machine independent kernel header files
158 @echo "[ $(SOURCE) ] make build_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
159 _TMP_EXPINC_SUBDIRS="$(EXPINC_SUBDIRS)"; \
160 for exportinc_subdir in $${_TMP_EXPINC_SUBDIRS}; \
162 [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir}; \
163 ${MAKE} -C $${exportinc_subdir} \
164 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
165 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
166 TARGET=$(TARGET)$${exportinc_subdir}/ \
167 build_exporthdrs_mi; \
169 ${MAKE} ${MAKEJOBS} do_exporthdrs_mi;
172 # Install machine dependent kernel header files
177 @echo "[ $(SOURCE) ] make exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
178 _TMP_exportinc_subdir="$($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG)))"; \
179 for exportinc_subdir in $${_TMP_exportinc_subdir}; \
181 [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir}; \
182 ${MAKE} -C $${exportinc_subdir} \
183 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
184 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
185 TARGET=$(TARGET)$${exportinc_subdir}/ \
186 build_exporthdrs_md; \
188 ${MAKE} ${MAKEJOBS} do_exporthdrs_md;
191 # Setup pass for all architectures for all Configuration/Architecture options
194 @echo "[ $(SOURCE) ] make setup"; \
195 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
196 for kernel_config in $(KERNEL_CONFIGS); \
198 for arch_config in $(ARCH_CONFIGS); \
200 setup_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
201 [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir}; \
202 ${MAKE} -C $${setup_subdir} \
203 KERNEL_CONFIG=$${kernel_config} \
204 ARCH_CONFIG=$${arch_config} \
205 MAKEFILES=${SOURCE}/Makefile \
207 TARGET=$${setup_subdir}/ \
215 @echo "[ $(SOURCE) ] make build_setup $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
216 _TMP_setup_subdir="$(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG)))"; \
217 for setup_subdir in $${_TMP_setup_subdir}; \
219 [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir}; \
220 ${MAKE} -C $${setup_subdir} \
221 MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile \
222 SOURCE=${SOURCE}/$${setup_subdir}/ \
223 TARGET=${TARGET}/$${setup_subdir}/ \
226 ${MAKE} do_build_setup;
230 # Build all architectures for all Configuration/Architecture options
232 ifeq ($(COMPONENT), .)
237 @echo "[ $(SOURCE) ] make all"; \
238 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
239 for kernel_config in $(KERNEL_CONFIGS); \
241 for arch_config in $(ARCH_CONFIGS); \
243 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
244 [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \
245 ${MAKE} -C $${build_subdir} \
246 KERNEL_CONFIG=$${kernel_config} \
247 ARCH_CONFIG=$${arch_config} \
248 MAKEFILES=${SOURCE}/Makefile \
255 # Build all architectures for all Configuration/Architecture options
260 @TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
261 echo "[ $(SOURCE) ] make build_all $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $${TARGET}"; \
262 _TMP_comp_subdir="$(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG)))"; \
263 for comp_subdir in $${_TMP_comp_subdir}; \
265 [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir}; \
266 ${MAKE} -C $${comp_subdir} \
267 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
268 SOURCE=${SOURCE}$${comp_subdir}/ \
272 ${MAKE} ${MAKEJOBS} INCL_MAKEDEP=TRUE TARGET=$${TARGET} do_build_all; \
273 _TMP_comp_subdir="$(CONFIG_SUBDIRS) $($(addprefix CONFIG_SUBDIRS_, $(ARCH_CONFIG)))"; \
274 for comp_subdir in $${_TMP_comp_subdir}; \
276 [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir}; \
277 ${MAKE} -C $${comp_subdir} \
278 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
279 SOURCE=${SOURCE}$${comp_subdir}/ \
286 # Build all architectures for all Configuration/Architecture options
289 @echo "[ $(SOURCE) ] make mach_kernel"; \
290 for kernel_config in $(KERNEL_CONFIGS); \
292 for arch_config in $(ARCH_CONFIGS); \
294 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}; \
295 [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \
296 ${MAKE} -C $${build_subdir} \
297 KERNEL_CONFIG=$${kernel_config} \
298 ARCH_CONFIG=$${arch_config} \
299 MAKEFILES=${SOURCE}/Makefile \
301 TARGET=$${build_subdir}/ \
307 # Build all architectures for all Configuration/Architecture options
309 do_build_mach_kernel:
312 @echo "[ $(SOURCE) ] make build_mach_kernel $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
313 ${MAKE} ${MAKEJOBS} do_build_mach_kernel;
318 # Install dependencies order
320 .ORDER: installhdrs exporthdrs all
323 # Install kernel based on RC_ARCHS for all INSTALL_TYPES
324 # Install kernel header files based on RC_ARCHS
326 install: installhdrs all installman
327 @echo "[ $(SOURCE) ] make install"; \
328 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
329 for kernel_config in $(INSTALL_TYPE); \
331 for arch_config in $(INSTALL_ARCHS); \
333 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
334 [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir}; \
335 ${MAKE} -C $${install_subdir} \
336 KERNEL_CONFIG=$${kernel_config} \
337 ARCH_CONFIG=$${arch_config} \
338 MAKEFILES=${SOURCE}/Makefile \
345 # Install for all architectures for all Configuration/Architecture options
352 @TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
353 echo "[ $(SOURCE) ] make build_install $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $${TARGET}"; \
354 ${MAKE} TARGET=$${TARGET} setup_build_install; \
355 kernel_config=$(KERNEL_CONFIG); \
356 for install_subdir in $(INST_SUBDIRS); \
358 [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir}; \
359 ${MAKE} -C $${install_subdir} \
360 KERNEL_CONFIG=$${kernel_config} \
361 MAKEFILES=${SOURCE}/$${install_subdir}/Makefile \
362 SOURCE=${SOURCE}$${install_subdir}/ \
366 ${MAKE} ${MAKEJOBS} TARGET=$${TARGET} do_build_install;
370 # Install source tree
378 # Clean up source tree
383 # Build source file list for cscope database and tags
386 @echo "Building file list for cscope and tags"
387 @find . -name '*.h' -type f | grep -v ^..BUILD > _cscope.files 2> /dev/null
388 @find . -name '*.defs' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
389 @find . -name '*.c' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
390 @find . -name '*.cpp' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
391 @find . -name '*.s' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
392 @find . -name '*.h.template' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
393 @echo -k -q -c > cscope.files 2> /dev/null
394 @sort -u < _cscope.files >> cscope.files 2> /dev/null
395 @rm -f _cscope.files _cscope.files2 2> /dev/null
398 # Build cscope database
401 @echo "Building cscope database"
402 @cscope -bvU 2> /dev/null
409 @echo "Building ctags"
410 @-xargs ctags -dtw < cscope.files 2> /dev/null || \
411 echo "Phantom files detected!" 2>&1 > /dev/null
412 @echo "Building etags"
413 @-cat cscope.files | etags -l auto -S - 2> /dev/null
419 @echo "[ $(SRCROOT) ] Installing man pages"; \
420 manpath=$(DSTROOT)/$(MANDIR); \
421 [ -d $$manpath ] || $(MKDIR) $$manpath; \
422 ${MAKE} MAKEFILES=${SOURCE}/Makefile \
430 @echo "[ $(SOURCE) ] make build_installman"; \
431 if [ -n "$(strip $(INSTMAN_SUBDIRS))" ]; then \
432 for installman_subdir in $(INSTMAN_SUBDIRS); do \
433 ${MAKE} -C $${installman_subdir} -r \
434 MAKEFILES=$(SOURCE)$${installman_subdir}/Makefile \
435 SOURCE=$(SOURCE)$${installman_subdir}/ \
436 TARGET=$(TARGET)$${installman_subdir}/ \
440 if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \
441 ${MAKE} ${MAKEJOBS} do_installman; \