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 kframepath=$(DSTROOT)/$(KINCFRAME); \
9 chmod -R +w $$kincpath; \
10 for i in $(COMPONENT_LIST); do \
11 if [ -d $(OBJROOT)/EXPORT_HDRS/$$i ]; then ( \
12 cd $(OBJROOT)/EXPORT_HDRS/$$i; \
13 pax -ruw -s '/.*CVS.*//' . $$kincpath || true ; \
16 cd $(SRCROOT)/EXTERNAL_HEADERS; \
17 pax -ruw -s '/.*CVS.*//' . $$kincpath || true; \
18 cd $$kframepath/Versions; \
19 [ -L Current ] || $(LN) $(KINCVERS) Current; \
21 [ -L Headers ] || $(LN) Versions/Current/Headers Headers; \
22 $(MKDIR) $(DSTROOT)/$(KPINCDIR); \
23 cd $$kframepath; [ -L PrivateHeaders ] || \
24 $(LN) Versions/Current/PrivateHeaders PrivateHeaders; \
25 find $$kframepath -type f | xargs -s 32000 chmod a-w
28 # Install header files order
30 .ORDER: installhdrs_mi installhdrs_md
33 # Install machine independent header files
36 @echo "[ $(SOURCE) ] make installhdrs_mi "; \
37 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 $(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 @echo "[ $(SOURCE) ] make installhdrs_md "; \
55 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
56 kernel_config=$(INSTALL_TYPE); \
57 for arch_config in $(INSTALL_ARCHS); \
59 $(MKDIR) ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
60 ${MAKE} -C ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path} \
61 KERNEL_CONFIG=$${kernel_config} \
62 ARCH_CONFIG=$${arch_config} \
63 MAKEFILES=${SOURCE}/Makefile \
65 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
66 build_installhdrs_md; \
70 # Install machine independent kernel header files
74 build_installhdrs_mi::
75 @echo "[ $(SOURCE) ] make build_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
76 for installinc_subdir in $(INSTINC_SUBDIRS); \
78 $(MKDIR) $${installinc_subdir}; \
79 ${MAKE} -C $${installinc_subdir} \
80 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
81 SOURCE=$(SOURCE)$${installinc_subdir}/ \
82 TARGET=$(TARGET)$${installinc_subdir}/ \
83 build_installhdrs_mi; \
85 ${MAKE} ${MAKEJOBS} do_installhdrs_mi;
88 # Install machine dependent kernel header files
92 build_installhdrs_md::
93 @echo "[ $(SOURCE) ] make installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
94 for installinc_subdir in $($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG))); \
96 $(MKDIR) $${installinc_subdir}; \
97 ${MAKE} -C $${installinc_subdir} \
98 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
99 SOURCE=$(SOURCE)$${installinc_subdir}/ \
100 TARGET=$(TARGET)$${installinc_subdir}/ \
101 build_installhdrs_md; \
103 ${MAKE} ${MAKEJOBS} do_installhdrs_md;
106 # Install kernel header files
108 exporthdrs: exporthdrs_mi exporthdrs_md
111 # Install header files order
113 .ORDER: exporthdrs_mi exporthdrs_md
116 # Install machine independent header files
121 @echo "[ ${SOURCE} ] make exporthdrs_mi "; \
122 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
123 kernel_config=$(INSTALL_TYPE); \
124 arch_config=$(INSTALL_ARCH_DEFAULT); \
125 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
126 $(MKDIR) $${exportinc_dir}; \
127 ${MAKE} -C $${exportinc_dir} \
128 KERNEL_CONFIG=$${kernel_config} \
129 ARCH_CONFIG=$${arch_config} \
130 MAKEFILES=${SOURCE}/Makefile \
132 TARGET=$${exportinc_dir}/ \
133 build_exporthdrs_mi; \
136 # Install machine dependent kernel header files
139 @echo "[ $(SOURCE) ] make exporthdrs_md "; \
140 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
141 kernel_config=$(INSTALL_TYPE); \
142 for arch_config in $(ARCH_CONFIGS); \
144 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
145 $(MKDIR) $${exportinc_dir}; \
146 ${MAKE} -C $${exportinc_dir} \
147 KERNEL_CONFIG=$${kernel_config} \
148 ARCH_CONFIG=$${arch_config} \
149 MAKEFILES=${SOURCE}/Makefile \
151 TARGET=$${exportinc_dir}/ \
152 build_exporthdrs_md; \
156 # Install machine independent kernel header files
161 @echo "[ $(SOURCE) ] make build_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
162 _TMP_EXPINC_SUBDIRS="$(EXPINC_SUBDIRS)"; \
163 for exportinc_subdir in $${_TMP_EXPINC_SUBDIRS}; \
165 $(MKDIR) $${exportinc_subdir}; \
166 ${MAKE} -C $${exportinc_subdir} \
167 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
168 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
169 TARGET=$(TARGET)$${exportinc_subdir}/ \
170 build_exporthdrs_mi; \
172 ${MAKE} ${MAKEJOBS} do_exporthdrs_mi;
175 # Install machine dependent kernel header files
180 @echo "[ $(SOURCE) ] make exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
181 _TMP_exportinc_subdir="$($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG)))"; \
182 for exportinc_subdir in $${_TMP_exportinc_subdir}; \
184 $(MKDIR) $${exportinc_subdir}; \
185 ${MAKE} -C $${exportinc_subdir} \
186 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
187 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
188 TARGET=$(TARGET)$${exportinc_subdir}/ \
189 build_exporthdrs_md; \
191 ${MAKE} ${MAKEJOBS} do_exporthdrs_md;
194 # Setup pass for all architectures for all Configuration/Architecture options
197 @echo "[ $(SOURCE) ] make setup"; \
198 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
199 for kernel_config in $(KERNEL_CONFIGS); \
201 for arch_config in $(ARCH_CONFIGS); \
203 setup_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
204 $(MKDIR) $${setup_subdir}; \
205 ${MAKE} -C $${setup_subdir} \
206 KERNEL_CONFIG=$${kernel_config} \
207 ARCH_CONFIG=$${arch_config} \
208 MAKEFILES=${SOURCE}/Makefile \
210 TARGET=$${setup_subdir}/ \
218 @echo "[ $(SOURCE) ] make build_setup $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
219 _TMP_setup_subdir="$(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG)))"; \
220 for setup_subdir in $${_TMP_setup_subdir}; \
222 $(MKDIR) $${setup_subdir}; \
223 ${MAKE} -C $${setup_subdir} \
224 MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile \
225 SOURCE=${SOURCE}/$${setup_subdir}/ \
226 TARGET=${TARGET}/$${setup_subdir}/ \
229 ${MAKE} do_build_setup;
233 # Build all architectures for all Configuration/Architecture options
235 ifeq ($(COMPONENT), .)
240 @echo "[ $(SOURCE) ] make all"; \
241 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
242 for kernel_config in $(KERNEL_CONFIGS); \
244 for arch_config in $(ARCH_CONFIGS); \
246 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
247 $(MKDIR) $${build_subdir}; \
248 ${MAKE} -C $${build_subdir} \
249 KERNEL_CONFIG=$${kernel_config} \
250 ARCH_CONFIG=$${arch_config} \
251 MAKEFILES=${SOURCE}/Makefile \
258 # Build all architectures for all Configuration/Architecture options
263 @TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
264 echo "[ $(SOURCE) ] make build_all $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $${TARGET}"; \
265 _TMP_comp_subdir="$(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG)))"; \
266 for comp_subdir in $${_TMP_comp_subdir}; \
268 $(MKDIR) $${comp_subdir}; \
269 ${MAKE} -C $${comp_subdir} \
270 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
271 SOURCE=${SOURCE}$${comp_subdir}/ \
275 ${MAKE} ${MAKEJOBS} INCL_MAKEDEP=TRUE TARGET=$${TARGET} do_build_all;
278 # Build all architectures for all Configuration/Architecture options
281 @echo "[ $(SOURCE) ] make mach_kernel"; \
282 for kernel_config in $(KERNEL_CONFIGS); \
284 for arch_config in $(ARCH_CONFIGS); \
286 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}; \
287 $(MKDIR) $${build_subdir}; \
288 ${MAKE} -C $${build_subdir} \
289 KERNEL_CONFIG=$${kernel_config} \
290 ARCH_CONFIG=$${arch_config} \
291 MAKEFILES=${SOURCE}/Makefile \
293 TARGET=$${build_subdir}/ \
299 # Build all architectures for all Configuration/Architecture options
301 do_build_mach_kernel:
304 @echo "[ $(SOURCE) ] make build_mach_kernel $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
305 ${MAKE} ${MAKEJOBS} do_build_mach_kernel;
309 # Install dependencies order
311 .ORDER: installhdrs exporthdrs all
314 # Install kernel based on RC_ARCHS for all INSTALL_TYPES
315 # Install kernel header files based on RC_ARCHS
317 install: installhdrs all installman
318 @echo "[ $(SOURCE) ] make install"; \
319 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
320 for kernel_config in $(INSTALL_TYPE); \
322 for arch_config in $(INSTALL_ARCHS); \
324 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
325 $(MKDIR) $${install_subdir}; \
326 ${MAKE} -C $${install_subdir} \
327 KERNEL_CONFIG=$${kernel_config} \
328 ARCH_CONFIG=$${arch_config} \
329 MAKEFILES=${SOURCE}/Makefile \
336 # Install for all architectures for all Configuration/Architecture options
343 @TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
344 echo "[ $(SOURCE) ] make build_install $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $${TARGET}"; \
345 ${MAKE} TARGET=$${TARGET} setup_build_install; \
346 kernel_config=$(KERNEL_CONFIG); \
347 for install_subdir in $(INST_SUBDIRS); \
349 $(MKDIR) $${install_subdir}; \
350 ${MAKE} -C $${install_subdir} \
351 KERNEL_CONFIG=$${kernel_config} \
352 MAKEFILES=${SOURCE}/$${install_subdir}/Makefile \
353 SOURCE=${SOURCE}$${install_subdir}/ \
357 ${MAKE} ${MAKEJOBS} TARGET=$${TARGET} do_build_install;
361 # Install source tree
369 # Clean up source tree
374 # Build source file list for cscope database and tags
377 @echo "Building file list for cscope and tags"
378 @find . -name '*.h' -type f > _cscope.files 2> /dev/null
379 @echo bsd/ufs/ufs/ufs_readwrite.c >> _cscope.files 2> /dev/null
380 @for i in `echo ${ALL_SUBDIRS}`; \
382 cat ${SRCROOT}/$${i}/conf/files ${SRCROOT}/$${i}/conf/files.ppc; \
383 cat ${SRCROOT}/$${i}/conf/files.i386; \
385 sed -e '/^#/d' -e '/^[ ]*$$/d' -e '/^OPTIONS\//d' | \
386 sed -e '1,$$s/^\([^ ]*\)[ ].*$$/\1/' >> _cscope.files 2> /dev/null
387 @sort < _cscope.files > cscope.files 2> /dev/null
388 @rm -f _cscope.files 2> /dev/null
391 # Build cscope database
394 @echo "Building cscope database"
395 @cscope -b 2> /dev/null
402 @echo "Building ctags"
403 @-xargs ctags -dtw < cscope.files 2> /dev/null || \
404 echo "Phantom files detected!" 2>&1 > /dev/null
405 @echo "Building etags"
406 @-cat cscope.files | etags -l auto -S - 2> /dev/null
412 @echo "[ $(SRCROOT) ] Installing man pages"; \
413 manpath=$(DSTROOT)/$(MANDIR); \
414 $(MKDIR) $$manpath; \
415 ${MAKE} MAKEFILES=${SOURCE}/Makefile \
423 @echo "[ $(SOURCE) ] make build_installman"; \
424 if [ -n "$(strip $(INSTMAN_SUBDIRS))" ]; then \
425 for installman_subdir in $(INSTMAN_SUBDIRS); do \
426 ${MAKE} -C $${installman_subdir} -r \
427 MAKEFILES=$(SOURCE)$${installman_subdir}/Makefile \
428 SOURCE=$(SOURCE)$${installman_subdir}/ \
429 TARGET=$(TARGET)$${installman_subdir}/ \
433 if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \
434 ${MAKE} ${MAKEJOBS} do_installman; \