]> git.saurik.com Git - apple/xnu.git/blame - makedefs/MakeInc.dir
xnu-201.42.3.tar.gz
[apple/xnu.git] / makedefs / MakeInc.dir
CommitLineData
1c79356b
A
1#
2# Install kernel header files
3#
0b4e3aa0 4installhdrs: SRCROOT DSTROOT OBJROOT 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}; \
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#
0b4e3aa0 54installhdrs_md:
1c79356b
A
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#
74do_installhdrs_mi:
75
76build_installhdrs_mi::
77 @echo "[ $(SOURCE) ] make build_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
1c79356b
A
78 for installinc_subdir in $(INSTINC_SUBDIRS); \
79 do \
80 $(MKDIR) $${installinc_subdir}; \
81 (cd $${installinc_subdir}; \
0b4e3aa0 82 ${MAKE} MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
1c79356b
A
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#
93do_installhdrs_md:
94
95build_installhdrs_md::
96 @echo "[ $(SOURCE) ] make installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
1c79356b
A
97 for installinc_subdir in $($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG))); \
98 do \
99 $(MKDIR) $${installinc_subdir}; \
100 (cd $${installinc_subdir}; \
0b4e3aa0 101 ${MAKE} MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
1c79356b
A
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#
0b4e3aa0 112exporthdrs: SRCROOT DSTROOT OBJROOT exporthdrs_mi exporthdrs_md
1c79356b
A
113
114#
115# Install header files order
116#
117.ORDER: exporthdrs_mi exporthdrs_md
118
119#
120# Install machine independent header files
121#
122do_exporthdrs_mi:
123
0b4e3aa0 124exporthdrs_mi:
1c79356b
A
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#
0b4e3aa0 143exporthdrs_md:
1c79356b
A
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#
164do_exporthdrs_mi:
165
166build_exporthdrs_mi:
167 @echo "[ $(SOURCE) ] make build_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
1c79356b
A
168 for exportinc_subdir in $(EXPINC_SUBDIRS); \
169 do \
170 $(MKDIR) $${exportinc_subdir}; \
171 (cd $${exportinc_subdir}; \
0b4e3aa0 172 ${MAKE} MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
1c79356b
A
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#
183do_exporthdrs_md:
184
185build_exporthdrs_md:
186 @echo "[ $(SOURCE) ] make exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
1c79356b
A
187 for exportinc_subdir in $($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG))); \
188 do \
189 $(MKDIR) $${exportinc_subdir}; \
190 (cd $${exportinc_subdir}; \
0b4e3aa0 191 ${MAKE} MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
1c79356b
A
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#
202setup: 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
222do_build_setup:
223
224build_setup:
225 @echo "[ $(SOURCE) ] make build_setup $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \
1c79356b
A
226 for setup_subdir in $(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG))); \
227 do \
228 $(MKDIR) $${setup_subdir}; \
229 (cd $${setup_subdir}; \
0b4e3aa0 230 ${MAKE} MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile \
1c79356b
A
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#
242all: 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}; \
1c79356b
A
252 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
253 ARCH_CONFIG=$${arch_config} \
254 MAKEFILES=${SOURCE}/Makefile \
255 SOURCE=${SOURCE}/ \
1c79356b
A
256 build_all \
257 ); \
258 done; \
259 done;
260
261#
262# Build all architectures for all Configuration/Architecture options
263#
264do_build_all:
265
266build_all:
0b4e3aa0
A
267 @TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
268 echo "[ $(SOURCE) ] make build_all $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $${TARGET}"; \
1c79356b
A
269 for comp_subdir in $(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG))); \
270 do \
271 $(MKDIR) $${comp_subdir}; \
272 (cd $${comp_subdir}; \
0b4e3aa0 273 ${MAKE} MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
1c79356b 274 SOURCE=${SOURCE}$${comp_subdir}/ \
0b4e3aa0 275 TARGET=$${TARGET} \
1c79356b
A
276 build_all \
277 ); \
278 done; \
0b4e3aa0 279 ${MAKE} INCL_MAKEDEP=TRUE TARGET=$${TARGET} do_build_all;
1c79356b
A
280
281#
282# Build all architectures for all Configuration/Architecture options
283#
284mach_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#
306do_build_mach_kernel:
307
308build_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#
322install: 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}; \
1c79356b
A
332 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
333 ARCH_CONFIG=$${arch_config} \
334 MAKEFILES=${SOURCE}/Makefile \
335 SOURCE=${SOURCE}/ \
1c79356b
A
336 build_install \
337 ); \
338 done; \
339 done;
340
341#
342# Install for all architectures for all Configuration/Architecture options
343#
344setup_build_install:
345
346do_build_install:
347
348build_install:
0b4e3aa0
A
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; \
1c79356b 352 kernel_config=$(KERNEL_CONFIG); \
1c79356b
A
353 for install_subdir in $(INST_SUBDIRS); \
354 do \
355 $(MKDIR) $${install_subdir}; \
356 (cd $${install_subdir}; \
1c79356b 357 ${MAKE} KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
358 MAKEFILES=${SOURCE}/$${install_subdir}/Makefile \
359 SOURCE=${SOURCE}$${install_subdir}/ \
0b4e3aa0 360 TARGET=$${TARGET} \
1c79356b
A
361 build_install \
362 ); \
363 done; \
0b4e3aa0 364 ${MAKE} TARGET=$${TARGET} do_build_install;
1c79356b
A
365
366
367#
368# Install source tree
369#
370installsrc: SRCROOT
371 pax -rw . ${SRCROOT}
372
373
374
375#
376# Clean up source tree
377#
378clean: SRCROOT
379
380#
381# Build source file list for cscope database and tags
382#
383cscope.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#
400cscope: cscope.files
401 @echo "Building cscope database"
402 @cscope -b 2> /dev/null
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
415
416SRCROOT DSTROOT OBJROOT SYMROOT: ALWAYS
417 @if [ -n "${$@}" ]; \
418 then \
419 exit 0; \
420 else \
421 echo Must define $@; \
422 exit 1; \
423 fi
424
425ALWAYS:
426