]> git.saurik.com Git - apple/xnu.git/blob - makedefs/MakeInc.dir
xnu-201.14.tar.gz
[apple/xnu.git] / makedefs / MakeInc.dir
1 #
2 # Install kernel header files
3 #
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); \
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 $(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
26
27 #
28 # Install header files order
29 #
30 .ORDER: installhdrs_mi installhdrs_md
31
32 #
33 # Install machine independent header files
34 #
35 installhdrs_mi:
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 \
46 SOURCE=${SOURCE}/ \
47 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
48 build_installhdrs_mi \
49 );
50
51 #
52 # Install machine dependent kernel header files
53 #
54 installhdrs_md:
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); \
59 do \
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 \
65 SOURCE=${SOURCE}/ \
66 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
67 build_installhdrs_md \
68 ); \
69 done;
70
71 #
72 # Install machine independent kernel header files
73 #
74 do_installhdrs_mi:
75
76 build_installhdrs_mi::
77 @echo "[ $(SOURCE) ] make build_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
78 for installinc_subdir in $(INSTINC_SUBDIRS); \
79 do \
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 \
86 ); \
87 done; \
88 ${MAKE} do_installhdrs_mi;
89
90 #
91 # Install machine dependent kernel header files
92 #
93 do_installhdrs_md:
94
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))); \
98 do \
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 \
105 ); \
106 done; \
107 ${MAKE} do_installhdrs_md;
108
109 #
110 # Install kernel header files
111 #
112 exporthdrs: SRCROOT DSTROOT OBJROOT exporthdrs_mi exporthdrs_md
113
114 #
115 # Install header files order
116 #
117 .ORDER: exporthdrs_mi exporthdrs_md
118
119 #
120 # Install machine independent header files
121 #
122 do_exporthdrs_mi:
123
124 exporthdrs_mi:
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 \
135 SOURCE=${SOURCE}/ \
136 TARGET=$${exportinc_dir}/ \
137 build_exporthdrs_mi \
138 );
139
140 #
141 # Install machine dependent kernel header files
142 #
143 exporthdrs_md:
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); \
148 do \
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 \
155 SOURCE=${SOURCE}/ \
156 TARGET=$${exportinc_dir}/ \
157 build_exporthdrs_md \
158 ); \
159 done;
160
161 #
162 # Install machine independent kernel header files
163 #
164 do_exporthdrs_mi:
165
166 build_exporthdrs_mi:
167 @echo "[ $(SOURCE) ] make build_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
168 for exportinc_subdir in $(EXPINC_SUBDIRS); \
169 do \
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 \
176 ); \
177 done; \
178 ${MAKE} do_exporthdrs_mi;
179
180 #
181 # Install machine dependent kernel header files
182 #
183 do_exporthdrs_md:
184
185 build_exporthdrs_md:
186 @echo "[ $(SOURCE) ] make exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
187 for exportinc_subdir in $($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG))); \
188 do \
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 \
195 ); \
196 done; \
197 ${MAKE} do_exporthdrs_md;
198
199 #
200 # Setup pass for all architectures for all Configuration/Architecture options
201 #
202 setup: SRCROOT DSTROOT OBJROOT
203 @echo "[ $(SOURCE) ] make setup"; \
204 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
205 for kernel_config in $(KERNEL_CONFIGS); \
206 do \
207 for arch_config in $(ARCH_CONFIGS); \
208 do \
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 \
215 SOURCE=${SOURCE}/ \
216 TARGET=$${setup_subdir}/ \
217 build_setup \
218 ); \
219 done; \
220 done;
221
222 do_build_setup:
223
224 build_setup:
225 @echo "[ $(SOURCE) ] make build_setup $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
226 for setup_subdir in $(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG))); \
227 do \
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}/ \
233 build_setup \
234 ); \
235 done; \
236 ${MAKE} do_build_setup;
237
238
239 #
240 # Build all architectures for all Configuration/Architecture options
241 #
242 all: SRCROOT DSTROOT OBJROOT
243 @echo "[ $(SOURCE) ] make all"; \
244 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
245 for kernel_config in $(KERNEL_CONFIGS); \
246 do \
247 for arch_config in $(ARCH_CONFIGS); \
248 do \
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 \
255 SOURCE=${SOURCE}/ \
256 build_all \
257 ); \
258 done; \
259 done;
260
261 #
262 # Build all architectures for all Configuration/Architecture options
263 #
264 do_build_all:
265
266 build_all:
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))); \
270 do \
271 $(MKDIR) $${comp_subdir}; \
272 (cd $${comp_subdir}; \
273 ${MAKE} MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
274 SOURCE=${SOURCE}$${comp_subdir}/ \
275 TARGET=$${TARGET} \
276 build_all \
277 ); \
278 done; \
279 ${MAKE} INCL_MAKEDEP=TRUE TARGET=$${TARGET} do_build_all;
280
281 #
282 # Build all architectures for all Configuration/Architecture options
283 #
284 mach_kernel: SRCROOT DSTROOT OBJROOT
285 @echo "[ $(SOURCE) ] make mach_kernel"; \
286 for kernel_config in $(KERNEL_CONFIGS); \
287 do \
288 for arch_config in $(ARCH_CONFIGS); \
289 do \
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 \
296 SOURCE=${SOURCE}/ \
297 TARGET=$${build_subdir}/ \
298 build_mach_kernel \
299 ); \
300 done; \
301 done;
302
303 #
304 # Build all architectures for all Configuration/Architecture options
305 #
306 do_build_mach_kernel:
307
308 build_mach_kernel:
309 @echo "[ $(SOURCE) ] make build_mach_kernel $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
310 ${MAKE} do_build_mach_kernel;
311
312 #
313 #
314 # Install dependencies order
315 #
316 .ORDER: SRCROOT DSTROOT OBJROOT SYMROOT installhdrs exporthdrs all
317
318 #
319 # Install kernel based on RC_ARCHS for all INSTALL_TYPES
320 # Install kernel header files based on RC_ARCHS
321 #
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); \
326 do \
327 for arch_config in $(INSTALL_ARCHS); \
328 do \
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 \
335 SOURCE=${SOURCE}/ \
336 build_install \
337 ); \
338 done; \
339 done;
340
341 #
342 # Install for all architectures for all Configuration/Architecture options
343 #
344 setup_build_install:
345
346 do_build_install:
347
348 build_install:
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); \
354 do \
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}/ \
360 TARGET=$${TARGET} \
361 build_install \
362 ); \
363 done; \
364 ${MAKE} TARGET=$${TARGET} do_build_install;
365
366
367 #
368 # Install source tree
369 #
370 installsrc: SRCROOT
371 pax -rw . ${SRCROOT}
372
373
374
375 #
376 # Clean up source tree
377 #
378 clean: SRCROOT
379
380 #
381 # Build source file list for cscope database and tags
382 #
383 cscope.files:
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}`; \
388 do \
389 cat ${SRCROOT}/$${i}/conf/files ${SRCROOT}/$${i}/conf/files.ppc; \
390 cat ${SRCROOT}/$${i}/conf/files.i386; \
391 done | \
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
396
397 #
398 # Build cscope database
399 #
400 cscope: cscope.files
401 @echo "Building cscope database"
402 @cscope -b 2> /dev/null
403
404 #
405 # Build tags
406 #
407
408 tags: cscope.files
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
414
415
416 SRCROOT DSTROOT OBJROOT SYMROOT: ALWAYS
417 @if [ -n "${$@}" ]; \
418 then \
419 exit 0; \
420 else \
421 echo Must define $@; \
422 exit 1; \
423 fi
424
425 ALWAYS:
426