]>
Commit | Line | Data |
---|---|---|
d7e50217 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 | ||
d7e50217 A |
6 | include $(MakeInc_cmd) |
7 | include $(MakeInc_def) | |
8 | ||
39236c6e A |
9 | MD_SUPPORTED_KPI_FILENAME = SupportedKPIs-${CURRENT_ARCH_CONFIG_LC}.txt |
10 | MI_SUPPORTED_KPI_FILENAME = SupportedKPIs-all-archs.txt | |
d7e50217 | 11 | |
39236c6e | 12 | INSTALL_KEXT_DIR = $(DSTROOT)$(INSTALL_EXTENSIONS_DIR) |
d7e50217 | 13 | |
39236c6e | 14 | KEXT_PLIST_LIST = \ |
55e303ae | 15 | System.kext/Info.plist \ |
5ba3f43e | 16 | System.kext/PlugIns/Kasan.kext/Info.plist \ |
55e303ae A |
17 | System.kext/PlugIns/AppleNMI.kext/Info.plist \ |
18 | System.kext/PlugIns/ApplePlatformFamily.kext/Info.plist \ | |
19 | System.kext/PlugIns/IONVRAMFamily.kext/Info.plist \ | |
39236c6e | 20 | System.kext/PlugIns/IOSystemManagement.kext/Info.plist |
6d2010ae | 21 | |
55e303ae | 22 | SYMBOL_COMPONENT_LIST = \ |
55e303ae A |
23 | BSDKernel \ |
24 | IOKit \ | |
6d2010ae A |
25 | Libkern \ |
26 | Mach \ | |
27 | MACFramework \ | |
28 | Unsupported \ | |
29 | Private | |
2d21ac55 | 30 | |
fe8ab488 A |
31 | # In general you want it to be possible to have a CPU sub-type's symbol exports |
32 | # alias to the parent type's exports. This is a special-case way to handle it | |
33 | # for now: | |
34 | ifeq ($(CURRENT_ARCH_CONFIG_LC),x86_64h) | |
35 | EXPORT_SOURCE_ARCH_CONFIG_LC = x86_64 | |
36 | else | |
37 | EXPORT_SOURCE_ARCH_CONFIG_LC = $(CURRENT_ARCH_CONFIG_LC) | |
38 | endif | |
39 | ||
39236c6e A |
40 | KEXT_MACHO_LIST = $(foreach symbolset,$(filter-out Dummy,$(SYMBOL_COMPONENT_LIST)),System.kext/PlugIns/$(symbolset).kext/$(symbolset)) |
41 | KEXT_PLIST_LIST += $(foreach symbolset,$(filter-out Dummy,$(SYMBOL_COMPONENT_LIST)),System.kext/PlugIns/$(symbolset).kext/Info.plist) | |
42 | ||
43 | SYMROOT_INSTALL_KEXT_MACHO_FILES = $(addprefix $(SYMROOT)/,$(KEXT_MACHO_LIST)) | |
44 | DSTROOT_INSTALL_KEXT_MACHO_FILES = $(addprefix $(INSTALL_KEXT_DIR)/,$(KEXT_MACHO_LIST)) | |
45 | ||
46 | SYMROOT_INSTALL_KEXT_PLISTS = $(addprefix $(SYMROOT)/,$(KEXT_PLIST_LIST)) | |
47 | DSTROOT_INSTALL_KEXT_PLISTS = $(addprefix $(INSTALL_KEXT_DIR)/,$(KEXT_PLIST_LIST)) | |
55e303ae | 48 | |
fe8ab488 | 49 | EXPORTS_FILES = $(foreach symbolset,$(SYMBOL_COMPONENT_LIST),$(symbolset).exports $(symbolset).$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports) Unused.exports |
6d2010ae | 50 | |
39236c6e | 51 | SYMBOL_SET_BUILD = $(foreach symbolset, $(SYMBOL_COMPONENT_LIST), $(OBJPATH)/$(symbolset).symbolset) |
55e303ae | 52 | |
fe8ab488 | 53 | $(OBJPATH)/allsymbols: $(OBJPATH)/$(KERNEL_FILE_NAME) |
b0d623f7 | 54 | $(_v)$(NM) -gj $< > $@ |
55e303ae | 55 | |
fe8ab488 | 56 | $(SYMBOL_SET_BUILD): $(OBJPATH)/%.symbolset : %.exports %.$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports $(OBJPATH)/allsymbols $(KEXT_CREATE_SYMBOL_SET) |
39037602 | 57 | @echo "$(ColorH)SYMBOLSET$(Color0) $(ColorF)$*$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\"" |
39236c6e A |
58 | $(_v)$(KEXT_CREATE_SYMBOL_SET) \ |
59 | $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \ | |
60 | -import $(OBJPATH)/allsymbols \ | |
61 | -export $(SOURCE)/$*.exports \ | |
fe8ab488 | 62 | -export $(SOURCE)/$*.$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports \ |
39236c6e A |
63 | -output $@ $(_vstdout) |
64 | ||
65 | .PHONY: check_all_exports | |
66 | ||
fe8ab488 | 67 | check_all_exports: $(OBJPATH)/allsymbols $(KEXT_CREATE_SYMBOL_SET) |
39236c6e A |
68 | $(_v)$(KEXT_CREATE_SYMBOL_SET) \ |
69 | $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \ | |
70 | -import $(OBJPATH)/allsymbols \ | |
71 | $(foreach symbolset,$(filter-out Private,$(SYMBOL_COMPONENT_LIST)), \ | |
72 | -export $(SOURCE)/$(symbolset).exports \ | |
fe8ab488 | 73 | -export $(SOURCE)/$(symbolset).$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports) \ |
39236c6e A |
74 | -output /dev/null $(_vstdout) |
75 | $(_v)$(KEXT_CREATE_SYMBOL_SET) \ | |
76 | $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \ | |
77 | -import $(OBJPATH)/allsymbols \ | |
78 | $(foreach symbolset,$(filter-out Unsupported,$(SYMBOL_COMPONENT_LIST)), \ | |
79 | -export $(SOURCE)/$(symbolset).exports \ | |
fe8ab488 | 80 | -export $(SOURCE)/$(symbolset).$(EXPORT_SOURCE_ARCH_CONFIG_LC).exports) \ |
39236c6e A |
81 | -output /dev/null $(_vstdout) |
82 | ||
83 | $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME): $(EXPORTS_FILES) | |
39037602 | 84 | @echo "$(ColorH)SUPPORTED_KPI$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\"" |
fe8ab488 | 85 | $(_v)$(SRCROOT)/config/list_supported.sh $(SOURCE) $(EXPORT_SOURCE_ARCH_CONFIG_LC) $@ |
39236c6e A |
86 | |
87 | $(OBJPATH)/$(MI_SUPPORTED_KPI_FILENAME): $(EXPORTS_FILES) | |
39037602 | 88 | @echo "$(ColorH)SUPPORTED_KPI$(Color0) \"($(ColorLF)all$(Color0))\"" |
39236c6e A |
89 | $(_v)$(SRCROOT)/config/list_supported.sh $(SOURCE) all $@ |
90 | ||
91 | build_symbol_sets: check_all_exports $(SYMBOL_SET_BUILD) $(OBJPATH)/allsymbols \ | |
92 | $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME) \ | |
93 | $(OBJPATH)/$(MI_SUPPORTED_KPI_FILENAME) | |
94 | ||
95 | do_config_all:: build_symbol_sets | |
96 | ||
97 | # There's no simple static pattern rule for these paths, so hardcode dependencies in the command list | |
98 | $(SYMROOT_INSTALL_KEXT_MACHO_FILES): ALWAYS | |
99 | $(_v)$(MKDIR) $(dir $@) | |
100 | $(_v)if [ $(OBJROOT)/.symbolset.timestamp -nt $@ ]; then \ | |
101 | echo INSTALLSYM symbolset $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))"; \ | |
102 | $(INSTALL) $(EXEC_INSTALL_FLAGS) $(OBJPATH)/$(@F).symbolset $@; \ | |
103 | cmdstatus=$$?; \ | |
104 | else \ | |
105 | echo INSTALLSYM symbolset $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))"; \ | |
106 | $(LIPO) -create $@ $(OBJPATH)/$(@F).symbolset -output $@ 2>/dev/null || true; \ | |
107 | cmdstatus=$$?; \ | |
108 | fi; \ | |
109 | exit $$cmdstatus | |
110 | ||
39236c6e A |
111 | $(SYMROOT_INSTALL_KEXT_PLISTS): $(SYMROOT)/% : $(SOURCE)/% |
112 | $(_v)$(MKDIR) $(dir $@) | |
39037602 | 113 | @echo "$(ColorH)INSTALLSYM$(ColorH) $(ColorLF)kextplist$(Color0) $(ColorF)$*$(Color0)" |
39236c6e A |
114 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ |
115 | $(_v)$(NEWVERS) $@ $(_vstdout) | |
116 | ||
39236c6e A |
117 | $(DSTROOT_INSTALL_KEXT_PLISTS): $(INSTALL_KEXT_DIR)/% : $(SYMROOT)/% |
118 | $(_v)$(MKDIR) $(dir $@) | |
39037602 | 119 | @echo "$(ColorH)INSTALL$(ColorH) $(ColorLF)kextplist$(Color0) $(ColorF)$*$(Color0)" |
39236c6e A |
120 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ |
121 | ||
fe8ab488 | 122 | $(DSTROOT_INSTALL_KEXT_MACHO_FILES): $(INSTALL_KEXT_DIR)/% : $(SYMROOT)/% ALWAYS |
39236c6e | 123 | $(_v)$(MKDIR) $(dir $@) |
39037602 | 124 | @echo "$(ColorF)INSTALL$(Color0) $(ColorF)$(notdir $@)$(Color0) \"($(ColorLF)$(CURRENT_ARCH_CONFIG_LC)$(Color0))\"" |
39236c6e A |
125 | $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@ |
126 | ||
127 | $(DSTROOT)/$(KRESDIR)/$(MD_SUPPORTED_KPI_FILENAME) $(DSTROOT)/$(KRESDIR)/$(MI_SUPPORTED_KPI_FILENAME): $(DSTROOT)/$(KRESDIR)/% : $(OBJPATH)/% | |
128 | $(_v)$(MKDIR) $(dir $@) | |
39037602 | 129 | @echo "$(ColorH)INSTALL$(Color0) $(ColorF)$*$(Color0)" |
39236c6e A |
130 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ |
131 | ||
5ba3f43e | 132 | ifneq ($(INSTALL_KASAN_ONLY),1) |
fe8ab488 A |
133 | do_config_install:: $(SYMROOT_INSTALL_KEXT_MACHO_FILES) \ |
134 | $(SYMROOT_INSTALL_KEXT_PLISTS) \ | |
135 | $(DSTROOT_INSTALL_KEXT_MACHO_FILES) \ | |
136 | $(DSTROOT_INSTALL_KEXT_PLISTS) \ | |
137 | $(DSTROOT)/$(KRESDIR)/$(MD_SUPPORTED_KPI_FILENAME) \ | |
138 | $(DSTROOT)/$(KRESDIR)/$(MI_SUPPORTED_KPI_FILENAME) | |
5ba3f43e A |
139 | endif |
140 | ||
39236c6e | 141 | |
fe8ab488 | 142 | $(OBJPATH)/all-kpi.exp: $(EXPORTS_FILES) |
39236c6e A |
143 | $(_v)$(SOURCE)/generate_linker_exports.sh $@ $+ |
144 | ||
fe8ab488 | 145 | do_build_all:: $(OBJPATH)/all-kpi.exp |
b7266188 | 146 | |
d7e50217 A |
147 | include $(MakeInc_rule) |
148 | include $(MakeInc_dir) |