2 # Install kernel header files
4 installhdrs: SRCROOT DSTROOT OBJROOT 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 (cd $${installinc_dir}; \
43 ${MAKE} 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 \
52 # Install machine dependent kernel header files
55 @echo "[ $(SOURCE) ] make installhdrs_md "; \
56 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
57 kernel_config=$(INSTALL_TYPE); \
58 for arch_config in $(INSTALL_ARCHS); \
60 $(MKDIR) ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
61 (cd ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
62 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
63 ARCH_CONFIG=$${arch_config} \
64 MAKEFILES=${SOURCE}/Makefile \
66 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
67 build_installhdrs_md \
72 # Install machine independent kernel header files
76 build_installhdrs_mi::
77 @echo "[ $(SOURCE) ] make build_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
78 for installinc_subdir in $(INSTINC_SUBDIRS); \
80 $(MKDIR) $${installinc_subdir}; \
81 (cd $${installinc_subdir}; \
82 ${MAKE} MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
83 SOURCE=$(SOURCE)$${installinc_subdir}/ \
84 TARGET=$(TARGET)$${installinc_subdir}/ \
85 build_installhdrs_mi \
88 ${MAKE} do_installhdrs_mi;
91 # Install machine dependent kernel header files
95 build_installhdrs_md::
96 @echo "[ $(SOURCE) ] make installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
97 for installinc_subdir in $($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG))); \
99 $(MKDIR) $${installinc_subdir}; \
100 (cd $${installinc_subdir}; \
101 ${MAKE} MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
102 SOURCE=$(SOURCE)$${installinc_subdir}/ \
103 TARGET=$(TARGET)$${installinc_subdir}/ \
104 build_installhdrs_md \
107 ${MAKE} do_installhdrs_md;
110 # Install kernel header files
112 exporthdrs: SRCROOT DSTROOT OBJROOT exporthdrs_mi exporthdrs_md
115 # Install header files order
117 .ORDER: exporthdrs_mi exporthdrs_md
120 # Install machine independent header files
125 @echo "[ ${SOURCE} ] make exporthdrs_mi "; \
126 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
127 kernel_config=$(INSTALL_TYPE); \
128 arch_config=$(INSTALL_ARCH_DEFAULT); \
129 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
130 $(MKDIR) $${exportinc_dir}; \
131 (cd $${exportinc_dir}; \
132 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
133 ARCH_CONFIG=$${arch_config} \
134 MAKEFILES=${SOURCE}/Makefile \
136 TARGET=$${exportinc_dir}/ \
137 build_exporthdrs_mi \
141 # Install machine dependent kernel header files
144 @echo "[ $(SOURCE) ] make exporthdrs_md "; \
145 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
146 kernel_config=$(INSTALL_TYPE); \
147 for arch_config in $(ARCH_CONFIGS); \
149 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
150 $(MKDIR) $${exportinc_dir}; \
151 (cd $${exportinc_dir}; \
152 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
153 ARCH_CONFIG=$${arch_config} \
154 MAKEFILES=${SOURCE}/Makefile \
156 TARGET=$${exportinc_dir}/ \
157 build_exporthdrs_md \
162 # Install machine independent kernel header files
167 @echo "[ $(SOURCE) ] make build_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
168 for exportinc_subdir in $(EXPINC_SUBDIRS); \
170 $(MKDIR) $${exportinc_subdir}; \
171 (cd $${exportinc_subdir}; \
172 ${MAKE} MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
173 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
174 TARGET=$(TARGET)$${exportinc_subdir}/ \
175 build_exporthdrs_mi \
178 ${MAKE} do_exporthdrs_mi;
181 # Install machine dependent kernel header files
186 @echo "[ $(SOURCE) ] make exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
187 for exportinc_subdir in $($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG))); \
189 $(MKDIR) $${exportinc_subdir}; \
190 (cd $${exportinc_subdir}; \
191 ${MAKE} MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
192 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
193 TARGET=$(TARGET)$${exportinc_subdir}/ \
194 build_exporthdrs_md \
197 ${MAKE} do_exporthdrs_md;
200 # Setup pass for all architectures for all Configuration/Architecture options
202 setup: SRCROOT DSTROOT OBJROOT
203 @echo "[ $(SOURCE) ] make setup"; \
204 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
205 for kernel_config in $(KERNEL_CONFIGS); \
207 for arch_config in $(ARCH_CONFIGS); \
209 setup_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
210 $(MKDIR) $${setup_subdir}; \
211 (cd $${setup_subdir}; \
212 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
213 ARCH_CONFIG=$${arch_config} \
214 MAKEFILES=${SOURCE}/Makefile \
216 TARGET=$${setup_subdir}/ \
225 @echo "[ $(SOURCE) ] make build_setup $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
226 for setup_subdir in $(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG))); \
228 $(MKDIR) $${setup_subdir}; \
229 (cd $${setup_subdir}; \
230 ${MAKE} MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile \
231 SOURCE=${SOURCE}/$${setup_subdir}/ \
232 TARGET=${TARGET}/$${setup_subdir}/ \
236 ${MAKE} do_build_setup;
240 # Build all architectures for all Configuration/Architecture options
242 all: SRCROOT DSTROOT OBJROOT
243 @echo "[ $(SOURCE) ] make all"; \
244 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
245 for kernel_config in $(KERNEL_CONFIGS); \
247 for arch_config in $(ARCH_CONFIGS); \
249 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
250 $(MKDIR) $${build_subdir}; \
251 (cd $${build_subdir}; \
252 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
253 ARCH_CONFIG=$${arch_config} \
254 MAKEFILES=${SOURCE}/Makefile \
262 # Build all architectures for all Configuration/Architecture options
267 @TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
268 echo "[ $(SOURCE) ] make build_all $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $${TARGET}"; \
269 for comp_subdir in $(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG))); \
271 $(MKDIR) $${comp_subdir}; \
272 (cd $${comp_subdir}; \
273 ${MAKE} MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
274 SOURCE=${SOURCE}$${comp_subdir}/ \
279 ${MAKE} INCL_MAKEDEP=TRUE TARGET=$${TARGET} do_build_all;
282 # Build all architectures for all Configuration/Architecture options
284 mach_kernel: SRCROOT DSTROOT OBJROOT
285 @echo "[ $(SOURCE) ] make mach_kernel"; \
286 for kernel_config in $(KERNEL_CONFIGS); \
288 for arch_config in $(ARCH_CONFIGS); \
290 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}; \
291 $(MKDIR) $${build_subdir}; \
292 (cd $${build_subdir}; \
293 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
294 ARCH_CONFIG=$${arch_config} \
295 MAKEFILES=${SOURCE}/Makefile \
297 TARGET=$${build_subdir}/ \
304 # Build all architectures for all Configuration/Architecture options
306 do_build_mach_kernel:
309 @echo "[ $(SOURCE) ] make build_mach_kernel $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
310 ${MAKE} do_build_mach_kernel;
314 # Install dependencies order
316 .ORDER: SRCROOT DSTROOT OBJROOT SYMROOT installhdrs exporthdrs all
319 # Install kernel based on RC_ARCHS for all INSTALL_TYPES
320 # Install kernel header files based on RC_ARCHS
322 install: SRCROOT DSTROOT OBJROOT SYMROOT installhdrs all
323 @echo "[ $(SOURCE) ] make install"; \
324 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
325 for kernel_config in $(INSTALL_TYPE); \
327 for arch_config in $(INSTALL_ARCHS); \
329 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
330 $(MKDIR) $${install_subdir}; \
331 (cd $${install_subdir}; \
332 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
333 ARCH_CONFIG=$${arch_config} \
334 MAKEFILES=${SOURCE}/Makefile \
342 # Install for all architectures for all Configuration/Architecture options
349 @TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
350 echo "[ $(SOURCE) ] make build_install $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $${TARGET}"; \
351 ${MAKE} TARGET=$${TARGET} setup_build_install; \
352 kernel_config=$(KERNEL_CONFIG); \
353 for install_subdir in $(INST_SUBDIRS); \
355 $(MKDIR) $${install_subdir}; \
356 (cd $${install_subdir}; \
357 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
358 MAKEFILES=${SOURCE}/$${install_subdir}/Makefile \
359 SOURCE=${SOURCE}$${install_subdir}/ \
364 ${MAKE} TARGET=$${TARGET} do_build_install;
368 # Install source tree
376 # Clean up source tree
381 # Build source file list for cscope database and tags
384 @echo "Building file list for cscope and tags"
385 @find . -name '*.h' -type f > _cscope.files 2> /dev/null
386 @echo bsd/ufs/ufs/ufs_readwrite.c >> _cscope.files 2> /dev/null
387 @for i in `echo ${ALL_SUBDIRS}`; \
389 cat ${SRCROOT}/$${i}/conf/files ${SRCROOT}/$${i}/conf/files.ppc; \
390 cat ${SRCROOT}/$${i}/conf/files.i386; \
392 sed -e '/^#/d' -e '/^[ ]*$$/d' -e '/^OPTIONS\//d' | \
393 sed -e '1,$$s/^\([^ ]*\)[ ].*$$/\1/' >> _cscope.files 2> /dev/null
394 @sort < _cscope.files > cscope.files 2> /dev/null
395 @rm -f _cscope.files 2> /dev/null
398 # Build cscope database
401 @echo "Building cscope database"
402 @cscope -b 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
416 SRCROOT DSTROOT OBJROOT SYMROOT: ALWAYS
417 @if [ -n "${$@}" ]; \
421 echo Must define $@; \