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