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
119 -Wno-bad-function-cast \
122 -Wno-conditional-uninitialized \
125 -Wstring-conversion \
126 -Wliteral-conversion \
127 -Wnon-literal-null-conversion \
131 -Wconstant-conversion \
132 -Wpointer-bool-conversion \
133 -Wno-covered-switch-default \
134 -Wno-disabled-macro-expansion \
135 -Wno-documentation-unknown-command \
136 -Wno-format-non-iso \
137 -Wno-format-nonliteral \
138 -Wno-reserved-id-macro \
139 -Wno-language-extension-token \
140 -Wno-missing-variable-declarations \
143 -Wno-partial-availability \
145 -Wno-shift-sign-overflow \
149 -Wno-used-but-marked-unused \
150 -Wno-variadic-macros \
152 -Wno-zero-length-array
156 -Wstrict-prototypes \
157 -Wmissing-prototypes \
162 # Can be overridden in Makefile.template or Makefile.$arch
163 export CWARNFLAGS ?= $(CWARNFLAGS_STD)
165 define add_perfile_cflags
166 $(1)_CWARNFLAGS_ADD += $2
171 -Wno-c++98-compat-pedantic \
172 -Wno-exit-time-destructors \
173 -Wno-global-constructors \
176 # overloaded-virtual warnings are non-fatal (9000888)
177 CXXWARNFLAGS_STD += -Wno-error=overloaded-virtual
179 # Can be overridden in Makefile.template or Makefile.$arch
180 export CXXWARNFLAGS ?= $(CXXWARNFLAGS_STD)
182 define add_perfile_cxxflags
183 $(1)_CXXWARNFLAGS_ADD += $2
187 # Default ARCH_FLAGS, for use with compiler/linker/assembler/mig drivers
189 ARCH_FLAGS_X86_64 = -arch x86_64
190 ARCH_FLAGS_X86_64H = -arch x86_64h
197 ifdef RC_NONARCH_CFLAGS
198 OTHER_CFLAGS = $(RC_NONARCH_CLFAGS)
204 DSYMINFODIR = Contents
205 DSYMKGMACROSDIR = Contents/Resources
206 DSYMLLDBMACROSDIR = Contents/Resources/Python
207 DSYMDWARFDIR = Contents/Resources/DWARF
213 # We must not use -fno-keep-inline-functions, or it will remove the dtrace
214 # probes from the kernel.
216 CFLAGS_GEN = $(DEBUG_CFLAGS) -nostdinc \
217 -fno-builtin -fno-common \
218 -fsigned-bitfields $(OTHER_CFLAGS)
223 CFLAGS_KASAN = $(CFLAGS_DEVELOPMENT)
226 CFLAGS_X86_64 = -Dx86_64 -DX86_64 -D__X86_64__ -DLP64 \
227 -DPAGE_SIZE_FIXED -mkernel -msoft-float
229 CFLAGS_X86_64H = $(CFLAGS_X86_64)
232 CFLAGS_RELEASEX86_64 = -O2
233 CFLAGS_DEVELOPMENTX86_64 = -O2
234 CFLAGS_KASANX86_64 = $(CFLAGS_DEVELOPMENTX86_64)
235 # No space optimization for the DEBUG kernel for the benefit of gdb:
236 CFLAGS_DEBUGX86_64 = -O0
237 CFLAGS_PROFILEX86_64 = -O2
239 CFLAGS_RELEASEX86_64H = -O2
240 CFLAGS_DEVELOPMENTX86_64H = -O2
241 CFLAGS_KASANX86_64H = $(CFLAGS_DEVELOPMENTX86_64H)
242 # No space optimization for the DEBUG kernel for the benefit of gdb:
243 CFLAGS_DEBUGX86_64H = -O0
244 CFLAGS_PROFILEX86_64H = -O2
246 CFLAGS_RELEASEARM = -O2
247 CFLAGS_DEVELOPMENTARM = -O2
248 CFLAGS_DEBUGARM = -O0
249 CFLAGS_PROFILEARM = -O2
258 ifeq ($(CURRENT_KERNEL_CONFIG),KASAN)
265 KASAN_SHIFT_X86_64=0xdffffe1000000000
266 KASAN_SHIFT_X86_64H=$(KASAN_SHIFT_X86_64)
267 KASAN_SHIFT=$($(addsuffix $(CURRENT_ARCH_CONFIG),KASAN_SHIFT_))
268 KASAN_BLACKLIST=$(OBJROOT)/san/kasan-blacklist-$(CURRENT_ARCH_CONFIG_LC)
269 CFLAGS_GEN += -DKASAN=1 -DKASAN_SHIFT=$(KASAN_SHIFT) -fsanitize=address \
270 -mllvm -asan-globals-live-support \
271 -mllvm -asan-mapping-offset=$(KASAN_SHIFT) \
272 -fsanitize-blacklist=$(KASAN_BLACKLIST)
276 CFLAGS = $(CFLAGS_GEN) \
277 $($(addsuffix $(CURRENT_MACHINE_CONFIG),MACHINE_FLAGS_$(CURRENT_ARCH_CONFIG)_)) \
278 $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) \
279 $($(addsuffix $(CURRENT_ARCH_CONFIG),CFLAGS_)) \
280 $($(addsuffix $(CURRENT_KERNEL_CONFIG),CFLAGS_)) \
281 $($(addsuffix $(CURRENT_ARCH_CONFIG), $(addsuffix $(CURRENT_KERNEL_CONFIG),CFLAGS_))) \
282 $(DEPLOYMENT_TARGET_FLAGS) \
283 $(DEPLOYMENT_TARGET_DEFINES) \
292 CXXFLAGS_GEN = -std=gnu++11 -fapple-kext $(OTHER_CXXFLAGS)
294 CXXFLAGS = $(CXXFLAGS_GEN) \
295 $($(addsuffix $(CURRENT_ARCH_CONFIG),CXXFLAGS_)) \
296 $($(addsuffix $(CURRENT_KERNEL_CONFIG),CXXFLAGS_))
307 SFLAGS_GEN = -D__ASSEMBLER__ -DASSEMBLER $(OTHER_CFLAGS)
311 SFLAGS_KASAN = $(SFLAGS_DEVELOPMENT) -DKASAN=1
315 SFLAGS_X86_64 = $(CFLAGS_X86_64)
316 SFLAGS_X86_64H = $(CFLAGS_X86_64H)
318 SFLAGS = $(SFLAGS_GEN) \
319 $($(addsuffix $(CURRENT_MACHINE_CONFIG),MACHINE_FLAGS_$(CURRENT_ARCH_CONFIG)_)) \
320 $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) \
321 $($(addsuffix $(CURRENT_ARCH_CONFIG),SFLAGS_)) \
322 $($(addsuffix $(CURRENT_KERNEL_CONFIG),SFLAGS_)) \
323 $(DEPLOYMENT_TARGET_FLAGS) \
324 $(DEPLOYMENT_TARGET_DEFINES) \
330 LD = $(KC++) -nostdlib
335 # Availability of DWARF allows DTrace CTF (compressed type format) to be constructed.
336 # ctf_insert creates the CTF section. It needs reserved padding in the
337 # headers for the load command segment and the CTF section structures.
339 LDFLAGS_KERNEL_GEN = \
343 -Wl,-sectalign,__TEXT,__text,0x1000 \
344 -Wl,-sectalign,__DATA,__common,0x1000 \
345 -Wl,-sectalign,__DATA,__bss,0x1000 \
346 -Wl,-sectcreate,__PRELINK_TEXT,__text,/dev/null \
347 -Wl,-sectcreate,"__PLK_TEXT_EXEC",__text,/dev/null \
348 -Wl,-sectcreate,__PRELINK_DATA,__data,/dev/null \
349 -Wl,-sectcreate,"__PLK_DATA_CONST",__data,/dev/null \
350 -Wl,-sectcreate,"__PLK_LLVM_COV",__llvm_covmap,/dev/null \
351 -Wl,-sectcreate,"__PLK_LINKEDIT",__data,/dev/null \
352 -Wl,-sectcreate,__PRELINK_INFO,__info,/dev/null \
354 -Wl,-pagezero_size,0x0 \
355 -Wl,-version_load_command \
356 -Wl,-function_starts \
359 LDFLAGS_KERNEL_SDK = -L$(SDKROOT)/usr/local/lib/kernel -lfirehose_kernel
361 LDFLAGS_KERNEL_RELEASE =
362 LDFLAGS_KERNEL_DEVELOPMENT =
363 LDFLAGS_KERNEL_KASAN = $(LDFLAGS_KERNEL_DEVELOPMENT)
364 LDFLAGS_KERNEL_DEBUG =
365 LDFLAGS_KERNEL_PROFILE =
367 # KASLR static slide config:
371 KERNEL_MIN_ADDRESS = 0xffffff8000000000
372 KERNEL_BASE_OFFSET = 0x100000
373 KERNEL_STATIC_SLIDE = $(shell printf "0x%016x" \
374 $$[ $(SLIDE) << 21 ])
375 KERNEL_STATIC_BASE = $(shell printf "0x%016x" \
376 $$[ $(KERNEL_MIN_ADDRESS) + $(KERNEL_BASE_OFFSET) ])
377 KERNEL_HIB_SECTION_BASE = $(shell printf "0x%016x" \
378 $$[ $(KERNEL_STATIC_BASE) + $(KERNEL_STATIC_SLIDE) ])
379 KERNEL_TEXT_BASE = $(shell printf "0x%016x" \
380 $$[ $(KERNEL_HIB_SECTION_BASE) + 0x100000 ])
382 LDFLAGS_KERNEL_RELEASEX86_64 = \
384 -Wl,-segaddr,__HIB,$(KERNEL_HIB_SECTION_BASE) \
385 -Wl,-image_base,$(KERNEL_TEXT_BASE) \
386 -Wl,-seg_page_size,__TEXT,0x200000 \
387 -Wl,-sectalign,__HIB,__bootPT,0x1000 \
388 -Wl,-sectalign,__HIB,__desc,0x1000 \
389 -Wl,-sectalign,__HIB,__data,0x1000 \
390 -Wl,-sectalign,__HIB,__text,0x1000 \
391 -Wl,-sectalign,__HIB,__const,0x1000 \
392 -Wl,-sectalign,__HIB,__bss,0x1000 \
393 -Wl,-sectalign,__HIB,__common,0x1000 \
394 -Wl,-sectalign,__HIB,__llvm_prf_cnts,0x1000 \
395 -Wl,-sectalign,__HIB,__llvm_prf_names,0x1000 \
396 -Wl,-sectalign,__HIB,__llvm_prf_data,0x1000 \
397 -Wl,-sectalign,__HIB,__textcoal_nt,0x1000 \
398 -Wl,-rename_section,__DATA,__const,__CONST,__constdata \
399 -Wl,-no_zero_fill_sections \
400 $(LDFLAGS_NOSTRIP_FLAG)
403 LDFLAGS_KERNEL_RELEASEX86_64 += \
404 -Wl,-sectalign,__HIB,__cstring,0x1000 \
405 -Wl,-sectalign,__HIB,__asan_globals,0x1000 \
406 -Wl,-sectalign,__HIB,__asan_liveness,0x1000 \
407 -Wl,-sectalign,__HIB,__mod_term_func,0x1000 \
408 -Wl,-rename_section,__HIB,__mod_init_func,__NULL,__mod_init_func \
409 -Wl,-rename_section,__HIB,__eh_frame,__NULL,__eh_frame
412 # Define KERNEL_BASE_OFFSET so known at compile time:
413 CFLAGS_X86_64 += -DKERNEL_BASE_OFFSET=$(KERNEL_BASE_OFFSET)
414 CFLAGS_X86_64H += -DKERNEL_BASE_OFFSET=$(KERNEL_BASE_OFFSET)
416 LDFLAGS_KERNEL_DEBUGX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64)
417 LDFLAGS_KERNEL_DEVELOPMENTX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64)
418 LDFLAGS_KERNEL_KASANX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64)
419 LDFLAGS_KERNEL_PROFILEX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64)
421 LDFLAGS_KERNEL_RELEASEX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64)
422 LDFLAGS_KERNEL_DEBUGX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64H)
423 LDFLAGS_KERNEL_DEVELOPMENTX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64H)
424 LDFLAGS_KERNEL_KASANX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64H)
425 LDFLAGS_KERNEL_PROFILEX86_64H = $(LDFLAGS_KERNEL_RELEASEX86_64H)
428 LDFLAGS_KERNEL = $(LDFLAGS_KERNEL_GEN) \
429 $(LDFLAGS_KERNEL_SDK) \
430 $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) \
431 $($(addsuffix $(CURRENT_ARCH_CONFIG),LDFLAGS_KERNEL_)) \
432 $($(addsuffix $(CURRENT_KERNEL_CONFIG),LDFLAGS_KERNEL_)) \
433 $($(addsuffix $(CURRENT_ARCH_CONFIG), $(addsuffix $(CURRENT_KERNEL_CONFIG),LDFLAGS_KERNEL_))) \
434 $(DEPLOYMENT_TARGET_FLAGS)
437 # Default runtime libraries to be linked with the kernel
439 LD_KERNEL_LIBS = -lcc_kext
444 ifeq ($(CURRENT_KERNEL_CONFIG),RELEASE)
445 ifneq ($(filter ARM%,$(CURRENT_ARCH_CONFIG)),)
450 DO_CTFCONVERT = $(SUPPORTS_CTFCONVERT)
452 DO_CTFMACHO = $(NEEDS_CTF_MACHOS)
455 DO_CTFCONVERT = $(SUPPORTS_CTFCONVERT)
457 DO_CTFMACHO = $(NEEDS_CTF_MACHOS)
463 INCFLAGS_IMPORT = $(patsubst %, -I$(OBJROOT)/EXPORT_HDRS/%, $(COMPONENT_IMPORT_LIST))
464 INCFLAGS_EXTERN = -I$(SRCROOT)/EXTERNAL_HEADERS
465 INCFLAGS_GEN = -I$(SRCROOT)/$(COMPONENT) -I$(OBJROOT)/EXPORT_HDRS/$(COMPONENT)
467 INCFLAGS_SDK = -I$(SDKROOT)/usr/local/include/kernel
469 INCFLAGS = $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE) $(INCFLAGS_SDK)
474 MIGFLAGS = $(DEFINES) $(INCFLAGS) -novouchers $($(addsuffix $(CURRENT_ARCH_CONFIG),CFLAGS_)) $($(addsuffix $(CURRENT_ARCH_CONFIG),ARCH_FLAGS_)) \
475 $(DEPLOYMENT_TARGET_FLAGS)
477 # Support for LLVM Profile Guided Optimization (PGO)
479 ifeq ($(BUILD_PROFILE),1)
480 CFLAGS_GEN += -fprofile-instr-generate -DPROFILE
481 CXXFLAGS_GEN += -fprofile-instr-generate -DPROFILE
485 CFLAGS_GEN += -fprofile-instr-use=$(USE_PROFILE)
486 CXXFLAGS_GEN += -fprofile-instr-use=$(USE_PROFILE)
487 LDFLAGS_KERNEL_GEN += -fprofile-instr-use=$(USE_PROFILE)
489 CFLAGS_GEN += -Wno-error=profile-instr-out-of-date
493 # Support for LLVM Link Time Optimization (LTO)
495 # LTO can be explicitly enabled or disabled with BUILD_LTO=1|0
496 # and defaults to enabled except for DEBUG kernels
498 # CFLAGS_NOLTO_FLAG is needed on a per-file basis (for files
499 # that deal poorly with LTO, or files that must be machine
500 # code *.o files for xnu to build (i.e, setsegname runs on
503 # LDFLAGS_NOSTRIP_FLAG is used to support configurations that
504 # do not utilize an export list. For these configs to build,
505 # we need to prevent the LTO logic from dead stripping them.
507 LTO_ENABLED_RELEASE = 1
508 LTO_ENABLED_DEVELOPMENT = 1
509 LTO_ENABLED_DEBUG = 0
510 LTO_ENABLED_KASAN = 0
512 ifneq ($(BUILD_LTO),)
513 USE_LTO = $(BUILD_LTO)
515 USE_LTO = $(LTO_ENABLED_$(CURRENT_KERNEL_CONFIG))
518 SUPPORTS_CTFCONVERT = 0
521 CXXFLAGS_GEN += -flto
522 LDFLAGS_KERNEL_GEN += -Wl,-mllvm,-inline-threshold=125 -Wl,-object_path_lto,$(TARGET)/lto.o # -Wl,-mllvm -Wl,-disable-fp-elim
523 LDFLAGS_NOSTRIP_FLAG = -rdynamic
524 CFLAGS_NOLTO_FLAG = -fno-lto
527 LDFLAGS_NOSTRIP_FLAG =
529 ifneq ($(CTFCONVERT),)
530 SUPPORTS_CTFCONVERT = 1
535 ifeq ($(BUILD_JSON_COMPILATION_DATABASE),1)
540 KCC = $(JSONCOMPILATIONDB) $(OBJPATH)/compile_commands.json $(PWD) $< $(CC)
541 KC++ = $(JSONCOMPILATIONDB) $(OBJPATH)/compile_commands.json $(PWD) $< $(CXX)
542 S_KCC = $(JSONCOMPILATIONDB) $(OBJPATH)/compile_commands.json $(PWD) $< $(CC)
549 export VPATH = .:$(SOURCE)
554 # Macros that control installation of kernel and its header files
556 # install flags for header files
558 INSTALL_FLAGS = -c -S -m 0444
559 DATA_INSTALL_FLAGS = -c -S -m 0644
560 EXEC_INSTALL_FLAGS = -c -S -m 0755
563 # Header file destinations
565 FRAMEDIR = /System/Library/Frameworks
568 SINCFRAME = $(FRAMEDIR)/System.framework
569 SINCDIR = $(SINCFRAME)/Versions/$(SINCVERS)/Headers
570 SPINCDIR = $(SINCFRAME)/Versions/$(SINCVERS)/PrivateHeaders
571 SRESDIR = $(SINCFRAME)/Versions/$(SINCVERS)/Resources
574 INCDIR = /usr/include
581 KINCFRAME = $(FRAMEDIR)/Kernel.framework
582 KINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Headers
583 KPINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/PrivateHeaders
584 KRESDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Resources
586 XNU_PRIVATE_UNIFDEF = -UMACH_KERNEL_PRIVATE -UBSD_KERNEL_PRIVATE -UIOKIT_KERNEL_PRIVATE -ULIBKERN_KERNEL_PRIVATE -ULIBSA_KERNEL_PRIVATE -UPEXPERT_KERNEL_PRIVATE -UXNU_KERNEL_PRIVATE
589 PLATFORM_UNIFDEF = $(foreach x,$(SUPPORTED_PLATFORMS),$(if $(filter $(PLATFORM),$(x)),-DPLATFORM_$(x) $(foreach token,$(PLATFORM_UNIFDEF_BLACKLIST_TOKENS_$(x)),-U$(token)),-UPLATFORM_$(x)))
591 SPINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -UKERNEL_PRIVATE -UKERNEL -DPRIVATE -U_OPEN_SOURCE_ -U__OPEN_SOURCE__
592 SINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -UKERNEL_PRIVATE -UKERNEL -UPRIVATE -D_OPEN_SOURCE_ -D__OPEN_SOURCE__
593 KPINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -DKERNEL_PRIVATE -DPRIVATE -DKERNEL -U_OPEN_SOURCE_ -U__OPEN_SOURCE__
594 KINCFRAME_UNIFDEF = $(PLATFORM_UNIFDEF) $(XNU_PRIVATE_UNIFDEF) $(SEED_DEFINES) -UKERNEL_PRIVATE -UPRIVATE -DKERNEL -D_OPEN_SOURCE_ -D__OPEN_SOURCE__
597 # Compononent Header file destinations
599 EXPDIR = EXPORT_HDRS/$(COMPONENT)
604 STRIP_FLAGS_RELEASE = -S -x
605 STRIP_FLAGS_DEVELOPMENT = -S
606 STRIP_FLAGS_KASAN = $(STRIP_FLAGS_DEVELOPMENT)
607 STRIP_FLAGS_DEBUG = -S
608 STRIP_FLAGS_PROFILE = -S -x
610 STRIP_FLAGS = $($(addsuffix $(CURRENT_KERNEL_CONFIG),STRIP_FLAGS_))
615 DSYMUTIL_FLAGS_GEN = --minimize
617 DSYMUTIL_FLAGS_X86_64 = --arch=x86_64
618 DSYMUTIL_FLAGS_X86_64H = --arch=x86_64h
620 DSYMUTIL_FLAGS = $(DSYMUTIL_FLAGS_GEN) \
621 $($(addsuffix $(CURRENT_ARCH_CONFIG),DSYMUTIL_FLAGS_))
624 # Man Page destination
626 MANDIR = /usr/share/man
629 # DEBUG alias location
631 DEVELOPER_EXTRAS_DIR = /AppleInternal/CoreOS/xnu_$(CURRENT_KERNEL_CONFIG_LC)
634 # mach_kernel install location
636 INSTALL_KERNEL_DIR = /
639 # new OS X install location
641 SYSTEM_LIBRARY_KERNELS_DIR = /System/Library/Kernels
644 # File names in DSTROOT
647 ifeq ($(PLATFORM),MacOSX)
648 KERNEL_FILE_NAME_PREFIX = kernel
650 KERNEL_FILE_NAME_PREFIX = mach
653 ifeq ($(CURRENT_MACHINE_CONFIG),NONE)
654 ifeq ($(CURRENT_KERNEL_CONFIG),RELEASE)
655 KERNEL_FILE_NAME = $(KERNEL_FILE_NAME_PREFIX)
656 KERNEL_LLDBBOOTSTRAP_NAME = $(KERNEL_FILE_NAME_PREFIX).py
658 KERNEL_FILE_NAME = $(KERNEL_FILE_NAME_PREFIX).$(CURRENT_KERNEL_CONFIG_LC)
659 KERNEL_LLDBBOOTSTRAP_NAME = $(KERNEL_FILE_NAME_PREFIX).py
662 KERNEL_FILE_NAME = $(KERNEL_FILE_NAME_PREFIX).$(CURRENT_KERNEL_CONFIG_LC).$(CURRENT_MACHINE_CONFIG_LC)
663 KERNEL_LLDBBOOTSTRAP_NAME = $(KERNEL_FILE_NAME_PREFIX)_$(CURRENT_KERNEL_CONFIG_LC).py
666 CURRENT_ALIAS_MACHINE_CONFIG = $(word 4,$(subst ^, ,$(CURRENT_BUILD_CONFIG)))
667 CURRENT_ALIAS_MACHINE_CONFIG_LC = $(shell printf "%s" "$(CURRENT_ALIAS_MACHINE_CONFIG)" | $(TR) A-Z a-z)
668 ifneq ($(CURRENT_ALIAS_MACHINE_CONFIG),)
669 ALIAS_FILE_NAME = $(KERNEL_FILE_NAME_PREFIX).$(CURRENT_KERNEL_CONFIG_LC).$(CURRENT_ALIAS_MACHINE_CONFIG_LC)
673 # System.kext pseudo-kext install location
675 INSTALL_EXTENSIONS_DIR = /System/Library/Extensions
680 INSTALL_KERNEL_SYM_DIR = /System/Library/Extensions/KDK
685 INSTALL_SHARE_MISC_DIR = /usr/share/misc
686 INSTALL_DTRACE_SCRIPTS_DIR = /usr/lib/dtrace
687 INSTALL_DTRACE_LIBEXEC_DIR = /usr/libexec/dtrace
690 # Overrides for XBS build aliases
692 ifeq ($(RC_ProjectName),xnu_debug)
693 INSTALL_KERNEL_DIR := $(DEVELOPER_EXTRAS_DIR)
694 INSTALL_KERNEL_SYM_DIR := $(DEVELOPER_EXTRAS_DIR)
695 INSTALL_KERNEL_SYM_TO_KDK = 1
696 INSTALL_XNU_DEBUG_FILES = 1
697 else ifneq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS),$(PLATFORM)),)
698 INSTALL_KERNEL_SYM_TO_KDK = 1
700 else ifneq ($(filter $(SUPPORTED_SIMULATOR_PLATFORMS),$(PLATFORM)),)
702 else ifeq ($(PLATFORM),MacOSX)
703 INSTALL_KERNEL_DIR := $(SYSTEM_LIBRARY_KERNELS_DIR)
704 INSTALL_KERNEL_SYM_DIR := $(SYSTEM_LIBRARY_KERNELS_DIR)
705 INSTALL_KERNEL_SYM_TO_KDK = $(if $(filter YES,$(DWARF_DSYM_FILE_SHOULD_ACCOMPANY_PRODUCT)),1,0)
708 ifeq ($(RC_ProjectName),xnu_kasan)
709 INSTALL_KASAN_ONLY = 1