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