]>
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 | ||
6d2010ae | 9 | |
39236c6e A |
10 | MD_SUPPORTED_KPI_FILENAME = SupportedKPIs-${CURRENT_ARCH_CONFIG_LC}.txt |
11 | MI_SUPPORTED_KPI_FILENAME = SupportedKPIs-all-archs.txt | |
d7e50217 | 12 | |
39236c6e | 13 | INSTALL_KEXT_DIR = $(DSTROOT)$(INSTALL_EXTENSIONS_DIR) |
d7e50217 | 14 | |
39236c6e | 15 | KEXT_PLIST_LIST = \ |
55e303ae | 16 | System.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 | |
39236c6e A |
31 | KEXT_MACHO_LIST = $(foreach symbolset,$(filter-out Dummy,$(SYMBOL_COMPONENT_LIST)),System.kext/PlugIns/$(symbolset).kext/$(symbolset)) |
32 | KEXT_PLIST_LIST += $(foreach symbolset,$(filter-out Dummy,$(SYMBOL_COMPONENT_LIST)),System.kext/PlugIns/$(symbolset).kext/Info.plist) | |
33 | ||
34 | SYMROOT_INSTALL_KEXT_MACHO_FILES = $(addprefix $(SYMROOT)/,$(KEXT_MACHO_LIST)) | |
35 | DSTROOT_INSTALL_KEXT_MACHO_FILES = $(addprefix $(INSTALL_KEXT_DIR)/,$(KEXT_MACHO_LIST)) | |
36 | ||
37 | SYMROOT_INSTALL_KEXT_PLISTS = $(addprefix $(SYMROOT)/,$(KEXT_PLIST_LIST)) | |
38 | DSTROOT_INSTALL_KEXT_PLISTS = $(addprefix $(INSTALL_KEXT_DIR)/,$(KEXT_PLIST_LIST)) | |
55e303ae | 39 | |
39236c6e | 40 | EXPORTS_FILES = $(foreach symbolset,$(SYMBOL_COMPONENT_LIST),$(symbolset).exports $(symbolset).$(CURRENT_ARCH_CONFIG_LC).exports) Unused.exports |
6d2010ae | 41 | |
39236c6e | 42 | SYMBOL_SET_BUILD = $(foreach symbolset, $(SYMBOL_COMPONENT_LIST), $(OBJPATH)/$(symbolset).symbolset) |
55e303ae | 43 | |
2d21ac55 | 44 | $(OBJPATH)/allsymbols: $(OBJPATH)/mach_kernel |
b0d623f7 | 45 | $(_v)$(NM) -gj $< > $@ |
55e303ae | 46 | |
39236c6e A |
47 | $(SYMBOL_SET_BUILD): $(OBJPATH)/%.symbolset : %.exports %.$(CURRENT_ARCH_CONFIG_LC).exports $(OBJPATH)/allsymbols |
48 | @echo SYMBOLSET $* "($(CURRENT_ARCH_CONFIG_LC))" | |
49 | $(_v)$(KEXT_CREATE_SYMBOL_SET) \ | |
50 | $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \ | |
51 | -import $(OBJPATH)/allsymbols \ | |
52 | -export $(SOURCE)/$*.exports \ | |
53 | -export $(SOURCE)/$*.$(CURRENT_ARCH_CONFIG_LC).exports \ | |
54 | -output $@ $(_vstdout) | |
55 | ||
56 | .PHONY: check_all_exports | |
57 | ||
58 | check_all_exports: $(OBJPATH)/allsymbols | |
59 | $(_v)$(KEXT_CREATE_SYMBOL_SET) \ | |
60 | $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \ | |
61 | -import $(OBJPATH)/allsymbols \ | |
62 | $(foreach symbolset,$(filter-out Private,$(SYMBOL_COMPONENT_LIST)), \ | |
63 | -export $(SOURCE)/$(symbolset).exports \ | |
64 | -export $(SOURCE)/$(symbolset).$(CURRENT_ARCH_CONFIG_LC).exports) \ | |
65 | -output /dev/null $(_vstdout) | |
66 | $(_v)$(KEXT_CREATE_SYMBOL_SET) \ | |
67 | $(ARCH_FLAGS_$(CURRENT_ARCH_CONFIG)) \ | |
68 | -import $(OBJPATH)/allsymbols \ | |
69 | $(foreach symbolset,$(filter-out Unsupported,$(SYMBOL_COMPONENT_LIST)), \ | |
70 | -export $(SOURCE)/$(symbolset).exports \ | |
71 | -export $(SOURCE)/$(symbolset).$(CURRENT_ARCH_CONFIG_LC).exports) \ | |
72 | -output /dev/null $(_vstdout) | |
73 | ||
74 | $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME): $(EXPORTS_FILES) | |
75 | @echo SUPPORTED_KPI "($(CURRENT_ARCH_CONFIG_LC))" | |
76 | $(_v)$(SRCROOT)/config/list_supported.sh $(SOURCE) $(CURRENT_ARCH_CONFIG_LC) $@ | |
77 | ||
78 | $(OBJPATH)/$(MI_SUPPORTED_KPI_FILENAME): $(EXPORTS_FILES) | |
79 | @echo SUPPORTED_KPI "(all)" | |
80 | $(_v)$(SRCROOT)/config/list_supported.sh $(SOURCE) all $@ | |
81 | ||
82 | build_symbol_sets: check_all_exports $(SYMBOL_SET_BUILD) $(OBJPATH)/allsymbols \ | |
83 | $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME) \ | |
84 | $(OBJPATH)/$(MI_SUPPORTED_KPI_FILENAME) | |
85 | ||
86 | do_config_all:: build_symbol_sets | |
87 | ||
88 | # There's no simple static pattern rule for these paths, so hardcode dependencies in the command list | |
89 | $(SYMROOT_INSTALL_KEXT_MACHO_FILES): ALWAYS | |
90 | $(_v)$(MKDIR) $(dir $@) | |
91 | $(_v)if [ $(OBJROOT)/.symbolset.timestamp -nt $@ ]; then \ | |
92 | echo INSTALLSYM symbolset $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))"; \ | |
93 | $(INSTALL) $(EXEC_INSTALL_FLAGS) $(OBJPATH)/$(@F).symbolset $@; \ | |
94 | cmdstatus=$$?; \ | |
95 | else \ | |
96 | echo INSTALLSYM symbolset $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))"; \ | |
97 | $(LIPO) -create $@ $(OBJPATH)/$(@F).symbolset -output $@ 2>/dev/null || true; \ | |
98 | cmdstatus=$$?; \ | |
99 | fi; \ | |
100 | exit $$cmdstatus | |
101 | ||
102 | .PHONY: symroot_kext_plists | |
103 | ||
104 | symroot_kext_plists: $(SYMROOT_INSTALL_KEXT_PLISTS) | |
105 | ||
106 | $(SYMROOT_INSTALL_KEXT_PLISTS): $(SYMROOT)/% : $(SOURCE)/% | |
107 | $(_v)$(MKDIR) $(dir $@) | |
108 | @echo INSTALLSYM kextplist $* | |
109 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ | |
110 | $(_v)$(NEWVERS) $@ $(_vstdout) | |
111 | ||
112 | .PHONY: dstroot_kext_plists | |
113 | ||
114 | dstroot_kext_plists: $(DSTROOT_INSTALL_KEXT_PLISTS) | |
115 | ||
116 | $(DSTROOT_INSTALL_KEXT_PLISTS): $(INSTALL_KEXT_DIR)/% : $(SYMROOT)/% | |
117 | $(_v)$(MKDIR) $(dir $@) | |
118 | @echo INSTALL kextplist $* | |
119 | $(_v)$(INSTALL) $(DATA_INSTALL_FLAGS) $< $@ | |
120 | ||
121 | $(DSTROOT_INSTALL_KEXT_MACHO_FILES): $(INSTALL_KEXT_DIR)/% : $(SYMROOT)/% | |
122 | $(_v)$(MKDIR) $(dir $@) | |
123 | @echo INSTALL $(notdir $@) "($(CURRENT_ARCH_CONFIG_LC))" | |
124 | $(_v)$(INSTALL) $(EXEC_INSTALL_FLAGS) $< $@ | |
125 | ||
126 | $(DSTROOT)/$(KRESDIR)/$(MD_SUPPORTED_KPI_FILENAME) $(DSTROOT)/$(KRESDIR)/$(MI_SUPPORTED_KPI_FILENAME): $(DSTROOT)/$(KRESDIR)/% : $(OBJPATH)/% | |
127 | $(_v)$(MKDIR) $(dir $@) | |
128 | @echo INSTALL $* | |
129 | $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@ | |
130 | ||
131 | install_symbol_sets: $(SYMROOT_INSTALL_KEXT_MACHO_FILES) \ | |
132 | symroot_kext_plists \ | |
133 | $(DSTROOT_INSTALL_KEXT_MACHO_FILES) \ | |
134 | dstroot_kext_plists \ | |
135 | $(DSTROOT)/$(KRESDIR)/$(MD_SUPPORTED_KPI_FILENAME) \ | |
136 | $(DSTROOT)/$(KRESDIR)/$(MI_SUPPORTED_KPI_FILENAME) | |
137 | ||
138 | do_build_install_primary:: install_symbol_sets | |
139 | ||
140 | $(OBJPATH)/kernel-kpi.exp: $(EXPORTS_FILES) | |
141 | $(_v)$(SOURCE)/generate_linker_exports.sh $@ $+ | |
142 | ||
143 | .PHONY: build_mach_kernel_exports | |
144 | ||
145 | build_mach_kernel_exports: $(OBJPATH)/kernel-kpi.exp | |
146 | ||
147 | do_build_all:: build_mach_kernel_exports | |
b7266188 | 148 | |
d7e50217 A |
149 | include $(MakeInc_rule) |
150 | include $(MakeInc_dir) |