]> git.saurik.com Git - apple/xnu.git/blob - makedefs/MakeInc.dir
efa1cd788d24259c6f4fa8b00aaf8fab70b457ce
[apple/xnu.git] / makedefs / MakeInc.dir
1 #
2 # Install kernel header files
3 #
4 installhdrs: exporthdrs installhdrs_mi installhdrs_md
5 @echo "[ $(SRCROOT) ] make installhdrs installing Kernel.framework"; \
6 kincpath=$(DSTROOT)/$(KINCDIR); \
7 kframepath=$(DSTROOT)/$(KINCFRAME); \
8 $(MKDIR) $$kincpath; \
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 ; \
14 ) fi \
15 done; \
16 cd $(SRCROOT)/EXTERNAL_HEADERS; \
17 pax -ruw -s '/.*CVS.*//' . $$kincpath || true; \
18 cd $$kframepath/Versions; \
19 [ -L Current ] || $(LN) $(KINCVERS) Current; \
20 cd $$kframepath; \
21 [ -L Headers ] || $(LN) Versions/Current/Headers Headers; \
22 find $$kframepath -type f | xargs -s 32000 chmod a-w
23
24 #
25 # Install header files order
26 #
27 .ORDER: installhdrs_mi installhdrs_md
28
29 #
30 # Install machine independent header files
31 #
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 \
43 SOURCE=${SOURCE}/ \
44 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
45 build_installhdrs_mi \
46 );
47
48 #
49 # Install machine dependent kernel header files
50 #
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); \
56 do \
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 \
62 SOURCE=${SOURCE}/ \
63 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
64 build_installhdrs_md \
65 ); \
66 done;
67
68 #
69 # Install machine independent kernel header files
70 #
71 do_installhdrs_mi:
72
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); \
78 do \
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 \
87 ); \
88 done; \
89 ${MAKE} do_installhdrs_mi;
90
91 #
92 # Install machine dependent kernel header files
93 #
94 do_installhdrs_md:
95
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))); \
101 do \
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 \
110 ); \
111 done; \
112 ${MAKE} do_installhdrs_md;
113
114 #
115 # Install kernel header files
116 #
117 exporthdrs: exporthdrs_mi exporthdrs_md
118
119 #
120 # Install header files order
121 #
122 .ORDER: exporthdrs_mi exporthdrs_md
123
124 #
125 # Install machine independent header files
126 #
127 do_exporthdrs_mi:
128
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 \
140 SOURCE=${SOURCE}/ \
141 TARGET=$${exportinc_dir}/ \
142 build_exporthdrs_mi \
143 );
144
145 #
146 # Install machine dependent kernel header files
147 #
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); \
153 do \
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 \
160 SOURCE=${SOURCE}/ \
161 TARGET=$${exportinc_dir}/ \
162 build_exporthdrs_md \
163 ); \
164 done;
165
166 #
167 # Install machine independent kernel header files
168 #
169 do_exporthdrs_mi:
170
171 build_exporthdrs_mi:
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); \
176 do \
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 \
185 ); \
186 done; \
187 ${MAKE} do_exporthdrs_mi;
188
189 #
190 # Install machine dependent kernel header files
191 #
192 do_exporthdrs_md:
193
194 build_exporthdrs_md:
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))); \
199 do \
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 \
208 ); \
209 done; \
210 ${MAKE} do_exporthdrs_md;
211
212 #
213 # Setup pass for all architectures for all Configuration/Architecture options
214 #
215 setup: SRCROOT DSTROOT OBJROOT
216 @echo "[ $(SOURCE) ] make setup"; \
217 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
218 for kernel_config in $(KERNEL_CONFIGS); \
219 do \
220 for arch_config in $(ARCH_CONFIGS); \
221 do \
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 \
228 SOURCE=${SOURCE}/ \
229 TARGET=$${setup_subdir}/ \
230 build_setup \
231 ); \
232 done; \
233 done;
234
235 do_build_setup:
236
237 build_setup:
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))); \
242 do \
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}/ \
250 build_setup \
251 ); \
252 done; \
253 ${MAKE} do_build_setup;
254
255
256 #
257 # Build all architectures for all Configuration/Architecture options
258 #
259 all: SRCROOT DSTROOT OBJROOT
260 @echo "[ $(SOURCE) ] make all"; \
261 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
262 for kernel_config in $(KERNEL_CONFIGS); \
263 do \
264 for arch_config in $(ARCH_CONFIGS); \
265 do \
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 \
274 SOURCE=${SOURCE}/ \
275 TARGET=$${target_subdir}/ \
276 build_all \
277 ); \
278 done; \
279 done;
280
281 #
282 # Build all architectures for all Configuration/Architecture options
283 #
284 do_build_all:
285
286 build_all:
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))); \
291 do \
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} \
300 build_all \
301 ); \
302 done; \
303 ${MAKE} do_build_all;
304
305 #
306 # Build all architectures for all Configuration/Architecture options
307 #
308 mach_kernel: SRCROOT DSTROOT OBJROOT
309 @echo "[ $(SOURCE) ] make mach_kernel"; \
310 for kernel_config in $(KERNEL_CONFIGS); \
311 do \
312 for arch_config in $(ARCH_CONFIGS); \
313 do \
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 \
320 SOURCE=${SOURCE}/ \
321 TARGET=$${build_subdir}/ \
322 build_mach_kernel \
323 ); \
324 done; \
325 done;
326
327 #
328 # Build all architectures for all Configuration/Architecture options
329 #
330 do_build_mach_kernel:
331
332 build_mach_kernel:
333 @echo "[ $(SOURCE) ] make build_mach_kernel $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
334 ${MAKE} do_build_mach_kernel;
335
336 #
337 #
338 # Install dependencies order
339 #
340 .ORDER: SRCROOT DSTROOT OBJROOT SYMROOT installhdrs exporthdrs all
341
342 #
343 # Install kernel based on RC_ARCHS for all INSTALL_TYPES
344 # Install kernel header files based on RC_ARCHS
345 #
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); \
350 do \
351 for arch_config in $(INSTALL_ARCHS); \
352 do \
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 \
361 SOURCE=${SOURCE}/ \
362 TARGET=$${target_subdir}/ \
363 build_install \
364 ); \
365 done; \
366 done;
367
368 #
369 # Install for all architectures for all Configuration/Architecture options
370 #
371 setup_build_install:
372
373 do_build_install:
374
375 build_install:
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); \
381 do \
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} \
390 build_install \
391 ); \
392 done; \
393 ${MAKE} do_build_install;
394
395
396 #
397 # Install source tree
398 #
399 installsrc: SRCROOT
400 pax -rw . ${SRCROOT}
401
402
403
404 #
405 # Clean up source tree
406 #
407 clean: SRCROOT
408
409 #
410 # Build source file list for cscope database and tags
411 #
412 cscope.files:
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}`; \
417 do \
418 cat ${SRCROOT}/$${i}/conf/files ${SRCROOT}/$${i}/conf/files.ppc; \
419 cat ${SRCROOT}/$${i}/conf/files.i386; \
420 done | \
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
425
426 #
427 # Build cscope database
428 #
429 cscope: cscope.files
430 @echo "Building cscope database"
431 @cscope -b 2> /dev/null
432
433 #
434 # Build tags
435 #
436
437 tags: cscope.files
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
443
444
445 SRCROOT DSTROOT OBJROOT SYMROOT: ALWAYS
446 @if [ -n "${$@}" ]; \
447 then \
448 exit 0; \
449 else \
450 echo Must define $@; \
451 exit 1; \
452 fi
453
454 ALWAYS:
455