]> git.saurik.com Git - apple/xnu.git/blame - makedefs/MakeInc.dir
xnu-517.tar.gz
[apple/xnu.git] / makedefs / MakeInc.dir
CommitLineData
1c79356b
A
1#
2# Install kernel header files
3#
9bccf70c 4installhdrs: exporthdrs installhdrs_mi installhdrs_md
1c79356b
A
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; \
0b4e3aa0
A
22 $(MKDIR) $(DSTROOT)/$(KPINCDIR); \
23 cd $$kframepath; [ -L PrivateHeaders ] || \
24 $(LN) Versions/Current/PrivateHeaders PrivateHeaders; \
1c79356b
A
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#
0b4e3aa0 35installhdrs_mi:
1c79356b
A
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}; \
9bccf70c
A
42 ${MAKE} -C $${installinc_dir} \
43 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
44 ARCH_CONFIG=$${arch_config} \
45 MAKEFILES=${SOURCE}/Makefile \
46 SOURCE=${SOURCE}/ \
47 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
9bccf70c 48 build_installhdrs_mi; \
1c79356b
A
49
50#
51# Install machine dependent kernel header files
52#
0b4e3aa0 53installhdrs_md:
1c79356b
A
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); \
58 do \
59 $(MKDIR) ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
9bccf70c
A
60 ${MAKE} -C ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path} \
61 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
62 ARCH_CONFIG=$${arch_config} \
63 MAKEFILES=${SOURCE}/Makefile \
64 SOURCE=${SOURCE}/ \
65 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
9bccf70c 66 build_installhdrs_md; \
1c79356b
A
67 done;
68
69#
70# Install machine independent kernel header files
71#
72do_installhdrs_mi:
73
74build_installhdrs_mi::
75 @echo "[ $(SOURCE) ] make build_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
1c79356b
A
76 for installinc_subdir in $(INSTINC_SUBDIRS); \
77 do \
78 $(MKDIR) $${installinc_subdir}; \
9bccf70c
A
79 ${MAKE} -C $${installinc_subdir} \
80 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
1c79356b
A
81 SOURCE=$(SOURCE)$${installinc_subdir}/ \
82 TARGET=$(TARGET)$${installinc_subdir}/ \
9bccf70c 83 build_installhdrs_mi; \
1c79356b 84 done; \
9bccf70c 85 ${MAKE} ${MAKEJOBS} do_installhdrs_mi;
1c79356b
A
86
87#
88# Install machine dependent kernel header files
89#
90do_installhdrs_md:
91
92build_installhdrs_md::
93 @echo "[ $(SOURCE) ] make installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
1c79356b
A
94 for installinc_subdir in $($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG))); \
95 do \
96 $(MKDIR) $${installinc_subdir}; \
9bccf70c
A
97 ${MAKE} -C $${installinc_subdir} \
98 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
1c79356b
A
99 SOURCE=$(SOURCE)$${installinc_subdir}/ \
100 TARGET=$(TARGET)$${installinc_subdir}/ \
9bccf70c 101 build_installhdrs_md; \
1c79356b 102 done; \
9bccf70c 103 ${MAKE} ${MAKEJOBS} do_installhdrs_md;
1c79356b
A
104
105#
106# Install kernel header files
107#
9bccf70c 108exporthdrs: exporthdrs_mi exporthdrs_md
1c79356b
A
109
110#
111# Install header files order
112#
113.ORDER: exporthdrs_mi exporthdrs_md
114
115#
116# Install machine independent header files
117#
118do_exporthdrs_mi:
119
0b4e3aa0 120exporthdrs_mi:
1c79356b
A
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}; \
9bccf70c
A
127 ${MAKE} -C $${exportinc_dir} \
128 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
129 ARCH_CONFIG=$${arch_config} \
130 MAKEFILES=${SOURCE}/Makefile \
131 SOURCE=${SOURCE}/ \
132 TARGET=$${exportinc_dir}/ \
9bccf70c 133 build_exporthdrs_mi; \
1c79356b
A
134
135#
136# Install machine dependent kernel header files
137#
0b4e3aa0 138exporthdrs_md:
1c79356b
A
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); \
143 do \
144 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
145 $(MKDIR) $${exportinc_dir}; \
9bccf70c
A
146 ${MAKE} -C $${exportinc_dir} \
147 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
148 ARCH_CONFIG=$${arch_config} \
149 MAKEFILES=${SOURCE}/Makefile \
150 SOURCE=${SOURCE}/ \
151 TARGET=$${exportinc_dir}/ \
9bccf70c 152 build_exporthdrs_md; \
1c79356b
A
153 done;
154
155#
156# Install machine independent kernel header files
157#
158do_exporthdrs_mi:
159
160build_exporthdrs_mi:
161 @echo "[ $(SOURCE) ] make build_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
9bccf70c
A
162 _TMP_EXPINC_SUBDIRS="$(EXPINC_SUBDIRS)"; \
163 for exportinc_subdir in $${_TMP_EXPINC_SUBDIRS}; \
1c79356b
A
164 do \
165 $(MKDIR) $${exportinc_subdir}; \
9bccf70c
A
166 ${MAKE} -C $${exportinc_subdir} \
167 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
1c79356b
A
168 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
169 TARGET=$(TARGET)$${exportinc_subdir}/ \
9bccf70c 170 build_exporthdrs_mi; \
1c79356b 171 done; \
9bccf70c 172 ${MAKE} ${MAKEJOBS} do_exporthdrs_mi;
1c79356b
A
173
174#
175# Install machine dependent kernel header files
176#
177do_exporthdrs_md:
178
179build_exporthdrs_md:
180 @echo "[ $(SOURCE) ] make exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
9bccf70c
A
181 _TMP_exportinc_subdir="$($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG)))"; \
182 for exportinc_subdir in $${_TMP_exportinc_subdir}; \
1c79356b
A
183 do \
184 $(MKDIR) $${exportinc_subdir}; \
9bccf70c
A
185 ${MAKE} -C $${exportinc_subdir} \
186 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
1c79356b
A
187 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
188 TARGET=$(TARGET)$${exportinc_subdir}/ \
9bccf70c 189 build_exporthdrs_md; \
1c79356b 190 done; \
9bccf70c 191 ${MAKE} ${MAKEJOBS} do_exporthdrs_md;
1c79356b
A
192
193#
194# Setup pass for all architectures for all Configuration/Architecture options
195#
9bccf70c 196setup:
1c79356b
A
197 @echo "[ $(SOURCE) ] make setup"; \
198 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
199 for kernel_config in $(KERNEL_CONFIGS); \
200 do \
201 for arch_config in $(ARCH_CONFIGS); \
202 do \
203 setup_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
204 $(MKDIR) $${setup_subdir}; \
9bccf70c
A
205 ${MAKE} -C $${setup_subdir} \
206 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
207 ARCH_CONFIG=$${arch_config} \
208 MAKEFILES=${SOURCE}/Makefile \
209 SOURCE=${SOURCE}/ \
210 TARGET=$${setup_subdir}/ \
9bccf70c 211 build_setup; \
1c79356b
A
212 done; \
213 done;
214
215do_build_setup:
216
217build_setup:
218 @echo "[ $(SOURCE) ] make build_setup $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
9bccf70c
A
219 _TMP_setup_subdir="$(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG)))"; \
220 for setup_subdir in $${_TMP_setup_subdir}; \
1c79356b
A
221 do \
222 $(MKDIR) $${setup_subdir}; \
9bccf70c
A
223 ${MAKE} -C $${setup_subdir} \
224 MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile \
1c79356b
A
225 SOURCE=${SOURCE}/$${setup_subdir}/ \
226 TARGET=${TARGET}/$${setup_subdir}/ \
9bccf70c 227 build_setup; \
1c79356b
A
228 done; \
229 ${MAKE} do_build_setup;
230
231
232#
233# Build all architectures for all Configuration/Architecture options
234#
9bccf70c
A
235ifeq ($(COMPONENT), .)
236all: exporthdrs
237else
238all:
239endif
1c79356b
A
240 @echo "[ $(SOURCE) ] make all"; \
241 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
242 for kernel_config in $(KERNEL_CONFIGS); \
243 do \
244 for arch_config in $(ARCH_CONFIGS); \
245 do \
246 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
247 $(MKDIR) $${build_subdir}; \
9bccf70c
A
248 ${MAKE} -C $${build_subdir} \
249 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
250 ARCH_CONFIG=$${arch_config} \
251 MAKEFILES=${SOURCE}/Makefile \
252 SOURCE=${SOURCE}/ \
9bccf70c 253 build_all; \
1c79356b
A
254 done; \
255 done;
256
257#
258# Build all architectures for all Configuration/Architecture options
259#
260do_build_all:
261
262build_all:
0b4e3aa0
A
263 @TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
264 echo "[ $(SOURCE) ] make build_all $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $${TARGET}"; \
9bccf70c
A
265 _TMP_comp_subdir="$(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG)))"; \
266 for comp_subdir in $${_TMP_comp_subdir}; \
1c79356b
A
267 do \
268 $(MKDIR) $${comp_subdir}; \
9bccf70c
A
269 ${MAKE} -C $${comp_subdir} \
270 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
1c79356b 271 SOURCE=${SOURCE}$${comp_subdir}/ \
0b4e3aa0 272 TARGET=$${TARGET} \
9bccf70c 273 build_all; \
1c79356b 274 done; \
55e303ae
A
275 ${MAKE} ${MAKEJOBS} INCL_MAKEDEP=TRUE TARGET=$${TARGET} do_build_all; \
276 _TMP_comp_subdir="$(CONFIG_SUBDIRS) $($(addprefix CONFIG_SUBDIRS_, $(ARCH_CONFIG)))"; \
277 for comp_subdir in $${_TMP_comp_subdir}; \
278 do \
279 $(MKDIR) $${comp_subdir}; \
280 ${MAKE} -C $${comp_subdir} \
281 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
282 SOURCE=${SOURCE}$${comp_subdir}/ \
283 TARGET=$${TARGET} \
284 build_all; \
285 done; \
286
1c79356b
A
287
288#
289# Build all architectures for all Configuration/Architecture options
290#
9bccf70c 291mach_kernel:
1c79356b
A
292 @echo "[ $(SOURCE) ] make mach_kernel"; \
293 for kernel_config in $(KERNEL_CONFIGS); \
294 do \
295 for arch_config in $(ARCH_CONFIGS); \
296 do \
297 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}; \
298 $(MKDIR) $${build_subdir}; \
9bccf70c
A
299 ${MAKE} -C $${build_subdir} \
300 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
301 ARCH_CONFIG=$${arch_config} \
302 MAKEFILES=${SOURCE}/Makefile \
303 SOURCE=${SOURCE}/ \
304 TARGET=$${build_subdir}/ \
9bccf70c 305 build_mach_kernel; \
1c79356b
A
306 done; \
307 done;
308
309#
310# Build all architectures for all Configuration/Architecture options
311#
312do_build_mach_kernel:
313
314build_mach_kernel:
315 @echo "[ $(SOURCE) ] make build_mach_kernel $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
9bccf70c 316 ${MAKE} ${MAKEJOBS} do_build_mach_kernel;
1c79356b 317
55e303ae 318
1c79356b
A
319#
320#
321# Install dependencies order
322#
9bccf70c 323.ORDER: installhdrs exporthdrs all
1c79356b
A
324
325#
326# Install kernel based on RC_ARCHS for all INSTALL_TYPES
327# Install kernel header files based on RC_ARCHS
328#
9bccf70c 329install: installhdrs all installman
1c79356b
A
330 @echo "[ $(SOURCE) ] make install"; \
331 rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
332 for kernel_config in $(INSTALL_TYPE); \
333 do \
334 for arch_config in $(INSTALL_ARCHS); \
335 do \
336 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
337 $(MKDIR) $${install_subdir}; \
9bccf70c
A
338 ${MAKE} -C $${install_subdir} \
339 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
340 ARCH_CONFIG=$${arch_config} \
341 MAKEFILES=${SOURCE}/Makefile \
342 SOURCE=${SOURCE}/ \
9bccf70c 343 build_install; \
1c79356b
A
344 done; \
345 done;
346
347#
348# Install for all architectures for all Configuration/Architecture options
349#
350setup_build_install:
351
352do_build_install:
353
354build_install:
0b4e3aa0
A
355 @TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
356 echo "[ $(SOURCE) ] make build_install $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $${TARGET}"; \
357 ${MAKE} TARGET=$${TARGET} setup_build_install; \
1c79356b 358 kernel_config=$(KERNEL_CONFIG); \
1c79356b
A
359 for install_subdir in $(INST_SUBDIRS); \
360 do \
361 $(MKDIR) $${install_subdir}; \
9bccf70c
A
362 ${MAKE} -C $${install_subdir} \
363 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
364 MAKEFILES=${SOURCE}/$${install_subdir}/Makefile \
365 SOURCE=${SOURCE}$${install_subdir}/ \
0b4e3aa0 366 TARGET=$${TARGET} \
9bccf70c 367 build_install; \
1c79356b 368 done; \
9bccf70c 369 ${MAKE} ${MAKEJOBS} TARGET=$${TARGET} do_build_install;
1c79356b
A
370
371
372#
373# Install source tree
374#
9bccf70c 375installsrc:
1c79356b
A
376 pax -rw . ${SRCROOT}
377
378
379
380#
381# Clean up source tree
382#
9bccf70c 383clean:
1c79356b
A
384
385#
386# Build source file list for cscope database and tags
387#
388cscope.files:
389 @echo "Building file list for cscope and tags"
390 @find . -name '*.h' -type f > _cscope.files 2> /dev/null
391 @echo bsd/ufs/ufs/ufs_readwrite.c >> _cscope.files 2> /dev/null
392 @for i in `echo ${ALL_SUBDIRS}`; \
393 do \
394 cat ${SRCROOT}/$${i}/conf/files ${SRCROOT}/$${i}/conf/files.ppc; \
395 cat ${SRCROOT}/$${i}/conf/files.i386; \
396 done | \
397 sed -e '/^#/d' -e '/^[ ]*$$/d' -e '/^OPTIONS\//d' | \
398 sed -e '1,$$s/^\([^ ]*\)[ ].*$$/\1/' >> _cscope.files 2> /dev/null
399 @sort < _cscope.files > cscope.files 2> /dev/null
400 @rm -f _cscope.files 2> /dev/null
401
402#
403# Build cscope database
404#
405cscope: cscope.files
406 @echo "Building cscope database"
407 @cscope -b 2> /dev/null
408
409#
410# Build tags
411#
412
413tags: cscope.files
414 @echo "Building ctags"
415 @-xargs ctags -dtw < cscope.files 2> /dev/null || \
416 echo "Phantom files detected!" 2>&1 > /dev/null
417 @echo "Building etags"
418 @-cat cscope.files | etags -l auto -S - 2> /dev/null
419
9bccf70c
A
420#
421# Install Man Pages
422#
423installman:
424 @echo "[ $(SRCROOT) ] Installing man pages"; \
425 manpath=$(DSTROOT)/$(MANDIR); \
426 $(MKDIR) $$manpath; \
427 ${MAKE} MAKEFILES=${SOURCE}/Makefile \
428 SOURCE=${SOURCE}/ \
429 TARGET=${DSTROOT}/ \
430 build_installman
431
432do_installman:
433
434build_installman:
435 @echo "[ $(SOURCE) ] make build_installman"; \
436 if [ -n "$(strip $(INSTMAN_SUBDIRS))" ]; then \
437 for installman_subdir in $(INSTMAN_SUBDIRS); do \
438 ${MAKE} -C $${installman_subdir} -r \
439 MAKEFILES=$(SOURCE)$${installman_subdir}/Makefile \
440 SOURCE=$(SOURCE)$${installman_subdir}/ \
441 TARGET=$(TARGET)$${installman_subdir}/ \
442 build_installman; \
443 done; \
444 fi; \
445 if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \
446 ${MAKE} ${MAKEJOBS} do_installman; \
1c79356b 447 fi