1 # -*- mode: makefile;-*-
3 # Copyright (C) 1999-2017 Apple Inc. All rights reserved.
5 # MakeInc.def contains global definitions for building,
6 # linking, and installing files.
10 # Architecture Configuration options
12 SUPPORTED_ARCH_CONFIGS := X86_64 X86_64H
15 # Kernel Configuration options
17 SUPPORTED_KERNEL_CONFIGS = RELEASE DEVELOPMENT DEBUG PROFILE KASAN
20 # Machine Configuration options
23 SUPPORTED_X86_64_MACHINE_CONFIGS = NONE
24 SUPPORTED_X86_64H_MACHINE_CONFIGS = NONE
28 # Setup up *_LC variables during recursive invocations
31 ifndef CURRENT_ARCH_CONFIG_LC
32 export CURRENT_ARCH_CONFIG_LC := $(shell printf "%s" "$(CURRENT_ARCH_CONFIG)" | $(TR) A-Z a-z)
35 ifndef CURRENT_KERNEL_CONFIG_LC
36 export CURRENT_KERNEL_CONFIG_LC := $(shell printf "%s" "$(CURRENT_KERNEL_CONFIG)" | $(TR) A-Z a-z)
39 ifndef CURRENT_MACHINE_CONFIG_LC
40 export CURRENT_MACHINE_CONFIG_LC := $(shell printf "%s" "$(CURRENT_MACHINE_CONFIG)" | $(TR) A-Z a-z)
46 COMPONENT_LIST = osfmk bsd libkern iokit pexpert libsa security san
47 COMPONENT = $(if $(word 2,$(subst /, ,$(RELATIVE_SOURCE_PATH))),$(word 2,$(subst /, ,$(RELATIVE_SOURCE_PATH))),$(firstword $(subst /, ,$(RELATIVE_SOURCE_PATH))))
48 COMPONENT_IMPORT_LIST = $(filter-out $(COMPONENT),$(COMPONENT_LIST))
52 # Deployment target flag
54 ifeq ($(PLATFORM),MacOSX)
55 DEPLOYMENT_TARGET_FLAGS = -mmacosx-version-min=$(SDKVERSION)
56 else ifeq ($(PLATFORM),WatchOS)
57 DEPLOYMENT_TARGET_FLAGS = -mwatchos-version-min=$(SDKVERSION)
58 else ifeq ($(PLATFORM),tvOS)
59 DEPLOYMENT_TARGET_FLAGS = -mtvos-version-min=$(SDKVERSION)
60 else ifeq ($(PLATFORM),AppleTVOS)
61 DEPLOYMENT_TARGET_FLAGS = -mtvos-version-min=$(SDKVERSION)
62 else ifeq ($(PLATFORM),BridgeOS)
63 DEPLOYMENT_TARGET_FLAGS = -mbridgeos-version-min=$(SDKVERSION) -DXNU_TARGET_OS_BRIDGE
64 else ifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),)
65 DEPLOYMENT_TARGET_FLAGS = -miphoneos-version-min=$(SDKVERSION)
66 else ifneq ($(filter $(SUPPORTED_SIMULATOR_PLATFORMS),$(PLATFORM)),)
67 DEPLOYMENT_TARGET_FLAGS =
69 DEPLOYMENT_TARGET_FLAGS =
72 DEPLOYMENT_TARGET_DEFINES = -DPLATFORM_$(PLATFORM)
76 # Standard defines list
78 DEFINES = -DAPPLE -DKERNEL -DKERNEL_PRIVATE -DXNU_KERNEL_PRIVATE \
79 -DPRIVATE -D__MACHO__=1 -Dvolatile=__volatile $(CONFIG_DEFINES) \
91 # Compiler warning flags
95 ifneq ($(BUILD_WERROR),)
96 USE_WERROR := $(BUILD_WERROR)
99 ifeq ($(USE_WERROR),1)
103 # Shared C/C++ warning flags
109 -Wno-bad-function-cast \
112 -Wno-conditional-uninitialized \
115 -Wstring-conversion \
116 -Wliteral-conversion \
117 -Wnon-literal-null-conversion \
121 -Wconstant-conversion \
122 -Wpointer-bool-conversion \
123 -Wno-covered-switch-default \
124 -Wno-disabled-macro-expansion \
125 -Wno-documentation-unknown-command \
126 -Wno-format-non-iso \
127 -Wno-format-nonliteral \
128 -Wno-reserved-id-macro \
129 -Wno-language-extension-token \
130 -Wno-missing-variable-declarations \
133 -Wno-partial-availability \
134 -Wno-shift-sign-overflow \
138 -Wno-used-but-marked-unused \
139 -Wno-variadic-macros \
141 -Wno-zero-length-array
143 WARNFLAGS_STD := $(WARNFLAGS_STD) \
144 -Wno-unknown-warning-option \
145 -Wno-error=shadow-field \
151 # Can be overridden in Makefile.template or Makefile.$arch
152 export CWARNFLAGS ?= $(CWARNFLAGS_STD)
154 define add_perfile_cflags
155 $(1)_CWARNFLAGS_ADD += $2
160 -Wno-c++98-compat-pedantic \
161 -Wno-exit-time-destructors \
162 -Wno-global-constructors \
163 -Wno-old-style-cast \
164 -Wno-zero-as-null-pointer-constant
166 # Can be overridden in Makefile.template or Makefile.$arch
167 export CXXWARNFLAGS ?= $(CXXWARNFLAGS_STD)
169 define add_perfile_cxxflags
170 $(1)_CXXWARNFLAGS_ADD += $2
174 # Default ARCH_FLAGS, for use with compiler/linker/assembler/mig drivers
176 ARCH_FLAGS_X86_64 = -arch x86_64
177 ARCH_FLAGS_X86_64H = -arch x86_64h
184 ifdef RC_NONARCH_CFLAGS
185 OTHER_CFLAGS = $(RC_NONARCH_CLFAGS)
191 DSYMINFODIR = Contents
192 DSYMKGMACROSDIR = Contents/Resources
193 DSYMLLDBMACROSDIR = Contents/Resources/Python
194 DSYMDWARFDIR = Contents/Resources/DWARF
200 # We must not use -fno-keep-inline-functions, or it will remove the dtrace
201 # probes from the kernel.
203 CFLAGS_GEN = $(DEBUG_CFLAGS) -nostdinc \
204 -fno-builtin -fno-common \
205 -fsigned-bitfields $(OTHER_CFLAGS)
210 CFLAGS_KASAN = $(CFLAGS_DEVELOPMENT)
213 CFLAGS_X86_64 = -Dx86_64 -DX86_64 -D__X86_64__ -DLP64 \
214 -DPAGE_SIZE_FIXED -mkernel -msoft-float
216 CFLAGS_X86_64H = $(CFLAGS_X86_64)
219 CFLAGS_RELEASEX86_64 = -O2
220 CFLAGS_DEVELOPMENTX86_64 = -O2
221 CFLAGS_KASANX86_64 = $(CFLAGS_DEVELOPMENTX86_64)
222 # No space optimization for the DEBUG kernel for the benefit of gdb:
223 CFLAGS_DEBUGX86_64 = -O0
224 CFLAGS_PROFILEX86_64 = -O2
226 CFLAGS_RELEASEX86_64H = -O2
227 CFLAGS_DEVELOPMENTX86_64H = -O2
228 CFLAGS_KASANX86_64H = $(CFLAGS_DEVELOPMENTX86_64H)
229 # No space optimization for the DEBUG kernel for the benefit of gdb:
230 CFLAGS_DEBUGX86_64H = -O0
231 CFLAGS_PROFILEX86_64H = -O2
233 CFLAGS_RELEASEARM = -O2
234 CFLAGS_DEVELOPMENTARM = -O2
235 CFLAGS_DEBUGARM = -O0
236 CFLAGS_PROFILEARM = -O2
245 ifeq ($(CURRENT_KERNEL_CONFIG),KASAN)
252 KASAN_SHIFT_X86_64=0xdffffe1000000000
253 KASAN_SHIFT_X86_64H=$(KASAN_SHIFT_X86_64)
254 KASAN_SHIFT=$($(addsuffix $(CURRENT_ARCH_CONFIG),KASAN_SHIFT_))
255 KASAN_BLACKLIST=$(OBJROOT)/san/kasan-blacklist-$(CURRENT_ARCH_CONFIG_LC)
256 CFLAGS_GEN += -DKASAN=1 -DKASAN_SHIFT=$(KASAN_SHIFT) -fsanitize=address \
257 -mllvm -asan-globals-live-support \
258 -mllvm -asan-mapping-offset=$(KASAN_SHIFT) \
259 -fsanitize-blacklist=$(KASAN_BLACKLIST)
263 CFLAGS = $(CFLAGS_GEN) \
264 $($(addsuffix $(CURRENT_MACHINE_CONFIG),MACHINE_FLAGS_$(CURRENT_ARCH_CONFIG)_)) \
265 $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) \
266 $($(addsuffix $(CURRENT_ARCH_CONFIG),CFLAGS_)) \
267 $($(addsuffix $(CURRENT_KERNEL_CONFIG),CFLAGS_)) \
268 $($(addsuffix $(CURRENT_ARCH_CONFIG), $(addsuffix $(CURRENT_KERNEL_CONFIG),CFLAGS_))) \
269 $(DEPLOYMENT_TARGET_FLAGS) \
270 $(DEPLOYMENT_TARGET_DEFINES) \
279 CXXFLAGS_GEN = -std=gnu++11 -fapple-kext $(OTHER_CXXFLAGS)
281 CXXFLAGS = $(CXXFLAGS_GEN) \
282 $($(addsuffix $(CURRENT_ARCH_CONFIG),CXXFLAGS_)) \
283 $($(addsuffix $(CURRENT_KERNEL_CONFIG),CXXFLAGS_))
294 SFLAGS_GEN = -D__ASSEMBLER__ -DASSEMBLER $(OTHER_CFLAGS)
298 SFLAGS_KASAN = $(SFLAGS_DEVELOPMENT) -DKASAN=1
302 SFLAGS_X86_64 = $(CFLAGS_X86_64)
303 SFLAGS_X86_64H = $(CFLAGS_X86_64H)
305 SFLAGS = $(SFLAGS_GEN) \
306 $($(addsuffix $(CURRENT_MACHINE_CONFIG),MACHINE_FLAGS_$(CURRENT_ARCH_CONFIG)_)) \
307 $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) \
308 $($(addsuffix $(CURRENT_ARCH_CONFIG),SFLAGS_)) \
309 $($(addsuffix $(CURRENT_KERNEL_CONFIG),SFLAGS_)) \
310 $(DEPLOYMENT_TARGET_FLAGS) \
311 $(DEPLOYMENT_TARGET_DEFINES) \
317 LD = $(KC++) -nostdlib
322 # Availability of DWARF allows DTrace CTF (compressed type format) to be constructed.
323 # ctf_insert creates the CTF section. It needs reserved padding in the
324 # headers for the load command segment and the CTF section structures.
326 LDFLAGS_KERNEL_GEN = \
330 -Wl,-sectalign,__TEXT,__text,0x1000 \
331 -Wl,-sectalign,__DATA,__common,0x1000 \
332 -Wl,-sectalign,__DATA,__bss,0x1000 \
333 -Wl,-sectcreate,__PRELINK_TEXT,__text,/dev/null \
334 -Wl,-sectcreate,"__PLK_TEXT_EXEC",__text,/dev/null \
335 -Wl,-sectcreate,__PRELINK_DATA,__data,/dev/null \
336 -Wl,-sectcreate,"__PLK_DATA_CONST",__data,/dev/null \
337 -Wl,-sectcreate,"__PLK_LLVM_COV",__llvm_covmap,/dev/null \
338 -Wl,-sectcreate,"__PLK_LINKEDIT",__data,/dev/null \
339 -Wl,-sectcreate,__PRELINK_INFO,__info,/dev/null \
341 -Wl,-pagezero_size,0x0 \
342 -Wl,-version_load_command \
343 -Wl,-function_starts \
346 LDFLAGS_KERNEL_SDK = -L$(SDKROOT)/usr/local/lib/kernel -lfirehose_kernel
348 LDFLAGS_KERNEL_RELEASE =
349 LDFLAGS_KERNEL_DEVELOPMENT =
350 LDFLAGS_KERNEL_KASAN = $(LDFLAGS_KERNEL_DEVELOPMENT)
351 LDFLAGS_KERNEL_DEBUG =
352 LDFLAGS_KERNEL_PROFILE =
354 # KASLR static slide config:
358 KERNEL_MIN_ADDRESS = 0xffffff8000000000
359 KERNEL_BASE_OFFSET = 0x100000
360 KERNEL_STATIC_SLIDE = $(shell printf "0x%016x" \
361 $$[ $(SLIDE) << 21 ])
362 KERNEL_STATIC_BASE = $(shell printf "0x%016x" \
363 $$[ $(KERNEL_MIN_ADDRESS) + $(KERNEL_BASE_OFFSET) ])
364 KERNEL_HIB_SECTION_BASE = $(shell printf "0x%016x" \
365 $$[ $(KERNEL_STATIC_BASE) + $(KERNEL_STATIC_SLIDE) ])
366 KERNEL_TEXT_BASE = $(shell printf "0x%016x" \
367 $$[ $(KERNEL_HIB_SECTION_BASE) + 0x100000 ])
369 LDFLAGS_KERNEL_RELEASEX86_64 = \
371 -Wl,-segaddr,__HIB,$(KERNEL_HIB_SECTION_BASE) \
372 -Wl,-image_base,$(KERNEL_TEXT_BASE) \
373 -Wl,-seg_page_size,__TEXT,0x200000 \
374 -Wl,-sectalign,__HIB,__bootPT,0x1000 \
375 -Wl,-sectalign,__HIB,__desc,0x1000 \
376 -Wl,-sectalign,__HIB,__data,0x1000 \
377 -Wl,-sectalign,__HIB,__text,0x1000 \
378 -Wl,-sectalign,__HIB,__const,0x1000 \
379 -Wl,-sectalign,__HIB,__bss,0x1000 \
380 -Wl,-sectalign,__HIB,__common,0x1000 \
381 -Wl,-sectalign,__HIB,__llvm_prf_cnts,0x1000 \
382 -Wl,-sectalign,__HIB,__llvm_prf_names,0x1000 \
383 -Wl,-sectalign,__HIB,__llvm_prf_data,0x1000 \
384 -Wl,-sectalign,__HIB,__textcoal_nt,0x1000 \
385 -Wl,-rename_section,__DATA,__const,__CONST,__constdata \
386 -Wl,-no_zero_fill_sections \
387 $(LDFLAGS_NOSTRIP_FLAG)
390 LDFLAGS_KERNEL_RELEASEX86_64 += \
391 -Wl,-sectalign,__HIB,__cstring,0x1000 \
392 -Wl,-sectalign,__HIB,__asan_globals,0x1000 \
393 -Wl,-sectalign,__HIB,__asan_liveness,0x1000 \
394 -Wl,-sectalign,__HIB,__mod_term_func,0x1000 \
395 -Wl,-rename_section,__HIB,__mod_init_func,__NULL,__mod_init_func \
396 -Wl,-rename_section,__HIB,__eh_frame,__NULL,__eh_frame
399 # Define KERNEL_BASE_OFFSET so known at compile time:
400 CFLAGS_X86_64 += -DKERNEL_BASE_OFFSET=$(KERNEL_BASE_OFFSET)
401 CFLAGS_X86_64H += -DKERNEL_BASE_OFFSET=$(KERNEL_BASE_OFFSET)
403 LDFLAGS_KERNEL_DEBUGX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64)
404 LDFLAGS_KERNEL_DEVELOPMENTX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64)
405 LDFLAGS_KERNEL_KASANX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64)
406 LDFLAGS_KERNEL_PROFILEX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64)
408 LDFLAGS_KERNEL_RELEASEX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64)
409 LDFLAGS_KERNEL_DEBUGX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64H)
410 LDFLAGS_KERNEL_DEVELOPMENTX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64H)
411 LDFLAGS_KERNEL_KASANX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64H)
412 LDFLAGS_KERNEL_PROFILEX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64H)
415 LDFLAGS_KERNEL = $(LDFLAGS_KERNEL_GEN) \
416 $(LDFLAGS_KERNEL_SDK) \
417 $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) \
418 $($(addsuffix $(CURRENT_ARCH_CONFIG),LDFLAGS_KERNEL_)) \
419 $($(addsuffix $(CURRENT_KERNEL_CONFIG),LDFLAGS_KERNEL_)) \
420 $($(addsuffix $(CURRENT_ARCH_CONFIG), $(addsuffix $(CURRENT_KERNEL_CONFIG),LDFLAGS_KERNEL_))) \
421 $(DEPLOYMENT_TARGET_FLAGS)
424 # Default runtime libraries to be linked with the kernel
426 LD_KERNEL_LIBS = -lcc_kext
431 ifeq ($(CURRENT_KERNEL_CONFIG),RELEASE)
432 ifneq ($(filter ARM%,$(CURRENT_ARCH_CONFIG)),)
437 DO_CTFCONVERT = $(SUPPORTS_CTFCONVERT)
439 DO_CTFMACHO = $(NEEDS_CTF_MACHOS)
442 DO_CTFCONVERT = $(SUPPORTS_CTFCONVERT)
444 DO_CTFMACHO = $(NEEDS_CTF_MACHOS)
450 INCFLAGS_IMPORT = $(patsubst %, -I$(OBJROOT)/EXPORT_HDRS/%, $(COMPONENT_IMPORT_LIST))
451 INCFLAGS_EXTERN = -I$(SRCROOT)/EXTERNAL_HEADERS
452 INCFLAGS_GEN = -I$(SRCROOT)/$(COMPONENT) -I$(OBJROOT)/EXPORT_HDRS/$(COMPONENT)
454 INCFLAGS_SDK = -I$(SDKROOT)/usr/local/include/kernel
456 INCFLAGS = $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE) $(INCFLAGS_SDK)
461 MIGFLAGS = $(DEFINES) $(INCFLAGS) -novouchers $($(addsuffix $(CURRENT_ARCH_CONFIG),CFLAGS_)) $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) \
462 $(DEPLOYMENT_TARGET_FLAGS)
464 # Support for LLVM Profile Guided Optimization (PGO)
466 ifeq ($(BUILD_PROFILE),1)
467 CFLAGS_GEN += -fprofile-instr-generate -DPROFILE
468 CXXFLAGS_GEN += -fprofile-instr-generate -DPROFILE
472 CFLAGS_GEN += -fprofile-instr-use=$(USE_PROFILE)
473 CXXFLAGS_GEN += -fprofile-instr-use=$(USE_PROFILE)
474 LDFLAGS_KERNEL_GEN += -fprofile-instr-use=$(USE_PROFILE)
476 CFLAGS_GEN += -Wno-error=profile-instr-out-of-date
480 # Support for LLVM Link Time Optimization (LTO)
482 # LTO can be explicitly enabled or disabled with BUILD_LTO=1|0
483 # and defaults to enabled except for DEBUG kernels
485 # CFLAGS_NOLTO_FLAG is needed on a per-file basis (for files
486 # that deal poorly with LTO, or files that must be machine
487 # code *.o files for xnu to build (i.e, setsegname runs on
490 # LDFLAGS_NOSTRIP_FLAG is used to support configurations that
491 # do not utilize an export list. For these configs to build,
492 # we need to prevent the LTO logic from dead stripping them.
494 LTO_ENABLED_RELEASE = 1
495 LTO_ENABLED_DEVELOPMENT = 1
496 LTO_ENABLED_DEBUG = 0
497 LTO_ENABLED_KASAN = 0
499 ifneq ($(BUILD_LTO),)
500 USE_LTO = $(BUILD_LTO)
502 USE_LTO = $(LTO_ENABLED_$(CURRENT_KERNEL_CONFIG))
505 SUPPORTS_CTFCONVERT = 0
508 CXXFLAGS_GEN += -flto
509 LDFLAGS_KERNEL_GEN += -Wl,-mllvm,-inline-threshold=100 -Wl,-object_path_lto,$(TARGET)/lto.o
510 LDFLAGS_NOSTRIP_FLAG = -rdynamic
511 CFLAGS_NOLTO_FLAG = -fno-lto
514 LDFLAGS_NOSTRIP_FLAG =
516 ifneq ($(CTFCONVERT),)
517 SUPPORTS_CTFCONVERT = 1
522 ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1)
527 KCC = $(JSONCOMPILATIONDB) $(OBJPATH)/compile_commands.json $(PWD) $< $(CC)
528 KC++ = $(JSONCOMPILATIONDB) $(OBJPATH)/compile_commands.json $(PWD) $< $(CXX)
529 S_KCC = $(JSONCOMPILATIONDB) $(OBJPATH)/compile_commands.json $(PWD) $< $(CC)
536 export VPATH = .:$(SOURCE)
541 # Macros that control installation of kernel and its header files
543 # install flags for header files
545 INSTALL_FLAGS = -c -S -m 0444
546 DATA_INSTALL_FLAGS = -c -S -m 0644
547 EXEC_INSTALL_FLAGS = -c -S -m 0755
550 # Header file destinations
552 FRAMEDIR = /System/Library/Frameworks
555 SINCFRAME = $(FRAMEDIR)/System.framework
556 SINCDIR = $(SINCFRAME)/Versions/$(SINCVERS)/Headers
557 SPINCDIR = $(SINCFRAME)/Versions/$(SINCVERS)/PrivateHeaders
558 SRESDIR = $(SINCFRAME)/Versions/$(SINCVERS)/Resources
561 INCDIR = /usr/include
568 KINCFRAME = $(FRAMEDIR)/Kernel.framework
569 KINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Headers
570 KPINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/PrivateHeaders
571 KRESDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Resources
573 XNU_PRIVATE_UNIFDEF = -UMACH_KERNEL_PRIVATE -UBSD_KERNEL_PRIVATE -UIOKIT_KERNEL_PRIVATE -ULIBKERN_KERNEL_PRIVATE -ULIBSA_KERNEL_PRIVATE -UPEXPERT_KERNEL_PRIVATE -UXNU_KERNEL_PRIVATE
576 PLATFORM_UNIFDEF = $(foreach x,$(SUPPORTED_PLATFORMS),$(if $(filter $(PLATFORM),$(x)),-DPLATFORM_$(x) $(foreach token,$(PLATFORM_UNIFDEF_BLACKLIST_TOKENS_$(x)),-U$(token)),-UPLATFORM_$(x)))
578 SPINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -UKERNEL_PRIVATE -UKERNEL -DPRIVATE -U_OPEN_SOURCE_ -U__OPEN_SOURCE__
579 SINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -UKERNEL_PRIVATE -UKERNEL -UPRIVATE -D_OPEN_SOURCE_ -D__OPEN_SOURCE__
580 KPINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -DKERNEL_PRIVATE -DPRIVATE -DKERNEL -U_OPEN_SOURCE_ -U__OPEN_SOURCE__
581 KINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -UKERNEL_PRIVATE -UPRIVATE -DKERNEL -D_OPEN_SOURCE_ -D__OPEN_SOURCE__
584 # Compononent Header file destinations
586 EXPDIR = EXPORT_HDRS/$(COMPONENT)
591 STRIP_FLAGS_RELEASE = -S -x
592 STRIP_FLAGS_DEVELOPMENT = -S
593 STRIP_FLAGS_KASAN = $(STRIP_FLAGS_DEVELOPMENT)
594 STRIP_FLAGS_DEBUG = -S
595 STRIP_FLAGS_PROFILE = -S -x
597 STRIP_FLAGS = $($(addsuffix $(CURRENT_KERNEL_CONFIG),STRIP_FLAGS_))
602 DSYMUTIL_FLAGS_GEN = --minimize
604 DSYMUTIL_FLAGS_X86_64 = --arch=x86_64
605 DSYMUTIL_FLAGS_X86_64H = --arch=x86_64h
607 DSYMUTIL_FLAGS = $(DSYMUTIL_FLAGS_GEN) \
608 $($(addsuffix $(CURRENT_ARCH_CONFIG),DSYMUTIL_FLAGS_))
611 # Man Page destination
613 MANDIR = /usr/share/man
616 # DEBUG alias location
618 DEVELOPER_EXTRAS_DIR = /AppleInternal/CoreOS/xnu_$(CURRENT_KERNEL_CONFIG_LC)
621 # mach_kernel install location
623 INSTALL_KERNEL_DIR = /
626 # new OS X install location
628 SYSTEM_LIBRARY_KERNELS_DIR = /System/Library/Kernels
631 # File names in DSTROOT
634 ifeq ($(PLATFORM),MacOSX)
635 KERNEL_FILE_NAME_PREFIX = kernel
637 KERNEL_FILE_NAME_PREFIX = mach
640 ifeq ($(CURRENT_MACHINE_CONFIG),NONE)
641 ifeq ($(CURRENT_KERNEL_CONFIG),RELEASE)
642 KERNEL_FILE_NAME = $(KERNEL_FILE_NAME_PREFIX)
643 KERNEL_LLDBBOOTSTRAP_NAME = $(KERNEL_FILE_NAME_PREFIX).py
645 KERNEL_FILE_NAME = $(KERNEL_FILE_NAME_PREFIX).$(CURRENT_KERNEL_CONFIG_LC)
646 KERNEL_LLDBBOOTSTRAP_NAME = $(KERNEL_FILE_NAME_PREFIX).py
649 KERNEL_FILE_NAME = $(KERNEL_FILE_NAME_PREFIX).$(CURRENT_KERNEL_CONFIG_LC).$(CURRENT_MACHINE_CONFIG_LC)
650 KERNEL_LLDBBOOTSTRAP_NAME = $(KERNEL_FILE_NAME_PREFIX)_$(CURRENT_KERNEL_CONFIG_LC).py
653 CURRENT_ALIAS_MACHINE_CONFIG = $(word 4,$(subst ^, ,$(CURRENT_BUILD_CONFIG)))
654 CURRENT_ALIAS_MACHINE_CONFIG_LC = $(shell printf "%s" "$(CURRENT_ALIAS_MACHINE_CONFIG)" | $(TR) A-Z a-z)
655 ifneq ($(CURRENT_ALIAS_MACHINE_CONFIG),)
656 ALIAS_FILE_NAME = $(KERNEL_FILE_NAME_PREFIX).$(CURRENT_KERNEL_CONFIG_LC).$(CURRENT_ALIAS_MACHINE_CONFIG_LC)
660 # System.kext pseudo-kext install location
662 INSTALL_EXTENSIONS_DIR = /System/Library/Extensions
667 INSTALL_KERNEL_SYM_DIR = /System/Library/Extensions/KDK
672 INSTALL_SHARE_MISC_DIR = /usr/share/misc
673 INSTALL_DTRACE_SCRIPTS_DIR = /usr/lib/dtrace
674 INSTALL_DTRACE_LIBEXEC_DIR = /usr/libexec/dtrace
677 # Overrides for XBS build aliases
679 ifeq ($(RC_ProjectName),xnu_debug)
680 INSTALL_KERNEL_DIR := $(DEVELOPER_EXTRAS_DIR)
681 INSTALL_KERNEL_SYM_DIR := $(DEVELOPER_EXTRAS_DIR)
682 INSTALL_KERNEL_SYM_TO_KDK = 1
683 INSTALL_XNU_DEBUG_FILES = 1
684 else ifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),)
685 INSTALL_KERNEL_SYM_TO_KDK = 1
687 else ifneq ($(filter $(SUPPORTED_SIMULATOR_PLATFORMS),$(PLATFORM)),)
689 else ifeq ($(PLATFORM),MacOSX)
690 INSTALL_KERNEL_DIR := $(SYSTEM_LIBRARY_KERNELS_DIR)
691 INSTALL_KERNEL_SYM_DIR := $(SYSTEM_LIBRARY_KERNELS_DIR)
692 INSTALL_KERNEL_SYM_TO_KDK = $(if $(filter YES,$(DWARF_DSYM_FILE_SHOULD_ACCOMPANY_PRODUCT)),1,0)
695 ifeq ($(RC_ProjectName),xnu_kasan)
696 INSTALL_KASAN_ONLY = 1