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 find $$kframepath -type f | xargs -s 32000 chmod a-w
25 # Install header files order
27 .ORDER: installhdrs_mi installhdrs_md
30 # Install machine independent header files
32 installhdrs_mi: SRCROOT DSTROOT OBJROOT
33 @echo "[ $(SOURCE) ] make installhdrs_mi "; \
34 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
35 kernel_config=$(INSTALL_TYPE); \
36 arch_config=$(INSTALL_ARCH_DEFAULT); \
37 installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
38 $(MKDIR) $${installinc_dir}; \
39 (cd $${installinc_dir}; \
40 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
41 ARCH_CONFIG=$${arch_config} \
42 MAKEFILES=${SOURCE}/Makefile \
44 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
45 build_installhdrs_mi \
49 # Install machine dependent kernel header files
51 installhdrs_md: SRCROOT DSTROOT OBJROOT
52 @echo "[ $(SOURCE) ] make installhdrs_md "; \
53 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
54 kernel_config=$(INSTALL_TYPE); \
55 for arch_config in $(INSTALL_ARCHS); \
57 $(MKDIR) ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
58 (cd ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
59 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
60 ARCH_CONFIG=$${arch_config} \
61 MAKEFILES=${SOURCE}/Makefile \
63 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
64 build_installhdrs_md \
69 # Install machine independent kernel header files
73 build_installhdrs_mi::
74 @echo "[ $(SOURCE) ] make build_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
75 kernel_config=$(INSTALL_TYPE); \
76 arch_config=$(ARCH_CONFIG); \
77 for installinc_subdir in $(INSTINC_SUBDIRS); \
79 $(MKDIR) $${installinc_subdir}; \
80 (cd $${installinc_subdir}; \
81 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
82 ARCH_CONFIG=$${arch_config} \
83 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
84 SOURCE=$(SOURCE)$${installinc_subdir}/ \
85 TARGET=$(TARGET)$${installinc_subdir}/ \
86 build_installhdrs_mi \
89 ${MAKE} do_installhdrs_mi;
92 # Install machine dependent kernel header files
96 build_installhdrs_md::
97 @echo "[ $(SOURCE) ] make installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
98 kernel_config=$(KERNEL_CONFIG); \
99 arch_config=$(ARCH_CONFIG); \
100 for installinc_subdir in $($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG))); \
102 $(MKDIR) $${installinc_subdir}; \
103 (cd $${installinc_subdir}; \
104 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
105 ARCH_CONFIG=$${arch_config} \
106 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
107 SOURCE=$(SOURCE)$${installinc_subdir}/ \
108 TARGET=$(TARGET)$${installinc_subdir}/ \
109 build_installhdrs_md \
112 ${MAKE} do_installhdrs_md;
115 # Install kernel header files
117 exporthdrs: exporthdrs_mi exporthdrs_md
120 # Install header files order
122 .ORDER: exporthdrs_mi exporthdrs_md
125 # Install machine independent header files
129 exporthdrs_mi: SRCROOT DSTROOT OBJROOT
130 @echo "[ ${SOURCE} ] make exporthdrs_mi "; \
131 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 $(MKDIR) $${exportinc_dir}; \
136 (cd $${exportinc_dir}; \
137 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
138 ARCH_CONFIG=$${arch_config} \
139 MAKEFILES=${SOURCE}/Makefile \
141 TARGET=$${exportinc_dir}/ \
142 build_exporthdrs_mi \
146 # Install machine dependent kernel header files
148 exporthdrs_md: SRCROOT DSTROOT OBJROOT
149 @echo "[ $(SOURCE) ] make exporthdrs_md "; \
150 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
151 kernel_config=$(INSTALL_TYPE); \
152 for arch_config in $(ARCH_CONFIGS); \
154 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
155 $(MKDIR) $${exportinc_dir}; \
156 (cd $${exportinc_dir}; \
157 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
158 ARCH_CONFIG=$${arch_config} \
159 MAKEFILES=${SOURCE}/Makefile \
161 TARGET=$${exportinc_dir}/ \
162 build_exporthdrs_md \
167 # Install machine independent kernel header files
172 @echo "[ $(SOURCE) ] make build_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
173 kernel_config=$(INSTALL_TYPE); \
174 arch_config=$(ARCH_CONFIG); \
175 for exportinc_subdir in $(EXPINC_SUBDIRS); \
177 $(MKDIR) $${exportinc_subdir}; \
178 (cd $${exportinc_subdir}; \
179 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
180 ARCH_CONFIG=$${arch_config} \
181 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
182 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
183 TARGET=$(TARGET)$${exportinc_subdir}/ \
184 build_exporthdrs_mi \
187 ${MAKE} do_exporthdrs_mi;
190 # Install machine dependent kernel header files
195 @echo "[ $(SOURCE) ] make exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
196 kernel_config=$(KERNEL_CONFIG); \
197 arch_config=$(ARCH_CONFIG); \
198 for exportinc_subdir in $($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG))); \
200 $(MKDIR) $${exportinc_subdir}; \
201 (cd $${exportinc_subdir}; \
202 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
203 ARCH_CONFIG=$${arch_config} \
204 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
205 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
206 TARGET=$(TARGET)$${exportinc_subdir}/ \
207 build_exporthdrs_md \
210 ${MAKE} do_exporthdrs_md;
213 # Setup pass for all architectures for all Configuration/Architecture options
215 setup: SRCROOT DSTROOT OBJROOT
216 @echo "[ $(SOURCE) ] make setup"; \
217 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
218 for kernel_config in $(KERNEL_CONFIGS); \
220 for arch_config in $(ARCH_CONFIGS); \
222 setup_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
223 $(MKDIR) $${setup_subdir}; \
224 (cd $${setup_subdir}; \
225 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
226 ARCH_CONFIG=$${arch_config} \
227 MAKEFILES=${SOURCE}/Makefile \
229 TARGET=$${setup_subdir}/ \
238 @echo "[ $(SOURCE) ] make build_setup $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
239 kernel_config=$(KERNEL_CONFIG); \
240 arch_config=$(ARCH_CONFIG); \
241 for setup_subdir in $(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG))); \
243 $(MKDIR) $${setup_subdir}; \
244 (cd $${setup_subdir}; \
245 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
246 ARCH_CONFIG=$${arch_config} \
247 MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile \
248 SOURCE=${SOURCE}/$${setup_subdir}/ \
249 TARGET=${TARGET}/$${setup_subdir}/ \
253 ${MAKE} do_build_setup;
257 # Build all architectures for all Configuration/Architecture options
259 all: SRCROOT DSTROOT OBJROOT
260 @echo "[ $(SOURCE) ] make all"; \
261 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
262 for kernel_config in $(KERNEL_CONFIGS); \
264 for arch_config in $(ARCH_CONFIGS); \
266 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
267 $(MKDIR) $${build_subdir}; \
268 (cd $${build_subdir}; \
269 new_component=$(firstword $(subst /, ,$(subst $(shell $(RELPATH) -d / $(SRCROOT) $(SRCROOT)),,$(addprefix $(shell $(RELPATH) -d / $(SOURCE) $(SOURCE))/,$${rel_path}))));\
270 target_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${new_component}; \
271 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
272 ARCH_CONFIG=$${arch_config} \
273 MAKEFILES=${SOURCE}/Makefile \
275 TARGET=$${target_subdir}/ \
282 # Build all architectures for all Configuration/Architecture options
287 @echo "[ $(SOURCE) ] make build_all $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
288 kernel_config=$(KERNEL_CONFIG); \
289 arch_config=$(ARCH_CONFIG); \
290 for comp_subdir in $(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG))); \
292 $(MKDIR) $${comp_subdir}; \
293 (cd $${comp_subdir}; \
294 new_component=$(firstword $(subst /, ,$(subst $(shell $(RELPATH) -d / $(SRCROOT) $(SRCROOT)),,$(addprefix $(shell $(RELPATH) -d / $(SOURCE) $(SOURCE))/, $${comp_subdir}))));\
295 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
296 ARCH_CONFIG=$${arch_config} \
297 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
298 SOURCE=${SOURCE}$${comp_subdir}/ \
299 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${new_component} \
303 ${MAKE} do_build_all;
306 # Build all architectures for all Configuration/Architecture options
308 mach_kernel: SRCROOT DSTROOT OBJROOT
309 @echo "[ $(SOURCE) ] make mach_kernel"; \
310 for kernel_config in $(KERNEL_CONFIGS); \
312 for arch_config in $(ARCH_CONFIGS); \
314 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}; \
315 $(MKDIR) $${build_subdir}; \
316 (cd $${build_subdir}; \
317 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
318 ARCH_CONFIG=$${arch_config} \
319 MAKEFILES=${SOURCE}/Makefile \
321 TARGET=$${build_subdir}/ \
328 # Build all architectures for all Configuration/Architecture options
330 do_build_mach_kernel:
333 @echo "[ $(SOURCE) ] make build_mach_kernel $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
334 ${MAKE} do_build_mach_kernel;
338 # Install dependencies order
340 .ORDER: SRCROOT DSTROOT OBJROOT SYMROOT installhdrs exporthdrs all
343 # Install kernel based on RC_ARCHS for all INSTALL_TYPES
344 # Install kernel header files based on RC_ARCHS
346 install: SRCROOT DSTROOT OBJROOT SYMROOT installhdrs all
347 @echo "[ $(SOURCE) ] make install"; \
348 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
349 for kernel_config in $(INSTALL_TYPE); \
351 for arch_config in $(INSTALL_ARCHS); \
353 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
354 $(MKDIR) $${install_subdir}; \
355 (cd $${install_subdir}; \
356 new_component=$(firstword $(subst /, ,$(subst $(shell $(RELPATH) -d / $(SRCROOT) $(SRCROOT)),,$(addprefix $(shell $(RELPATH) -d / $(SOURCE) $(SOURCE))/,$${rel_path}))));\
357 target_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${new_component}; \
358 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
359 ARCH_CONFIG=$${arch_config} \
360 MAKEFILES=${SOURCE}/Makefile \
362 TARGET=$${target_subdir}/ \
369 # Install for all architectures for all Configuration/Architecture options
376 @echo "[ $(SOURCE) ] make build_install $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
377 ${MAKE} setup_build_install; \
378 kernel_config=$(KERNEL_CONFIG); \
379 arch_config=$(ARCH_CONFIG); \
380 for install_subdir in $(INST_SUBDIRS); \
382 $(MKDIR) $${install_subdir}; \
383 (cd $${install_subdir}; \
384 new_component=$(firstword $(subst /, ,$(subst $(shell $(RELPATH) -d / $(SRCROOT) $(SRCROOT)),,$(addprefix $(shell $(RELPATH) -d / $(SOURCE) $(SOURCE))/, $${comp_subdir}))));\
385 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
386 ARCH_CONFIG=$${arch_config} \
387 MAKEFILES=${SOURCE}/$${install_subdir}/Makefile \
388 SOURCE=${SOURCE}$${install_subdir}/ \
389 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${new_component} \
393 ${MAKE} do_build_install;
397 # Install source tree
405 # Clean up source tree
410 # Build source file list for cscope database and tags
413 @echo "Building file list for cscope and tags"
414 @find . -name '*.h' -type f > _cscope.files 2> /dev/null
415 @echo bsd/ufs/ufs/ufs_readwrite.c >> _cscope.files 2> /dev/null
416 @for i in `echo ${ALL_SUBDIRS}`; \
418 cat ${SRCROOT}/$${i}/conf/files ${SRCROOT}/$${i}/conf/files.ppc; \
419 cat ${SRCROOT}/$${i}/conf/files.i386; \
421 sed -e '/^#/d' -e '/^[ ]*$$/d' -e '/^OPTIONS\//d' | \
422 sed -e '1,$$s/^\([^ ]*\)[ ].*$$/\1/' >> _cscope.files 2> /dev/null
423 @sort < _cscope.files > cscope.files 2> /dev/null
424 @rm -f _cscope.files 2> /dev/null
427 # Build cscope database
430 @echo "Building cscope database"
431 @cscope -b 2> /dev/null
438 @echo "Building ctags"
439 @-xargs ctags -dtw < cscope.files 2> /dev/null || \
440 echo "Phantom files detected!" 2>&1 > /dev/null
441 @echo "Building etags"
442 @-cat cscope.files | etags -l auto -S - 2> /dev/null
445 SRCROOT DSTROOT OBJROOT SYMROOT: ALWAYS
446 @if [ -n "${$@}" ]; \
450 echo Must define $@; \