]> git.saurik.com Git - apple/xnu.git/blob - makedefs/MakeInc.top
xnu-2782.1.97.tar.gz
[apple/xnu.git] / makedefs / MakeInc.top
1 # -*- mode: makefile;-*-
2 #
3 # Copyright (C) 2010-2012 Apple Inc. All rights reserved.
4 #
5 # MakeInc.top is the top-level makefile for the xnu
6 # build system. All the main XBS targets
7 # (like "installhdrs") are defined here, as
8 # well as globals that can be overridden on
9 # the command-line by the user.
10 #
11 # This makefile's main purpose is to bootstrap
12 # the user's intent ("build these 3 kernels")
13 # into 3 single-architecture builds that each
14 # invoke the recursive make build system.
15 # As such, we have no knowledge of how to build
16 # a kernel or perform actions other than
17 # invoking a sub-make with a different
18 # current directory, makefile, and target. One
19 # side effect of this is that each
20 # single-architecture build is responsible for
21 # inserting its build products into the final
22 # multi-architecture output files. To avoid
23 # races, these aggregating stages for
24 # "primary" build configs are done in serial.
25 #
26
27 export MakeInc_cmd=${VERSDIR}/makedefs/MakeInc.cmd
28
29 include $(MakeInc_cmd)
30
31
32 #
33 # Architecture Configuration options
34 #
35
36 # Default to current kernel architecture
37 ifneq ($(filter iPhoneOS iPhoneOSNano,$(PLATFORM)),)
38 override DEFAULT_ARCH_CONFIG := ARM
39 else ifneq ($(filter iPhoneSimulator iPhoneNanoSimulator,$(PLATFORM)),)
40 override DEFAULT_ARCH_CONFIG := X86_64
41 else
42 override DEFAULT_ARCH_CONFIG := X86_64
43 endif
44
45
46 # Accept either explicit ARCH_CONFIGS or XBS-style RC_ARCHS
47 ifndef ARCH_CONFIGS
48 ifdef RC_ARCHS
49 ARCH_CONFIGS := $(shell printf "%s" "$(RC_ARCHS)" | $(TR) a-z A-Z | sed -E 's/ARMV[0-9][A-Z]?/ARM/g' | $(TR) " " "\n" | sort -u | $(TR) "\n" " ")
50 else
51 ARCH_CONFIGS := DEFAULT
52 endif
53 endif
54
55 #
56 # Kernel Configuration options
57 #
58
59 ifeq ($(RC_ProjectName),xnu_debug)
60 override DEFAULT_KERNEL_CONFIG := DEBUG
61 else ifneq ($(filter iPhoneOS iPhoneOSNano,$(PLATFORM)),)
62 override DEFAULT_KERNEL_CONFIG := DEVELOPMENT
63 else ifeq ($(PLATFORM),MacOSX)
64 override DEFAULT_KERNEL_CONFIG := DEVELOPMENT
65 else
66 override DEFAULT_KERNEL_CONFIG := RELEASE
67 endif
68
69 # If KERNEL_CONFIGS is specified it should override default
70 ifndef KERNEL_CONFIGS
71 KERNEL_CONFIGS := DEFAULT
72 endif
73
74 #
75 # Machine Configuration options
76 #
77
78 override DEFAULT_I386_MACHINE_CONFIG := NONE
79 override DEFAULT_X86_64_MACHINE_CONFIG := NONE
80 override DEFAULT_X86_64H_MACHINE_CONFIG := NONE
81
82
83 # This is typically never specified (TARGET_CONFIGS is used)
84 ifndef MACHINE_CONFIGS
85 MACHINE_CONFIGS := DEFAULT
86 endif
87
88 #
89 # Target configuration options. NOTE - target configurations will
90 # override ARCH_CONFIGS and KERNEL_CONFIGS and MACHINE_CONFIGS.
91 #
92 # Target configs come in groups of three parameters. The first is the
93 # kernel configuration, the second is the architecture configuration,
94 # and the third is the machine configuration. You may pass in as
95 # many groups of configurations as you wish. Each item passed in is
96 # seperated by whitespace.
97 #
98 # Example:
99 # TARGET_CONFIGS="release ppc default debug i386 default release arm MX31ADS"
100 # Parameters may be in upper or lower case (they are converted to upper).
101 #
102 # "default" parameter is a special case. It means use the default value for
103 # that parameter. Here are the default values for each configuration:
104 #
105 # default kernel configuration = DEFAULT_KERNEL_CONFIG
106 # default architecture configuration = system architecture where you are running make.
107
108
109 ifeq ($(PLATFORM),MacOSX)
110
111 # Defaults for "make all_desktop"
112 ifeq ($(KERNEL_CONFIGS),DEFAULT)
113 KERNEL_CONFIGS_DESKTOP := RELEASE DEVELOPMENT
114 else
115 KERNEL_CONFIGS_DESKTOP := $(KERNEL_CONFIGS)
116 endif
117
118 endif
119
120 ifndef TARGET_CONFIGS
121 ifneq ($(PRODUCT_CONFIGS),)
122 # generate TARGET_CONFIGS using KERNEL_CONFIGS and PRODUCT_CONFIGS
123 TARGET_CONFIGS := $(foreach my_kernel_config,$(KERNEL_CONFIGS),$(foreach my_product_config,$(shell printf "%s" "$(PRODUCT_CONFIGS)" | $(TR) A-Z a-z),$(my_kernel_config) $(subst ;, ,$(call function_lookup_product,$(my_product_config)))))
124 else ifneq ($(filter %_release_embedded,$(MAKECMDGOALS)),)
125 # generate TARGET_CONFIGS for RELEASE kernel configs and products in the device map
126 TARGET_CONFIGS := $(foreach my_kernel_config,RELEASE,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(my_kernel_config) $(subst ;, ,$(call function_lookup_product,$(my_product_config))))))
127 else ifneq ($(filter %_development_embedded,$(MAKECMDGOALS)),)
128 # generate TARGET_CONFIGS for DEVELOPMENT kernel configs and products in the device map
129 TARGET_CONFIGS := $(foreach my_kernel_config,DEVELOPMENT,$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(my_kernel_config) $(subst ;, ,$(call function_lookup_product,$(my_product_config))))))
130 else ifneq ($(filter %_embedded,$(MAKECMDGOALS)),)
131 # generate TARGET_CONFIGS for all kernel configs and products in the device map
132 TARGET_CONFIGS := $(foreach my_kernel_config,$(KERNEL_CONFIGS_EMBEDDED),$(foreach my_arch_config,$(ARCH_CONFIGS_EMBEDDED),$(foreach my_product_config,$(DEVICEMAP_PRODUCTS_$(my_arch_config)),$(my_kernel_config) $(subst ;, ,$(call function_lookup_product,$(my_product_config))))))
133 else ifneq ($(filter %_desktop,$(MAKECMDGOALS)),)
134 # generate TARGET_CONFIGS for all kernel configs for B&I
135 TARGET_CONFIGS := $(foreach my_kern_config, $(KERNEL_CONFIGS_DESKTOP), $(foreach my_arch_config, $(ARCH_CONFIGS), $(foreach my_machine_config, $(MACHINE_CONFIGS), $(my_kern_config) $(my_arch_config) $(my_machine_config))))
136 else
137 # generate TARGET_CONFIGS using KERNEL_CONFIGS and ARCH_CONFIGS and MACHINE_CONFIGS (which defaults to "DEFAULT")
138 TARGET_CONFIGS := $(foreach my_kern_config, $(KERNEL_CONFIGS), $(foreach my_arch_config, $(ARCH_CONFIGS), $(foreach my_machine_config, $(MACHINE_CONFIGS), $(my_kern_config) $(my_arch_config) $(my_machine_config))))
139 endif
140 endif
141
142 ifeq ($(TARGET_CONFIGS),)
143 $(error No TARGET_CONFIGS specified)
144 endif
145
146 TARGET_CONFIGS_UC := $(strip $(shell printf "%s" "$(TARGET_CONFIGS)" | $(TR) a-z A-Z))
147
148 #
149 # Build Configurations
150 #
151 # TARGET_CONFIGS is unwieldy for use in Makefiles. Convert them to
152 # "build configurations" which are tuples joined by "^". For
153 # example, "RELEASE I386 DEFAULT DEVELOPMENT ARM DEFAULT" becomes
154 # "RELEASE^I386^NONE DEVELOPMENT^ARM^S5L8920X", which can be looped
155 # over trivially. PRIMARY_BUILD_CONFIGS is the first config
156 # for each architecture, used primarily for machine-dependent recursion.
157
158 BUILD_CONFIGS = $(call function_create_build_configs, $(TARGET_CONFIGS_UC))
159
160 PRIMARY_ARCHS = $(strip $(sort $(foreach build_config, $(BUILD_CONFIGS), $(call function_extract_arch_config_from_build_config, $(build_config)))))
161 PRIMARY_BUILD_CONFIGS = $(strip $(foreach arch, $(PRIMARY_ARCHS), $(firstword $(foreach build_config, $(BUILD_CONFIGS), $(if $(filter $(arch),$(call function_extract_arch_config_from_build_config, $(build_config))), $(build_config), )))))
162 NON_PRIMARY_BUILD_CONFIGS = $(strip $(filter-out $(PRIMARY_BUILD_CONFIGS), $(BUILD_CONFIGS)))
163 FIRST_BUILD_CONFIG = $(firstword $(BUILD_CONFIGS))
164
165 # $(warning PRIMARY_ARCHS is $(PRIMARY_ARCHS))
166 # $(warning TARGET_CONFIGS is $(TARGET_CONFIGS))
167 # $(warning BUILD_CONFIGS is $(BUILD_CONFIGS))
168 # $(warning PRIMARY_BUILD_CONFIGS is $(PRIMARY_BUILD_CONFIGS))
169 # $(warning NON_PRIMARY_BUILD_CONFIGS is $(NON_PRIMARY_BUILD_CONFIGS))
170
171 MEMORY_SIZE := $(shell /usr/sbin/sysctl -n hw.memsize)
172
173 # Assume LTO scaling by default, unless it is being explicitly passed on the command-line
174 LARGE_BUILD_FOOTPRINT := $(if $(BUILD_LTO),$(BUILD_LTO),1)
175
176 ifeq ($(LARGE_BUILD_FOOTPRINT),1)
177 RAM_PER_KERNEL_BUILD := 8589934592
178 else
179 RAM_PER_KERNEL_BUILD := 268435456
180 endif
181
182 KERNEL_BUILDS_IN_PARALLEL := $(shell if [ $(MEMORY_SIZE) -le $$((1 * $(RAM_PER_KERNEL_BUILD))) ]; then echo 1; elif [ $(MEMORY_SIZE) -gt $$(($(SYSCTL_HW_PHYSICALCPU) * $(RAM_PER_KERNEL_BUILD))) ]; then echo $(SYSCTL_HW_PHYSICALCPU); else expr $(MEMORY_SIZE) / $(RAM_PER_KERNEL_BUILD); fi )
183 # $(warning Building $(KERNEL_BUILDS_IN_PARALLEL) kernels in parallel)
184
185 #
186 # TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template
187 #
188 # $(1) is the name of the makefile target to invoke for the each build config
189 # after setting up the parallel hierarchy in the TARGET directory
190 # $(2) is an optional suffix on the TARGET directory, which might even be
191 # "/.."
192 # $(3) are any dependencies for the bootstrap target
193 # $(4) are any dependencies that are expanded per-build config to another bootstrap target
194 # $(5) is how many build configurations to build in parallel
195 # $(6) is which build configs to build in parallel
196 #
197 # Since building many configurations in parallel may overwhelm the system,
198 # we try to throttle behavior into more managable S "stripes" of N/S
199 # configurations by generating sequential dependencies between configs
200 # in each stripe. That ensures that only S kernel builds are occurring
201 # at once at any point in time
202
203 define TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template
204
205 # Create a list of synthesized targets for each build config
206 $(1)_bootstrap_target_list = $$(addprefix $(1)_bootstrap_,$(6))
207
208 .PHONY: $$($(1)_bootstrap_target_list)
209
210 $(1)_generated_stripe_dependencies = $$(call _function_generate_stripe_groupings,$(1),$(5),$(call reverse,$(6)))
211 ifeq ($$(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
212 $$(warning Generate makefile fragment: $$($(1)_generated_stripe_dependencies))
213 endif
214 $$(eval $$($(1)_generated_stripe_dependencies))
215
216
217 $$($(1)_bootstrap_target_list): $(1)_bootstrap_% : $(1)_stripe_dep_for_% $$(addsuffix _bootstrap_%,$(4)) $(3)
218 $$(_v)$$(MKDIR) $${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@))$(2)
219 $$(_v)$${MAKE} \
220 -C $${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@))$(2) \
221 -f $${SRCROOT}/Makefile \
222 CURRENT_KERNEL_CONFIG=$$(call function_extract_kernel_config_from_build_config,$$(patsubst $(1)_bootstrap_%,%,$$@)) \
223 CURRENT_ARCH_CONFIG=$$(call function_extract_arch_config_from_build_config,$$(patsubst $(1)_bootstrap_%,%,$$@)) \
224 CURRENT_MACHINE_CONFIG=$$(call function_extract_machine_config_from_build_config,$$(patsubst $(1)_bootstrap_%,%,$$@)) \
225 CURRENT_BUILD_CONFIG=$$(patsubst $(1)_bootstrap_%,%,$$@) \
226 PRIMARY_BUILD_CONFIGS="$(PRIMARY_BUILD_CONFIGS)" \
227 SOURCE=$${SRCROOT}/ \
228 RELATIVE_SOURCE_PATH=. \
229 TARGET=$${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@))$(2)/ \
230 OBJPATH=$${OBJROOT}/$$(call function_convert_build_config_to_objdir,$$(patsubst $(1)_bootstrap_%,%,$$@)) \
231 $(1)
232
233 .PHONY: $(1)_bootstrap
234
235 $(1)_bootstrap: $$($(1)_bootstrap_target_list)
236 endef
237
238 #
239 # TOP_LEVEL_STRIPE_DEPENDENCY_template
240 #
241 # $(1) is the Makefile target we are building for
242 # $(2) is the build config that must build first
243 # $(3) is the build config that must build after $(2)
244
245 define TOP_LEVEL_STRIPE_DEPENDENCY_template
246
247 .PHONY: $(1)_stripe_dep_for_$(3)
248
249 $(1)_stripe_dep_for_$(3): $(if $(2),$(1)_bootstrap_$(2))
250
251 endef
252
253 # $(1) is the Makefile target we are building for
254 # $(2) is the stripe size
255 # $(3) is the list of the build configs in the current group
256 # $(4) is the list of remaining build configs
257 _function_generate_stripe_groupings_recursive = $(foreach stripe_index,$(call sequence,$(2)),$(if $(word $(stripe_index),$(4)),$(call TOP_LEVEL_STRIPE_DEPENDENCY_template,$(1),$(word $(stripe_index),$(3)),$(word $(stripe_index),$(4))))) $(if $(word $(call increment,$(2)),$(4)),$(call _function_generate_stripe_groupings_recursive,$(1),$(2),$(wordlist 1,$(2),$(4)),$(wordlist $(call increment,$(2)),$(words $(4)),$(4))))
258
259
260 # $(1) is the Makefile target we are building for
261 # $(2) is the stripe size
262 # $(3) is the list of the build configs
263 _function_generate_stripe_groupings = $(call _function_generate_stripe_groupings_recursive,$(1),$(2),,$(3))
264
265 #
266 # Setup pass for build system tools
267 #
268
269 generated_top_level_build_setup = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_setup,/..,,,1,$(FIRST_BUILD_CONFIG))
270 ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
271 $(warning Generate makefile fragment: $(generated_top_level_build_setup))
272 endif
273 $(eval $(generated_top_level_build_setup))
274
275 .PHONY: setup
276
277 # invalidate current kernel in $(SYMROOT). Timestamp must be +1 from a previous kernel build
278 setup: build_setup_bootstrap
279 $(_v)$(TOUCH) $(OBJROOT)/.mach_kernel.timestamp.new
280 $(_v)while [ \! $(OBJROOT)/.mach_kernel.timestamp.new -nt $(OBJROOT)/.mach_kernel.timestamp ]; do \
281 $(SLEEP) 1; \
282 $(TOUCH) $(OBJROOT)/.mach_kernel.timestamp.new; \
283 done
284 $(_v)$(MV) $(OBJROOT)/.mach_kernel.timestamp.new $(OBJROOT)/.mach_kernel.timestamp
285 $(_v)$(TOUCH) $(OBJROOT)/.symbolset.timestamp.new
286 $(_v)while [ \! $(OBJROOT)/.symbolset.timestamp.new -nt $(OBJROOT)/.symbolset.timestamp ]; do \
287 $(SLEEP) 1; \
288 $(TOUCH) $(OBJROOT)/.symbolset.timestamp.new; \
289 done
290 $(_v)$(MV) $(OBJROOT)/.symbolset.timestamp.new $(OBJROOT)/.symbolset.timestamp
291
292 #
293 # Install kernel header files
294 #
295 .PHONY: exporthdrs exporthdrs_mi exporthdrs_md
296
297 exporthdrs: exporthdrs_mi exporthdrs_md
298
299 #
300 # Install machine independent kernel header files
301 #
302
303 generated_top_level_build_exporthdrs_mi = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_exporthdrs_mi,,setup,,1,$(FIRST_BUILD_CONFIG))
304 ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
305 $(warning Generate makefile fragment: $(generated_top_level_build_exporthdrs_mi))
306 endif
307 $(eval $(generated_top_level_build_exporthdrs_mi))
308
309 exporthdrs_mi: build_exporthdrs_mi_bootstrap
310
311 #
312 # Install machine dependent kernel header files
313 #
314
315 generated_top_level_build_exporthdrs_md = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_exporthdrs_md,,setup,,$(KERNEL_BUILDS_IN_PARALLEL),$(PRIMARY_BUILD_CONFIGS))
316 ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
317 $(warning Generate makefile fragment: $(generated_top_level_build_exporthdrs_md))
318 endif
319 $(eval $(generated_top_level_build_exporthdrs_md))
320
321 exporthdrs_md: build_exporthdrs_md_bootstrap
322
323 #
324 # Install kernel header files
325 #
326
327 .PHONY: installhdrs installhdrs_mi installhdrs_md
328
329 ifeq ($(RC_ProjectName),xnu_debug)
330 installhdrs:
331 @:
332 else
333
334 installhdrs: installhdrs_mi installhdrs_md
335 endif
336
337 .PHONY: installhdrs_embedded installhdrs_release_embedded installhdrs_development_embedded installhdrs_desktop
338
339 installhdrs_embedded installhdrs_release_embedded installhdrs_desktop: installhdrs
340
341 installhdrs_development_embedded:
342
343 #
344 # Install machine independent header files
345 #
346
347 generated_top_level_build_installhdrs_mi = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_installhdrs_mi,,setup,build_exporthdrs_mi,1,$(FIRST_BUILD_CONFIG))
348 ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
349 $(warning Generate makefile fragment: $(generated_top_level_build_installhdrs_mi))
350 endif
351 $(eval $(generated_top_level_build_installhdrs_mi))
352
353 installhdrs_mi: build_installhdrs_mi_bootstrap
354
355 #
356 # Install machine dependent kernel header files
357 #
358
359 generated_top_level_build_installhdrs_md = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_installhdrs_md,,setup,build_exporthdrs_md,$(KERNEL_BUILDS_IN_PARALLEL),$(PRIMARY_BUILD_CONFIGS))
360 ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
361 $(warning Generate makefile fragment: $(generated_top_level_build_installhdrs_md))
362 endif
363 $(eval $(generated_top_level_build_installhdrs_md))
364
365 installhdrs_md: build_installhdrs_md_bootstrap
366
367 #
368 # Install text files (man pages, dtrace scripts, etc.)
369 #
370
371 generated_top_level_textfiles_install = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,textfiles_install,,setup,,1,$(FIRST_BUILD_CONFIG))
372 ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
373 $(warning Generate makefile fragment: $(generated_top_level_textfiles_install))
374 endif
375 $(eval $(generated_top_level_textfiles_install))
376
377 .PHONY: install_textfiles
378
379 install_textfiles: textfiles_install_bootstrap
380
381 #
382 # Build all architectures for all Configuration/Architecture options
383 #
384
385 generated_top_level_build_all = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_all,,setup exporthdrs,,$(KERNEL_BUILDS_IN_PARALLEL),$(BUILD_CONFIGS))
386 ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
387 $(warning Generate makefile fragment: $(generated_top_level_build_all))
388 endif
389 $(eval $(generated_top_level_build_all))
390
391 .PHONY: build
392
393 build: build_all_bootstrap
394
395 #
396 # Post-process build results
397 #
398
399 generated_top_level_config_all = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,config_all,,setup,build_all,$(KERNEL_BUILDS_IN_PARALLEL),$(BUILD_CONFIGS))
400 ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
401 $(warning Generate makefile fragment: $(generated_top_level_config_all))
402 endif
403 $(eval $(generated_top_level_config_all))
404
405 .PHONY: all config
406
407 all config: config_all_bootstrap
408
409 .PHONY: all_embedded all_release_embedded all_development_embedded all_desktop
410
411 all_embedded all_release_embedded all_development_embedded all_desktop: all
412
413 #
414 # Install kernel files
415 #
416
417 generated_top_level_build_install_primary = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_install_primary,,setup,config_all,1,$(PRIMARY_BUILD_CONFIGS))
418 ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
419 $(warning Generate makefile fragment: $(generated_top_level_build_install_primary))
420 endif
421 $(eval $(generated_top_level_build_install_primary))
422
423 .PHONY: install_primary
424
425 install_primary: build_install_primary_bootstrap
426
427 generated_top_level_build_install_non_primary = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,build_install_non_primary,,setup,config_all,$(KERNEL_BUILDS_IN_PARALLEL),$(NON_PRIMARY_BUILD_CONFIGS))
428 ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
429 $(warning Generate makefile fragment: $(generated_top_level_build_install_non_primary))
430 endif
431 $(eval $(generated_top_level_build_install_non_primary))
432
433 .PHONY: install_non_primary
434
435 install_non_primary: build_install_non_primary_bootstrap
436
437 generated_top_level_config_install = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,config_install,,setup,config_all,1,$(PRIMARY_BUILD_CONFIGS))
438 ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
439 $(warning Generate makefile fragment: $(generated_top_level_config_install))
440 endif
441 $(eval $(generated_top_level_config_install))
442
443 .PHONY: install_config final_touch_config_timestamps
444
445 install_config: config_install_bootstrap final_touch_config_timestamps
446
447 # Tell the next build the latest timestamp of any potential file in DSTROOT/SYMROOT
448 final_touch_config_timestamps: config_install_bootstrap
449 $(_v)$(TOUCH) $(OBJROOT)/.symbolset.timestamp
450
451 #
452 # Aggregate install targets, which install everything appropriate for the current build alias/make target
453 #
454
455 .PHONY: install
456
457 ifeq ($(RC_ProjectName),xnu_debug)
458 install: install_kernels
459 else ifeq ($(RC_ProjectName),xnu_headers_Sim)
460 install: installhdrs
461 else
462
463 install: installhdrs install_textfiles install_config install_kernels
464 endif
465
466 .PHONY: install_embedded install_release_embedded install_development_embedded install_desktop
467
468 # By default, all kernel files, headers, text files, and pseudo-kexts are installed
469 install_embedded install_release_embedded install_desktop: install
470
471 # These special configs only install the kernel files
472 install_development_embedded: install_kernels
473
474 .PHONY: install_kernels final_touch_kernel_timestamps
475
476 install_kernels: build_install_primary_bootstrap build_install_non_primary_bootstrap final_touch_kernel_timestamps
477
478 # Tell the next build the latest timestamp of any potential file in DSTROOT/SYMROOT
479 final_touch_kernel_timestamps: build_install_primary_bootstrap build_install_non_primary_bootstrap
480 $(_v)$(TOUCH) $(OBJROOT)/.mach_kernel.timestamp
481
482 #
483 # Install source tree
484 #
485 .PHONY: installsrc
486
487 installsrc:
488 @echo INSTALLSRC $(SRCROOT)
489 $(_v)$(MKDIR) $(SRCROOT)
490 $(_v)$(FIND) -x . \! \( \( -name BUILD -o -name .svn -o -name .git -o -name cscope.\* -o -name \*~ \) -prune \) -print0 | $(PAX) -rw -p a -d0 $(SRCROOT)
491 $(_v)$(CHMOD) -R go+rX $(SRCROOT)
492
493
494 #
495 # Clean up source tree
496 #
497 .PHONY: clean
498
499 clean:
500 @:
501 @rm -f cscope.* 2> /dev/null
502 @rm -f $(OBJROOT)/cscope.genhdrs/* 2> /dev/null || true
503 @rm -f TAGS 2> /dev/null
504
505
506 #
507 # Build source file list for cscope database and tags
508 #
509 .PHONY: cscope.files
510
511 cscope.files:
512 @echo "Building file list for cscope and tags"
513 @find . -name '*.h' -type f | grep -v ^..BUILD > _cscope.files 2> /dev/null
514 @find . -name '*.defs' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
515 @find . -name '*.c' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
516 @find . -name '*.cpp' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
517 @find . -name '*.s' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
518 @find . -name '*.h.template' -type f | grep -v ^..BUILD >> _cscope.files 2> /dev/null
519 @cat $(OBJROOT)/cscope.genhdrs/* >> _cscope.files 2> /dev/null || true
520 @echo -k -q -c > cscope.files 2> /dev/null
521 @sort -u < _cscope.files >> cscope.files 2> /dev/null
522 @rm -f _cscope.files _cscope.files2 2> /dev/null
523
524 #
525 # Build cscope database
526 #
527 cscope: cscope.files
528 @echo "Building cscope database"
529 @cscope -bvU 2> /dev/null
530
531 #
532 # Build tags
533 #
534 tags: cscope.files
535 @echo "Building ctags"
536 @-sed 1d cscope.files | xargs ctags -dtw 2> /dev/null || \
537 echo "Phantom files detected!" 2>&1 > /dev/null
538 @-[ -f TAGS ] || ${MAKE} -f $(firstword $(MAKEFILE_LIST)) TAGS
539
540 TAGS: cscope.files
541 @echo "Building etags"
542 @-cat cscope.files | etags -l auto -S - 2> /dev/null
543 @rm -f cscope.files 2> /dev/null
544
545 help:
546 @cat README
547
548 print_exports:
549 $(_v)printenv | sort
550
551
552 generated_top_level_print_exports = $(call TOP_LEVEL_EACH_BUILD_CONFIG_BOOTSTRAP_template,print_exports,,,,1,$(FIRST_BUILD_CONFIG))
553 ifeq ($(VERBOSE_GENERATED_MAKE_FRAGMENTS),YES)
554 $(warning Generate makefile fragment: $(generated_top_level_print_exports))
555 endif
556 $(eval $(generated_top_level_print_exports))
557
558 print_exports_first_build_config: print_exports_bootstrap