]> git.saurik.com Git - apple/xnu.git/blame - san/Makefile
xnu-6153.11.26.tar.gz
[apple/xnu.git] / san / Makefile
CommitLineData
5ba3f43e
A
1export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
2export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
3export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
4export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
5
6include $(MakeInc_cmd)
7include $(MakeInc_def)
8
9DATAFILES = \
10
11PRIVATE_DATAFILES = \
12
13KERNELFILES = \
14
15PRIVATE_KERNELFILES = \
16 memintrinsics.h
17
18# Available only in xnu proper
19PRIVATE_XNUFILES = \
cb323159 20 ksancov.h \
5ba3f43e
A
21 kasan.h
22
23INSTALL_MI_LIST = ${DATAFILES}
24INSTALL_MI_LCL_LIST = ${PRIVATE_DATAFILES}
25INSTALL_KF_MI_LIST = ${KERNELFILES}
26INSTALL_KF_MI_LCL_LIST = ${KERNELFILES} ${PRIVATE_KERNELFILES}
27
28EXPORT_MI_LIST = ${PRIVATE_XNUFILES} ${KERNELFILES} ${PRIVATE_KERNELFILES}
29
30INSTALL_MI_DIR = san
31EXPORT_MI_DIR = san
32COMP_SUBDIRS = conf
33
a39ff7e2 34.DELETE_ON_ERROR:
d9a64523 35$(OBJROOT)/san/kasan-blacklist-%: $(SOURCE)/kasan-blacklist $(SOURCE)/ubsan-blacklist $(SOURCE)/kasan-blacklist-%
cb323159 36 $(call makelog,$(ColorH)GENERATING$(Color0) $(ColorLF)$(notdir $@)$(Color0))
5ba3f43e 37 $(_v)sed -e 's,^src:\./,src:'"$(SRCROOT)/," $^ > $@
a39ff7e2 38 $(_v)$(SOURCE)/tools/validate_blacklist.sh "$@"
5ba3f43e 39
a39ff7e2 40do_build_setup:: $(OBJROOT)/san/kasan-blacklist-x86_64 $(OBJROOT)/san/kasan-blacklist-arm64
5ba3f43e
A
41
42#
43# Kasan System.kext plugin
44#
45
46DSTROOT_KEXT_PATH = $(addprefix $(DSTROOT)$(INSTALL_EXTENSIONS_DIR),/System.kext/PlugIns/Kasan.kext)
47SYMROOT_KEXT_PATH = $(addprefix $(SYMROOT),/System.kext/PlugIns/Kasan.kext)
48
49ifneq ($(INSTALL_KASAN_ONLY),1)
50DSTROOT_KEXT = $(DSTROOT_KEXT_PATH)/Kasan
51SYMROOT_KEXT = $(SYMROOT_KEXT_PATH)/Kasan
52endif
53
54ifeq ($(KASAN),1)
55DSTROOT_KEXT += $(DSTROOT_KEXT_PATH)/Kasan_kasan
56SYMROOT_KEXT += $(SYMROOT_KEXT_PATH)/Kasan_kasan
57endif
58
59# Our external dependency on allsymbols is fine because this runs in a later phase (config_install vs. config_all)
60$(OBJPATH)/%.symbolset: $(SOURCE)/%.exports
cb323159 61 $(call makelog,$(ColorH)SYMBOLSET$(Color0) $(ColorF)$*$(Color0) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))")
5ba3f43e
A
62 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
63 $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \
64 -import $(OBJPATH)/allsymbols \
65 -export $< \
66 -output $@ $(_vstdout)
67
68$(DSTROOT_KEXT): $(DSTROOT_KEXT_PATH)/% : $(OBJPATH)/%.symbolset
69 $(_v)$(MKDIR) $(dir $@)
cb323159 70 $(call makelog,$(ColorF)INSTALL$(Color0) $(ColorF)$(notdir $@)$(Color0) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))")
5ba3f43e
A
71 $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@
72
73$(SYMROOT_KEXT): $(SYMROOT_KEXT_PATH)/% : $(DSTROOT_KEXT_PATH)/%
74 $(_v)$(MKDIR) $(dir $@)
cb323159 75 $(call makelog,$(ColorF)INSTALL$(Color0) $(ColorF)$(notdir $@)$(Color0) "($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))")
5ba3f43e
A
76 $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@
77
78do_config_install:: $(DSTROOT_KEXT) $(SYMROOT_KEXT)
79
80
81# Install helper scripts
82
83ifeq ($(KASAN),1)
84KASAN_HELPER_SCRIPTS += $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)/kasan_install
85endif
86
87$(KASAN_HELPER_SCRIPTS): $(DSTROOT)/$(DEVELOPER_EXTRAS_DIR)/% : $(SOURCE)/tools/%
88 $(_v)$(MKDIR) $(dir $@)
cb323159 89 $(call makelog,$(ColorH)INSTALL$(Color0) $(ColorF)$(@F)$(Color0))
5ba3f43e
A
90 $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@
91
92do_config_install:: $(KASAN_HELPER_SCRIPTS)
93
94include $(MakeInc_rule)
95include $(MakeInc_dir)