]> git.saurik.com Git - apple/xnu.git/blame - makedefs/MakeInc.dir
xnu-792.13.8.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); \
91447636 7 krespath=$(DSTROOT)/$(KRESDIR); \
1c79356b 8 kframepath=$(DSTROOT)/$(KINCFRAME); \
91447636
A
9 [ -d $$krespath ] || $(MKDIR) $$krespath; \
10 [ -d $$kincpath ] || $(MKDIR) $$kincpath; \
1c79356b 11 cd $(SRCROOT)/EXTERNAL_HEADERS; \
91447636
A
12 install $(FILE_INSTALL_FLAGS) Info.plist $$krespath; \
13 $(SRCROOT)/config/newvers.pl $${krespath}/Info.plist; \
1c79356b
A
14 cd $$kframepath/Versions; \
15 [ -L Current ] || $(LN) $(KINCVERS) Current; \
16 cd $$kframepath; \
17 [ -L Headers ] || $(LN) Versions/Current/Headers Headers; \
91447636
A
18 [ -L Resources ] || $(LN) Versions/Current/Resources Resources; \
19 [ -d $(DSTROOT)/$(KPINCDIR) ] || $(MKDIR) $(DSTROOT)/$(KPINCDIR); \
0b4e3aa0 20 cd $$kframepath; [ -L PrivateHeaders ] || \
91447636 21 $(LN) Versions/Current/PrivateHeaders PrivateHeaders;
1c79356b
A
22
23#
24# Install header files order
25#
26.ORDER: installhdrs_mi installhdrs_md
27
28#
29# Install machine independent header files
30#
0b4e3aa0 31installhdrs_mi:
1c79356b
A
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}; \
91447636 37 [ -d $${installinc_dir} ] ||$(MKDIR) $${installinc_dir}; \
9bccf70c
A
38 ${MAKE} -C $${installinc_dir} \
39 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
40 ARCH_CONFIG=$${arch_config} \
41 MAKEFILES=${SOURCE}/Makefile \
42 SOURCE=${SOURCE}/ \
43 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
9bccf70c 44 build_installhdrs_mi; \
1c79356b
A
45
46#
47# Install machine dependent kernel header files
48#
0b4e3aa0 49installhdrs_md:
1c79356b
A
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 \
91447636 55 [ -d ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path} ] || \
1c79356b 56 $(MKDIR) ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
9bccf70c
A
57 ${MAKE} -C ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path} \
58 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
59 ARCH_CONFIG=$${arch_config} \
60 MAKEFILES=${SOURCE}/Makefile \
61 SOURCE=${SOURCE}/ \
62 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
9bccf70c 63 build_installhdrs_md; \
1c79356b
A
64 done;
65
66#
67# Install machine independent kernel header files
68#
69do_installhdrs_mi:
70
71build_installhdrs_mi::
72 @echo "[ $(SOURCE) ] make build_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
1c79356b
A
73 for installinc_subdir in $(INSTINC_SUBDIRS); \
74 do \
91447636 75 [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir}; \
9bccf70c
A
76 ${MAKE} -C $${installinc_subdir} \
77 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
1c79356b
A
78 SOURCE=$(SOURCE)$${installinc_subdir}/ \
79 TARGET=$(TARGET)$${installinc_subdir}/ \
9bccf70c 80 build_installhdrs_mi; \
1c79356b 81 done; \
9bccf70c 82 ${MAKE} ${MAKEJOBS} do_installhdrs_mi;
1c79356b
A
83
84#
85# Install machine dependent kernel header files
86#
87do_installhdrs_md:
88
89build_installhdrs_md::
90 @echo "[ $(SOURCE) ] make installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
1c79356b
A
91 for installinc_subdir in $($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG))); \
92 do \
91447636 93 [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir}; \
9bccf70c
A
94 ${MAKE} -C $${installinc_subdir} \
95 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
1c79356b
A
96 SOURCE=$(SOURCE)$${installinc_subdir}/ \
97 TARGET=$(TARGET)$${installinc_subdir}/ \
9bccf70c 98 build_installhdrs_md; \
1c79356b 99 done; \
9bccf70c 100 ${MAKE} ${MAKEJOBS} do_installhdrs_md;
1c79356b
A
101
102#
103# Install kernel header files
104#
9bccf70c 105exporthdrs: exporthdrs_mi exporthdrs_md
1c79356b
A
106
107#
108# Install header files order
109#
110.ORDER: exporthdrs_mi exporthdrs_md
111
112#
113# Install machine independent header files
114#
115do_exporthdrs_mi:
116
0b4e3aa0 117exporthdrs_mi:
1c79356b
A
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}; \
91447636 123 [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir}; \
9bccf70c
A
124 ${MAKE} -C $${exportinc_dir} \
125 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
126 ARCH_CONFIG=$${arch_config} \
127 MAKEFILES=${SOURCE}/Makefile \
128 SOURCE=${SOURCE}/ \
129 TARGET=$${exportinc_dir}/ \
9bccf70c 130 build_exporthdrs_mi; \
1c79356b
A
131
132#
133# Install machine dependent kernel header files
134#
0b4e3aa0 135exporthdrs_md:
1c79356b
A
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}; \
91447636 142 [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir}; \
9bccf70c
A
143 ${MAKE} -C $${exportinc_dir} \
144 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
145 ARCH_CONFIG=$${arch_config} \
146 MAKEFILES=${SOURCE}/Makefile \
147 SOURCE=${SOURCE}/ \
148 TARGET=$${exportinc_dir}/ \
9bccf70c 149 build_exporthdrs_md; \
1c79356b
A
150 done;
151
152#
153# Install machine independent kernel header files
154#
155do_exporthdrs_mi:
156
157build_exporthdrs_mi:
158 @echo "[ $(SOURCE) ] make build_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
9bccf70c
A
159 _TMP_EXPINC_SUBDIRS="$(EXPINC_SUBDIRS)"; \
160 for exportinc_subdir in $${_TMP_EXPINC_SUBDIRS}; \
1c79356b 161 do \
91447636 162 [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir}; \
9bccf70c
A
163 ${MAKE} -C $${exportinc_subdir} \
164 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
1c79356b
A
165 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
166 TARGET=$(TARGET)$${exportinc_subdir}/ \
9bccf70c 167 build_exporthdrs_mi; \
1c79356b 168 done; \
9bccf70c 169 ${MAKE} ${MAKEJOBS} do_exporthdrs_mi;
1c79356b
A
170
171#
172# Install machine dependent kernel header files
173#
174do_exporthdrs_md:
175
176build_exporthdrs_md:
177 @echo "[ $(SOURCE) ] make exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
9bccf70c
A
178 _TMP_exportinc_subdir="$($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG)))"; \
179 for exportinc_subdir in $${_TMP_exportinc_subdir}; \
1c79356b 180 do \
91447636 181 [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir}; \
9bccf70c
A
182 ${MAKE} -C $${exportinc_subdir} \
183 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
1c79356b
A
184 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
185 TARGET=$(TARGET)$${exportinc_subdir}/ \
9bccf70c 186 build_exporthdrs_md; \
1c79356b 187 done; \
9bccf70c 188 ${MAKE} ${MAKEJOBS} do_exporthdrs_md;
1c79356b
A
189
190#
191# Setup pass for all architectures for all Configuration/Architecture options
192#
9bccf70c 193setup:
1c79356b
A
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}; \
91447636 201 [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir}; \
9bccf70c
A
202 ${MAKE} -C $${setup_subdir} \
203 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
204 ARCH_CONFIG=$${arch_config} \
205 MAKEFILES=${SOURCE}/Makefile \
206 SOURCE=${SOURCE}/ \
207 TARGET=$${setup_subdir}/ \
9bccf70c 208 build_setup; \
1c79356b
A
209 done; \
210 done;
211
212do_build_setup:
213
214build_setup:
215 @echo "[ $(SOURCE) ] make build_setup $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
9bccf70c
A
216 _TMP_setup_subdir="$(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG)))"; \
217 for setup_subdir in $${_TMP_setup_subdir}; \
1c79356b 218 do \
91447636 219 [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir}; \
9bccf70c
A
220 ${MAKE} -C $${setup_subdir} \
221 MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile \
1c79356b
A
222 SOURCE=${SOURCE}/$${setup_subdir}/ \
223 TARGET=${TARGET}/$${setup_subdir}/ \
9bccf70c 224 build_setup; \
1c79356b
A
225 done; \
226 ${MAKE} do_build_setup;
227
228
229#
230# Build all architectures for all Configuration/Architecture options
231#
9bccf70c
A
232ifeq ($(COMPONENT), .)
233all: exporthdrs
234else
235all:
236endif
1c79356b
A
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}; \
91447636 244 [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \
9bccf70c
A
245 ${MAKE} -C $${build_subdir} \
246 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
247 ARCH_CONFIG=$${arch_config} \
248 MAKEFILES=${SOURCE}/Makefile \
249 SOURCE=${SOURCE}/ \
9bccf70c 250 build_all; \
1c79356b
A
251 done; \
252 done;
253
254#
255# Build all architectures for all Configuration/Architecture options
256#
257do_build_all:
258
259build_all:
0b4e3aa0
A
260 @TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
261 echo "[ $(SOURCE) ] make build_all $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $${TARGET}"; \
9bccf70c
A
262 _TMP_comp_subdir="$(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG)))"; \
263 for comp_subdir in $${_TMP_comp_subdir}; \
1c79356b 264 do \
91447636 265 [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir}; \
9bccf70c
A
266 ${MAKE} -C $${comp_subdir} \
267 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
1c79356b 268 SOURCE=${SOURCE}$${comp_subdir}/ \
0b4e3aa0 269 TARGET=$${TARGET} \
9bccf70c 270 build_all; \
1c79356b 271 done; \
55e303ae
A
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 \
91447636 276 [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir}; \
55e303ae
A
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
1c79356b
A
284
285#
286# Build all architectures for all Configuration/Architecture options
287#
9bccf70c 288mach_kernel:
1c79356b
A
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}; \
91447636 295 [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \
9bccf70c
A
296 ${MAKE} -C $${build_subdir} \
297 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
298 ARCH_CONFIG=$${arch_config} \
299 MAKEFILES=${SOURCE}/Makefile \
300 SOURCE=${SOURCE}/ \
301 TARGET=$${build_subdir}/ \
9bccf70c 302 build_mach_kernel; \
1c79356b
A
303 done; \
304 done;
305
306#
307# Build all architectures for all Configuration/Architecture options
308#
309do_build_mach_kernel:
310
311build_mach_kernel:
312 @echo "[ $(SOURCE) ] make build_mach_kernel $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
9bccf70c 313 ${MAKE} ${MAKEJOBS} do_build_mach_kernel;
1c79356b 314
55e303ae 315
1c79356b
A
316#
317#
318# Install dependencies order
319#
9bccf70c 320.ORDER: installhdrs exporthdrs all
1c79356b
A
321
322#
323# Install kernel based on RC_ARCHS for all INSTALL_TYPES
324# Install kernel header files based on RC_ARCHS
325#
9bccf70c 326install: installhdrs all installman
1c79356b
A
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}; \
91447636 334 [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir}; \
9bccf70c
A
335 ${MAKE} -C $${install_subdir} \
336 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
337 ARCH_CONFIG=$${arch_config} \
338 MAKEFILES=${SOURCE}/Makefile \
339 SOURCE=${SOURCE}/ \
9bccf70c 340 build_install; \
1c79356b
A
341 done; \
342 done;
343
344#
345# Install for all architectures for all Configuration/Architecture options
346#
347setup_build_install:
348
349do_build_install:
350
351build_install:
0b4e3aa0
A
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; \
1c79356b 355 kernel_config=$(KERNEL_CONFIG); \
1c79356b
A
356 for install_subdir in $(INST_SUBDIRS); \
357 do \
91447636 358 [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir}; \
9bccf70c
A
359 ${MAKE} -C $${install_subdir} \
360 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
361 MAKEFILES=${SOURCE}/$${install_subdir}/Makefile \
362 SOURCE=${SOURCE}$${install_subdir}/ \
0b4e3aa0 363 TARGET=$${TARGET} \
9bccf70c 364 build_install; \
1c79356b 365 done; \
9bccf70c 366 ${MAKE} ${MAKEJOBS} TARGET=$${TARGET} do_build_install;
1c79356b
A
367
368
369#
370# Install source tree
371#
9bccf70c 372installsrc:
1c79356b
A
373 pax -rw . ${SRCROOT}
374
375
376
377#
378# Clean up source tree
379#
9bccf70c 380clean:
1c79356b
A
381
382#
383# Build source file list for cscope database and tags
384#
385cscope.files:
386 @echo "Building file list for cscope and tags"
5d5c5d0d
A
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
1c79356b
A
396
397#
398# Build cscope database
399#
400cscope: cscope.files
401 @echo "Building cscope database"
5d5c5d0d 402 @cscope -bvU 2> /dev/null
1c79356b
A
403
404#
405# Build tags
406#
407
408tags: 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
9bccf70c
A
415#
416# Install Man Pages
417#
418installman:
419 @echo "[ $(SRCROOT) ] Installing man pages"; \
420 manpath=$(DSTROOT)/$(MANDIR); \
91447636 421 [ -d $$manpath ] || $(MKDIR) $$manpath; \
9bccf70c
A
422 ${MAKE} MAKEFILES=${SOURCE}/Makefile \
423 SOURCE=${SOURCE}/ \
424 TARGET=${DSTROOT}/ \
425 build_installman
426
427do_installman:
428
429build_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; \
1c79356b 442 fi