]> git.saurik.com Git - apple/xnu.git/blame - makedefs/MakeInc.dir
xnu-1504.7.4.tar.gz
[apple/xnu.git] / makedefs / MakeInc.dir
CommitLineData
1c79356b
A
1#
2# Install kernel header files
3#
2d21ac55
A
4ifeq ($(RC_ProjectName),Libsyscall)
5installhdrs:
6 bsdmake -C libsyscall installhdrs
b0d623f7
A
7else ifeq ($(findstring libkxld,$(RC_ProjectName)),libkxld)
8installhdrs:
9 make -C libkern/kxld/ installhdrs
10else ifeq ($(RC_ProjectName),xnu_debug)
11installhdrs:
2d21ac55 12else # xnu
9bccf70c 13installhdrs: exporthdrs installhdrs_mi installhdrs_md
2d21ac55
A
14 @echo "[ $(SRCROOT) ] make installhdrs installing Kernel.framework"
15 $(_v)kincpath=$(DSTROOT)/$(KINCDIR); \
91447636 16 krespath=$(DSTROOT)/$(KRESDIR); \
1c79356b 17 kframepath=$(DSTROOT)/$(KINCFRAME); \
91447636
A
18 [ -d $$krespath ] || $(MKDIR) $$krespath; \
19 [ -d $$kincpath ] || $(MKDIR) $$kincpath; \
1c79356b 20 cd $(SRCROOT)/EXTERNAL_HEADERS; \
91447636 21 install $(FILE_INSTALL_FLAGS) Info.plist $$krespath; \
b0d623f7 22 $(NEWVERS) $${krespath}/Info.plist; \
1c79356b
A
23 cd $$kframepath/Versions; \
24 [ -L Current ] || $(LN) $(KINCVERS) Current; \
25 cd $$kframepath; \
26 [ -L Headers ] || $(LN) Versions/Current/Headers Headers; \
91447636
A
27 [ -L Resources ] || $(LN) Versions/Current/Resources Resources; \
28 [ -d $(DSTROOT)/$(KPINCDIR) ] || $(MKDIR) $(DSTROOT)/$(KPINCDIR); \
0b4e3aa0 29 cd $$kframepath; [ -L PrivateHeaders ] || \
91447636 30 $(LN) Versions/Current/PrivateHeaders PrivateHeaders;
2d21ac55 31endif
1c79356b
A
32
33#
34# Install header files order
35#
36.ORDER: installhdrs_mi installhdrs_md
37
38#
39# Install machine independent header files
40#
0b4e3aa0 41installhdrs_mi:
2d21ac55 42 $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
1c79356b
A
43 kernel_config=$(INSTALL_TYPE); \
44 arch_config=$(INSTALL_ARCH_DEFAULT); \
45 installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
91447636 46 [ -d $${installinc_dir} ] ||$(MKDIR) $${installinc_dir}; \
b0d623f7 47 ${MAKE} ${MAKEJOBS} -C $${installinc_dir} \
9bccf70c 48 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
49 ARCH_CONFIG=$${arch_config} \
50 MAKEFILES=${SOURCE}/Makefile \
51 SOURCE=${SOURCE}/ \
52 TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/ \
9bccf70c 53 build_installhdrs_mi; \
1c79356b
A
54
55#
56# Install machine dependent kernel header files
57#
0b4e3aa0 58installhdrs_md:
2d21ac55 59 $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
1c79356b 60 kernel_config=$(INSTALL_TYPE); \
2d21ac55 61 machine_config=$(MACHINE_CONFIG); \
1c79356b
A
62 for arch_config in $(INSTALL_ARCHS); \
63 do \
2d21ac55
A
64 if [ $${arch_config} = ARM ] ; then \
65 if [ $${machine_config} = DEFAULT ] ; then \
66 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
67 fi; \
68 fi; \
69 if [ $${machine_config} = DEFAULT ] ; then \
70 objpath=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
71 else \
72 objpath=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \
73 fi; \
74 [ -d $${objpath} ] || $(MKDIR) $${objpath}; \
b0d623f7 75 ${MAKE} ${MAKEJOBS} -C $${objpath} \
9bccf70c 76 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
77 ARCH_CONFIG=$${arch_config} \
78 MAKEFILES=${SOURCE}/Makefile \
79 SOURCE=${SOURCE}/ \
2d21ac55 80 TARGET=$${objpath}/ \
9bccf70c 81 build_installhdrs_md; \
1c79356b
A
82 done;
83
84#
85# Install machine independent kernel header files
86#
87do_installhdrs_mi:
88
b0d623f7
A
89BUILD_INSTALLHDRS_MI_SUBDIRS_TARGETS = $(addprefix build_installhdrs_mi_,$(INSTINC_SUBDIRS))
90
91.PHONY: $(BUILD_INSTALLHDRS_MI_SUBDIRS_TARGETS)
92
93$(BUILD_INSTALLHDRS_MI_SUBDIRS_TARGETS):
94 $(_v)installinc_subdir="$(patsubst build_installhdrs_mi_%,%,$@)"; \
95 [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir}; \
96 ${MAKE} -C $${installinc_subdir} \
97 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
98 SOURCE=$(SOURCE)$${installinc_subdir}/ \
99 TARGET=$(TARGET)$${installinc_subdir}/ \
100 build_installhdrs_mi;
101
102build_installhdrs_mi: $(BUILD_INSTALLHDRS_MI_SUBDIRS_TARGETS)
103 $(_v)${MAKE} do_installhdrs_mi;
1c79356b
A
104
105#
106# Install machine dependent kernel header files
107#
108do_installhdrs_md:
109
b0d623f7
A
110BUILD_INSTALLHDRS_MD_SUBDIRS_TARGETS = $(addprefix build_installhdrs_md_,$($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG))))
111
112.PHONY: $(BUILD_INSTALLHDRS_MD_SUBDIRS_TARGETS)
113
114$(BUILD_INSTALLHDRS_MD_SUBDIRS_TARGETS):
115 $(_v)installinc_subdir="$(patsubst build_installhdrs_md_%,%,$@)"; \
116 [ -d $${installinc_subdir} ] || $(MKDIR) $${installinc_subdir}; \
117 ${MAKE} -C $${installinc_subdir} \
118 MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile \
119 SOURCE=$(SOURCE)$${installinc_subdir}/ \
120 TARGET=$(TARGET)$${installinc_subdir}/ \
121 build_installhdrs_md;
122
123build_installhdrs_md: $(BUILD_INSTALLHDRS_MD_SUBDIRS_TARGETS)
124 $(_v)${MAKE} do_installhdrs_md;
1c79356b
A
125
126#
127# Install kernel header files
128#
9bccf70c 129exporthdrs: exporthdrs_mi exporthdrs_md
1c79356b
A
130
131#
132# Install header files order
133#
134.ORDER: exporthdrs_mi exporthdrs_md
135
136#
137# Install machine independent header files
138#
139do_exporthdrs_mi:
140
0b4e3aa0 141exporthdrs_mi:
2d21ac55 142 $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
1c79356b
A
143 kernel_config=$(INSTALL_TYPE); \
144 arch_config=$(INSTALL_ARCH_DEFAULT); \
145 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
91447636 146 [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir}; \
b0d623f7 147 ${MAKE} ${MAKEJOBS} -C $${exportinc_dir} \
9bccf70c 148 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
149 ARCH_CONFIG=$${arch_config} \
150 MAKEFILES=${SOURCE}/Makefile \
151 SOURCE=${SOURCE}/ \
152 TARGET=$${exportinc_dir}/ \
9bccf70c 153 build_exporthdrs_mi; \
1c79356b
A
154
155#
156# Install machine dependent kernel header files
157#
2d21ac55
A
158# Note - installation of machine dependent kernel header files only occurs for architecture
159# defined in INSTALL_TYPE. We use skipit variable to skip over architectures that are not
160# equal to what is in the INSTALL_TYPE variable.
161# TARGET_CONFIGS_UC variable holds sets of three configuration options. The first item in the
162# set is the kernel configuration. The second item in the set is the architecture and the
163# third item is the machine configuration. There may be multiple sets to build.
0b4e3aa0 164exporthdrs_md:
2d21ac55
A
165 $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
166 my_counter=1; \
167 for my_config in $(TARGET_CONFIGS_UC); \
168 do \
169 if [ $${my_counter} -eq 1 ] ; then \
170 skipit=0; \
171 my_counter=2; \
172 kernel_config=$${my_config}; \
173 if [ $${kernel_config} = DEFAULT ] ; then \
174 kernel_config=$(DEFAULT_KERNEL_CONFIG); \
175 fi; \
176 if [ $${kernel_config} != $(INSTALL_TYPE) ] ; then \
177 skipit=1; \
178 fi; \
179 elif [ $${my_counter} -eq 2 ] ; then \
180 my_counter=3; \
181 arch_config=$${my_config}; \
182 if [ $${arch_config} = DEFAULT ] ; then \
183 arch_config=`arch | $(TR) a-z A-Z`; \
184 fi; \
185 else \
186 my_counter=1; \
187 machine_config=$${my_config}; \
188 if [ $${skipit} -eq 0 ] ; then \
189 if [ $${arch_config} = ARM ] ; then \
190 if [ $${machine_config} = DEFAULT ] ; then \
191 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
192 fi; \
193 fi; \
194 if [ $${machine_config} = DEFAULT ] ; then \
195 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
196 else \
197 exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \
198 fi; \
199 [ -d $${exportinc_dir} ] || $(MKDIR) $${exportinc_dir}; \
b0d623f7 200 ${MAKE} ${MAKEJOBS} -C $${exportinc_dir} \
2d21ac55
A
201 KERNEL_CONFIG=$${kernel_config} \
202 ARCH_CONFIG=$${arch_config} \
203 MAKEFILES=${SOURCE}/Makefile \
204 SOURCE=${SOURCE}/ \
205 TARGET=$${exportinc_dir}/ \
206 build_exporthdrs_md; \
207 fi; \
208 fi; \
1c79356b
A
209 done;
210
211#
212# Install machine independent kernel header files
213#
214do_exporthdrs_mi:
215
b0d623f7
A
216BUILD_EXPORTHDRS_MI_SUBDIRS_TARGETS = $(addprefix build_exporthdrs_mi_,$(EXPINC_SUBDIRS))
217
218.PHONY: $(BUILD_EXPORTHDRS_MI_SUBDIRS_TARGETS)
219
220$(BUILD_EXPORTHDRS_MI_SUBDIRS_TARGETS):
221 $(_v)exportinc_subdir="$(patsubst build_exporthdrs_mi_%,%,$@)"; \
222 [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir}; \
223 ${MAKE} -C $${exportinc_subdir} \
224 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
225 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
226 TARGET=$(TARGET)$${exportinc_subdir}/ \
227 build_exporthdrs_mi;
228
229build_exporthdrs_mi: $(BUILD_EXPORTHDRS_MI_SUBDIRS_TARGETS)
230 $(_v)${MAKE} do_exporthdrs_mi;
1c79356b
A
231
232#
233# Install machine dependent kernel header files
234#
235do_exporthdrs_md:
236
b0d623f7
A
237BUILD_EXPORTHDRS_MD_SUBDIRS_TARGETS = $(addprefix build_exporthdrs_md_,$($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG))))
238
239.PHONY: $(BUILD_EXPORTHDRS_MD_SUBDIRS_TARGETS)
240
241$(BUILD_EXPORTHDRS_MD_SUBDIRS_TARGETS):
242 $(_v)exportinc_subdir="$(patsubst build_exporthdrs_md_%,%,$@)"; \
243 [ -d $${exportinc_subdir} ] || $(MKDIR) $${exportinc_subdir}; \
244 ${MAKE} -C $${exportinc_subdir} \
245 MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile \
246 SOURCE=$(SOURCE)$${exportinc_subdir}/ \
247 TARGET=$(TARGET)$${exportinc_subdir}/ \
248 build_exporthdrs_md;
249
250build_exporthdrs_md: $(BUILD_EXPORTHDRS_MD_SUBDIRS_TARGETS)
251 $(_v)${MAKE} do_exporthdrs_md;
1c79356b
A
252
253#
254# Setup pass for all architectures for all Configuration/Architecture options
255#
9bccf70c 256setup:
2d21ac55 257 $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
1c79356b
A
258 for kernel_config in $(KERNEL_CONFIGS); \
259 do \
260 for arch_config in $(ARCH_CONFIGS); \
261 do \
262 setup_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
91447636 263 [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir}; \
9bccf70c
A
264 ${MAKE} -C $${setup_subdir} \
265 KERNEL_CONFIG=$${kernel_config} \
1c79356b
A
266 ARCH_CONFIG=$${arch_config} \
267 MAKEFILES=${SOURCE}/Makefile \
268 SOURCE=${SOURCE}/ \
269 TARGET=$${setup_subdir}/ \
9bccf70c 270 build_setup; \
1c79356b
A
271 done; \
272 done;
273
274do_build_setup:
275
b0d623f7
A
276BUILD_SETUP_SUBDIRS_TARGETS = $(addprefix build_setup_,$(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG))))
277
278.PHONY: $(BUILD_SETUP_SUBDIRS_TARGETS)
279
280$(BUILD_SETUP_SUBDIRS_TARGETS):
281 $(_v)setup_subdir="$(patsubst build_setup_%,%,$@)"; \
282 [ -d $${setup_subdir} ] || $(MKDIR) $${setup_subdir}; \
9bccf70c
A
283 ${MAKE} -C $${setup_subdir} \
284 MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile \
1c79356b
A
285 SOURCE=${SOURCE}/$${setup_subdir}/ \
286 TARGET=${TARGET}/$${setup_subdir}/ \
b0d623f7
A
287 build_setup;
288
289build_setup: $(BUILD_SETUP_SUBDIRS_TARGETS)
290 $(_v)${MAKE} do_build_setup;
1c79356b
A
291
292
293#
294# Build all architectures for all Configuration/Architecture options
295#
2d21ac55
A
296# Note - TARGET_CONFIGS_UC variable holds sets of three configuration options. The first
297# item in the set is the kernel configuration. The second item in the set is the architecture
298# and the third item is the machine configuration. There may be multiple sets to build.
299#
300ifeq ($(RC_ProjectName),Libsyscall)
301all:
302 bsdmake -C libsyscall install
b0d623f7
A
303else ifeq ($(findstring libkxld,$(RC_ProjectName)),libkxld)
304all:
305 make -C libkern/kxld/ install
306else # xnu or xnu_debug
9bccf70c
A
307ifeq ($(COMPONENT), .)
308all: exporthdrs
309else
310all:
311endif
2d21ac55
A
312 $(_v)my_counter=1; \
313 for my_config in $(TARGET_CONFIGS_UC); \
314 do \
315 if [ $${my_counter} -eq 1 ] ; then \
316 my_counter=2; \
317 kernel_config=$${my_config}; \
318 if [ $${kernel_config} = DEFAULT ] ; then \
319 kernel_config=$(DEFAULT_KERNEL_CONFIG); \
320 fi; \
321 elif [ $${my_counter} -eq 2 ] ; then \
322 my_counter=3; \
323 arch_config=$${my_config}; \
324 if [ $${arch_config} = DEFAULT ] ; then \
325 arch_config=`arch | $(TR) a-z A-Z`; \
326 fi; \
327 else \
328 my_counter=1; \
329 machine_config=$${my_config}; \
330 if [ $${arch_config} = ARM ] ; then \
331 if [ $${machine_config} = DEFAULT ] ; then \
332 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
333 fi; \
334 fi; \
335 if [ $${machine_config} = DEFAULT ] ; then \
336 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
337 else \
338 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \
339 fi; \
340 [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \
b0d623f7 341 ${MAKE} ${MAKEJOBS} -C $${build_subdir} \
2d21ac55 342 KERNEL_CONFIG=$${kernel_config} \
b0d623f7 343 ARCH_CONFIG=$${arch_config} \
2d21ac55
A
344 MACHINE_CONFIG=$${machine_config} \
345 MAKEFILES=${SOURCE}/Makefile \
346 SOURCE=${SOURCE}/ \
347 build_all; \
348 fi; \
1c79356b 349 done;
2d21ac55 350endif
1c79356b
A
351
352#
353# Build all architectures for all Configuration/Architecture options
354#
355do_build_all:
356
b0d623f7
A
357BUILD_ALL_SUBDIRS_TARGETS = $(addprefix build_all_,$(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG))))
358
359.PHONY: $(BUILD_ALL_SUBDIRS_TARGETS)
360
361$(BUILD_ALL_SUBDIRS_TARGETS):
2d21ac55
A
362 $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \
363 TARGET=$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
364 else \
365 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)"; \
366 fi; \
b0d623f7
A
367 comp_subdir="$(patsubst build_all_%,%,$@)"; \
368 [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir}; \
369 ${MAKE} -C $${comp_subdir} \
370 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
371 SOURCE=${SOURCE}$${comp_subdir}/ \
372 TARGET=$${TARGET} \
373 build_all;
374
375build_all: $(BUILD_ALL_SUBDIRS_TARGETS)
376 $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \
377 TARGET=$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
378 else \
379 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)"; \
380 fi; \
381 ${MAKE} INCL_MAKEDEP=TRUE TARGET=$${TARGET} do_build_all; \
55e303ae
A
382 _TMP_comp_subdir="$(CONFIG_SUBDIRS) $($(addprefix CONFIG_SUBDIRS_, $(ARCH_CONFIG)))"; \
383 for comp_subdir in $${_TMP_comp_subdir}; \
384 do \
91447636 385 [ -d $${comp_subdir} ] || $(MKDIR) $${comp_subdir}; \
55e303ae
A
386 ${MAKE} -C $${comp_subdir} \
387 MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile \
388 SOURCE=${SOURCE}$${comp_subdir}/ \
389 TARGET=$${TARGET} \
390 build_all; \
2d21ac55 391 done;
55e303ae 392
1c79356b
A
393
394#
395# Build all architectures for all Configuration/Architecture options
396#
2d21ac55
A
397# Note - TARGET_CONFIGS_UC variable holds sets of three configuration options. The first
398# item in the set is the kernel configuration. The second item is the architecture
399# and the third item is the machine configuration. There may be multiple sets to build.
400#
9bccf70c 401mach_kernel:
2d21ac55
A
402 $(_v)my_counter=1; \
403 for my_config in $(TARGET_CONFIGS_UC); \
404 do \
405 if [ $${my_counter} -eq 1 ] ; then \
406 my_counter=2; \
407 kernel_config=$${my_config}; \
408 if [ $${kernel_config} = DEFAULT ] ; then \
409 kernel_config=$(DEFAULT_KERNEL_CONFIG); \
410 fi; \
411 elif [ $${my_counter} -eq 2 ] ; then \
412 my_counter=3; \
413 arch_config=$${my_config}; \
414 if [ $${arch_config} = DEFAULT ] ; then \
415 arch_config=`arch | $(TR) a-z A-Z`; \
416 fi; \
417 else \
418 my_counter=1; \
419 machine_config=$${my_config}; \
420 if [ $${arch_config} = ARM ] ; then \
421 if [ $${machine_config} = DEFAULT ] ; then \
422 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
423 fi; \
424 fi; \
425 if [ $${machine_config} = DEFAULT ] ; then \
426 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}; \
427 else \
428 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}; \
429 fi; \
430 [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \
b0d623f7 431 ${MAKE} ${MAKEJOBS} -C $${build_subdir} \
2d21ac55
A
432 KERNEL_CONFIG=$${kernel_config} \
433 ARCH_CONFIG=$${arch_config} \
434 MACHINE_CONFIG=$${machine_config} \
435 MAKEFILES=${SOURCE}/Makefile \
436 SOURCE=${SOURCE}/ \
437 TARGET=$${build_subdir}/ \
438 build_mach_kernel; \
439 fi; \
1c79356b
A
440 done;
441
442#
443# Build all architectures for all Configuration/Architecture options
444#
445do_build_mach_kernel:
446
447build_mach_kernel:
b0d623f7 448 $(_v)${MAKE} do_build_mach_kernel;
1c79356b 449
55e303ae 450
1c79356b
A
451#
452#
453# Install dependencies order
454#
9bccf70c 455.ORDER: installhdrs exporthdrs all
1c79356b
A
456
457#
458# Install kernel based on RC_ARCHS for all INSTALL_TYPES
459# Install kernel header files based on RC_ARCHS
460#
2d21ac55
A
461install: installhdrs all installman installmachinekernels
462ifeq ($(RC_ProjectName),Libsyscall)
463# nothing to do
b0d623f7
A
464else ifeq ($(findstring libkxld,$(RC_ProjectName)),libkxld)
465# nothing to do
466else # xnu or xnu_debug
2d21ac55
A
467 $(_v)rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE)); \
468 machine_config=$(MACHINE_CONFIG); \
1c79356b
A
469 for kernel_config in $(INSTALL_TYPE); \
470 do \
471 for arch_config in $(INSTALL_ARCHS); \
472 do \
2d21ac55
A
473 if [ $${arch_config} = ARM ] ; then \
474 if [ $${machine_config} = DEFAULT ] ; then \
475 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
476 fi; \
477 fi; \
478 if [ $${machine_config} = DEFAULT ] ; then \
479 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
480 else \
481 install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}/$${rel_path}; \
482 fi; \
91447636 483 [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir}; \
b0d623f7 484 ${MAKE} ${MAKEJOBS} -C $${install_subdir} \
9bccf70c 485 KERNEL_CONFIG=$${kernel_config} \
1c79356b 486 ARCH_CONFIG=$${arch_config} \
2d21ac55 487 MACHINE_CONFIG=$${machine_config} \
1c79356b
A
488 MAKEFILES=${SOURCE}/Makefile \
489 SOURCE=${SOURCE}/ \
9bccf70c 490 build_install; \
1c79356b
A
491 done; \
492 done;
b0d623f7
A
493ifeq ($(RC_ProjectName),xnu_debug)
494 $(_v)$(MKDIR) $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
495 $(_v)$(MV) $(DSTROOT)/mach_kernel* $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
496 $(_v)$(CP) $(SYMROOT)/kgmacros $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
497 $(_v)$(CP) -r $(SYMROOT)/System.kext $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
498 $(_v)$(CP) -r $(SYMROOT)/mach_kernel.dSYM $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
499 $(_v)$(CP) $(SRCROOT)/config/README.DEBUG-kernel.txt $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)
500 $(_v)$(MV) $(DSTROOT)/System $(DSTROOT)/usr $(OBJROOT)/
501endif
2d21ac55
A
502endif
503
504installmachinekernels:
505 @echo "[ $(SOURCE) ] make installmachinekernels"; \
506 my_counter=1; \
507 for my_config in $(TARGET_CONFIGS_UC); \
508 do \
509 if [ $${my_counter} -eq 1 ] ; then \
510 my_counter=2; \
511 kernel_config=$${my_config}; \
512 if [ $${kernel_config} = DEFAULT ] ; then \
513 kernel_config=$(DEFAULT_KERNEL_CONFIG); \
514 fi; \
515 elif [ $${my_counter} -eq 2 ] ; then \
516 my_counter=3; \
517 arch_config=$${my_config}; \
518 if [ $${arch_config} = DEFAULT ] ; then \
519 arch_config=`arch | $(TR) a-z A-Z`; \
520 fi; \
521 else \
522 my_counter=1; \
523 machine_config=$${my_config}; \
524 if [ $${machine_config} != DEFAULT ] ; then \
525 build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}; \
526 install_file_list=mach.`printf "%s" "$${kernel_config}" | $(TR) A-Z a-z`.`printf "%s" "$${machine_config}" | $(TR) A-Z a-z`; \
527 [ -d $${build_subdir} ] || $(MKDIR) $${build_subdir}; \
b0d623f7 528 ${MAKE} ${MAKEJOBS} -C $${build_subdir} \
2d21ac55
A
529 INSTALL_FILE_LIST=$${install_file_list} \
530 KERNEL_CONFIG=$${kernel_config} \
531 ARCH_CONFIG=$${arch_config} \
532 MACHINE_CONFIG=$${machine_config} \
533 MAKEFILES=${SOURCE}/Makefile \
534 SOURCE=${SOURCE}/ \
535 TARGET=$${build_subdir}/ \
536 do_build_install; \
537 fi; \
538 fi; \
539 done;
1c79356b
A
540
541#
542# Install for all architectures for all Configuration/Architecture options
543#
544setup_build_install:
545
546do_build_install:
547
b0d623f7
A
548BUILD_INSTALL_SUBDIRS_TARGETS = $(addprefix build_install_,$(INST_SUBDIRS))
549
550.PHONY: $(BUILD_INSTALL_SUBDIRS_TARGETS)
551
552$(BUILD_INSTALL_SUBDIRS_TARGETS):
2d21ac55
A
553 $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \
554 TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
555 else \
556 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)"; \
557 fi; \
0b4e3aa0 558 ${MAKE} TARGET=$${TARGET} setup_build_install; \
1c79356b 559 kernel_config=$(KERNEL_CONFIG); \
b0d623f7
A
560 install_subdir="$(patsubst build_install_%,%,$@)"; \
561 [ -d $${install_subdir} ] || $(MKDIR) $${install_subdir}; \
562 ${MAKE} -C $${install_subdir} \
563 KERNEL_CONFIG=$${kernel_config} \
564 MAKEFILES=${SOURCE}/$${install_subdir}/Makefile \
565 SOURCE=${SOURCE}$${install_subdir}/ \
566 TARGET=$${TARGET} \
567 build_install;
568
569build_install: $(BUILD_INSTALL_SUBDIRS_TARGETS)
570 $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \
571 TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT); \
572 else \
573 TARGET="$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)"; \
574 fi; \
575 ${MAKE} TARGET=$${TARGET} do_build_install;
1c79356b
A
576
577
578#
579# Install source tree
580#
9bccf70c 581installsrc:
b0d623f7 582 $(_v)($(TAR) -c --mode go=r,+X --no-ignore-case --exclude .svn --exclude cscope.\* --exclude BUILD --exclude \*~ -f - .) | (cd $(SRCROOT) && $(TAR) --no-same-owner -xf -)
1c79356b
A
583
584
585#
586# Clean up source tree
587#
9bccf70c 588clean:
1c79356b
A
589
590#
591# Build source file list for cscope database and tags
592#
593cscope.files:
594 @echo "Building file list for cscope and tags"
0c530ab8
A
595 @find . -name '*.h' -type f | grep -v ^..BUILD > _cscope.files 2> /dev/null
596 @find . -name '*.defs' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
597 @find . -name '*.c' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
598 @find . -name '*.cpp' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
599 @find . -name '*.s' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
600 @find . -name '*.h.template' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
601 @echo -k -q -c > cscope.files 2> /dev/null
602 @sort -u < _cscope.files >> cscope.files 2> /dev/null
603 @rm -f _cscope.files _cscope.files2 2> /dev/null
1c79356b
A
604
605#
606# Build cscope database
607#
608cscope: cscope.files
609 @echo "Building cscope database"
0c530ab8 610 @cscope -bvU 2> /dev/null
1c79356b
A
611
612#
613# Build tags
614#
615
616tags: cscope.files
617 @echo "Building ctags"
2d21ac55 618 @-sed 1d cscope.files | xargs ctags -dtw 2> /dev/null || \
1c79356b 619 echo "Phantom files detected!" 2>&1 > /dev/null
2d21ac55
A
620 @-[ -f TAGS ] || ${MAKE} TAGS
621
622TAGS: cscope.files
1c79356b
A
623 @echo "Building etags"
624 @-cat cscope.files | etags -l auto -S - 2> /dev/null
625
9bccf70c
A
626#
627# Install Man Pages
628#
629installman:
2d21ac55
A
630ifeq ($(RC_ProjectName),Libsyscall)
631 bsdmake -C libsyscall install-man
b0d623f7
A
632else ifeq ($(findstring libkxld,$(RC_ProjectName)),libkxld)
633# nothing to do
634else # xnu or xnu_debug
2d21ac55
A
635 @echo "[ $(SRCROOT) ] Installing man pages"
636 $(_v)manpath=$(DSTROOT)/$(MANDIR); \
91447636 637 [ -d $$manpath ] || $(MKDIR) $$manpath; \
b0d623f7 638 ${MAKE} ${MAKEJOBS} MAKEFILES=${SOURCE}/Makefile \
9bccf70c
A
639 SOURCE=${SOURCE}/ \
640 TARGET=${DSTROOT}/ \
641 build_installman
b0d623f7 642 ${SRCROOT}/config/compress-man-pages.pl ${DSTROOT}/${MANDIR}
2d21ac55 643endif
9bccf70c
A
644
645do_installman:
646
b0d623f7
A
647BUILD_INSTALLMAN_SUBDIRS_TARGETS = $(addprefix build_installman_,$(INSTMAN_SUBDIRS))
648
649.PHONY: $(BUILD_INSTALLMAN_SUBDIRS_TARGETS)
650
651$(BUILD_INSTALLMAN_SUBDIRS_TARGETS):
652 $(_v)installman_subdir="$(patsubst build_installman_%,%,$@)"; \
653 ${MAKE} -C $${installman_subdir} -r \
654 MAKEFILES=$(SOURCE)$${installman_subdir}/Makefile \
655 SOURCE=$(SOURCE)$${installman_subdir}/ \
656 TARGET=$(TARGET)$${installman_subdir}/ \
657 build_installman;
658
659build_installman: $(BUILD_INSTALLMAN_SUBDIRS_TARGETS)
660 $(_v)if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \
661 ${MAKE} do_installman; \
1c79356b 662 fi
2d21ac55
A
663
664# vim: set ft=make: