]>
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 | ||
6 | ||
7 | include $(MakeInc_cmd) | |
8 | include $(MakeInc_def) | |
9 | ||
10 | ALL_SUBDIRS = | |
11 | ||
12 | INSTINC_SUBDIRS = | |
d7e50217 | 13 | INSTINC_SUBDIRS_I386 = |
b0d623f7 | 14 | INSTINC_SUBDIRS_X86_64 = |
2d21ac55 A |
15 | INSTINC_SUBDIRS_ARM = |
16 | ||
d7e50217 | 17 | EXPINC_SUBDIRS = |
d7e50217 | 18 | EXPINC_SUBDIRS_I386 = |
b0d623f7 | 19 | EXPINC_SUBDIRS_X86_64 = |
2d21ac55 A |
20 | EXPINC_SUBDIRS_ARM = |
21 | ||
6d2010ae | 22 | |
d7e50217 A |
23 | COMP_SUBDIRS = |
24 | ||
25 | INST_SUBDIRS = | |
26 | ||
55e303ae | 27 | |
6d2010ae | 28 | INSTALL_KEXT_PLIST_LIST= \ |
55e303ae A |
29 | System.kext/Info.plist \ |
30 | System.kext/PlugIns/Libkern.kext/Info.plist \ | |
31 | System.kext/PlugIns/Mach.kext/Info.plist \ | |
32 | System.kext/PlugIns/BSDKernel.kext/Info.plist \ | |
2d21ac55 | 33 | System.kext/PlugIns/MACFramework.kext/Info.plist \ |
55e303ae A |
34 | System.kext/PlugIns/IOKit.kext/Info.plist \ |
35 | System.kext/PlugIns/AppleNMI.kext/Info.plist \ | |
36 | System.kext/PlugIns/ApplePlatformFamily.kext/Info.plist \ | |
37 | System.kext/PlugIns/IONVRAMFamily.kext/Info.plist \ | |
38 | System.kext/PlugIns/IOSystemManagement.kext/Info.plist \ | |
91447636 | 39 | System.kext/PlugIns/Unsupported.kext/Info.plist \ |
6d2010ae | 40 | System.kext/PlugIns/Private.kext/Info.plist |
d7e50217 | 41 | |
6d2010ae | 42 | INSTALL_KEXT_DIR = /System/Library/Extensions/ |
d7e50217 | 43 | |
d7e50217 | 44 | |
b0d623f7 A |
45 | MD_SUPPORTED_KPI_FILENAME="SupportedKPIs-${ARCH_CONFIG_LC}.txt" |
46 | MI_SUPPORTED_KPI_FILENAME="SupportedKPIs-all-archs.txt" | |
55e303ae | 47 | |
2d21ac55 A |
48 | ifneq ($(MACHINE_CONFIG), DEFAULT) |
49 | OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG) | |
50 | else | |
51 | OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG) | |
52 | endif | |
53 | ||
b0d623f7 A |
54 | ifeq ($(ARCH_CONFIG),I386) |
55 | SUPPORT_SYSTEM60_KEXT = 1 | |
b0d623f7 A |
56 | else |
57 | SUPPORT_SYSTEM60_KEXT = 0 | |
58 | endif | |
59 | ||
6d2010ae A |
60 | ifeq ($(SUPPORT_SYSTEM60_KEXT),1) |
61 | INSTALL_KEXT_PLIST_LIST += \ | |
62 | System.kext/PlugIns/System6.0.kext/Info.plist \ | |
63 | System.kext/PlugIns/Libkern6.0.kext/Info.plist \ | |
64 | System.kext/PlugIns/Mach6.0.kext/Info.plist \ | |
65 | System.kext/PlugIns/BSDKernel6.0.kext/Info.plist \ | |
66 | System.kext/PlugIns/IOKit6.0.kext/Info.plist | |
67 | endif | |
68 | ||
55e303ae A |
69 | SYMBOL_COMPONENT_LIST = \ |
70 | System6.0 \ | |
71 | BSDKernel \ | |
72 | IOKit \ | |
6d2010ae A |
73 | Libkern \ |
74 | Mach \ | |
75 | MACFramework \ | |
76 | Unsupported \ | |
77 | Private | |
2d21ac55 A |
78 | |
79 | SYMBOL_SET_BUILD = $(foreach set, $(SYMBOL_COMPONENT_LIST), $(OBJPATH)/$(set).symbolset) | |
55e303ae A |
80 | SYMBOL_SET_FAT = $(foreach set, $(SYMBOL_COMPONENT_LIST), $(OBJROOT)/$(set).symbolset) |
81 | ||
6d2010ae A |
82 | INSTALL_KEXT_PLISTS = $(addprefix $(DSTROOT)$(INSTALL_KEXT_DIR), $(INSTALL_KEXT_PLIST_LIST)) |
83 | ||
84 | $(INSTALL_KEXT_PLISTS): $(DSTROOT)$(INSTALL_KEXT_DIR)% : $(SOURCE)/% | |
85 | @echo Install $< in $@ | |
86 | $(_v)$(MKDIR) $(dir $@); \ | |
87 | $(RM) $(RMFLAGS) $@; \ | |
88 | $(INSTALL) $(DATA_INSTALL_FLAGS) $< $(dir $@) | |
55e303ae | 89 | |
2d21ac55 | 90 | $(OBJPATH)/allsymbols: $(OBJPATH)/mach_kernel |
b0d623f7 | 91 | $(_v)$(NM) -gj $< > $@ |
55e303ae | 92 | |
2d21ac55 | 93 | $(SYMBOL_SET_BUILD): $(OBJPATH)/%.symbolset : %.exports %.$(ARCH_CONFIG_LC).exports $(OBJPATH)/allsymbols |
b0d623f7 A |
94 | $(_v)if [ "$*" != System6.0 -o $(SUPPORT_SYSTEM60_KEXT) -eq 1 ]; then \ |
95 | $(KEXT_CREATE_SYMBOL_SET) \ | |
316670eb | 96 | $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_)) \ |
2d21ac55 | 97 | -import $(OBJPATH)/allsymbols \ |
55e303ae A |
98 | -export $*.exports \ |
99 | -export $*.$(ARCH_CONFIG_LC).exports \ | |
b0d623f7 A |
100 | -output $@ $(_vstdout); \ |
101 | fi | |
102 | $(_v)if [ ! -e $@ ]; then \ | |
103 | printf "" > $@; \ | |
104 | fi | |
105 | ||
106 | # When building the top-level install target for all architectures, aggregate the per-arch | |
107 | # symbolsets for the primary machine configuration for each kernel/arch config | |
108 | $(SYMBOL_SET_FAT): $(OBJROOT)/%.symbolset : | |
109 | $(_v)per_arch_symbolsets=""; \ | |
b0d623f7 A |
110 | for arch_config in $(INSTALL_ARCHS); \ |
111 | do \ | |
316670eb A |
112 | \ |
113 | my_counter=1; \ | |
114 | found_arch=0; \ | |
115 | for my_config in $(TARGET_CONFIGS_UC); \ | |
116 | do \ | |
117 | if [ $${my_counter} -eq 1 ] ; then \ | |
118 | kernel_config=$${my_config}; \ | |
119 | elif [ $${my_counter} -eq 2 ] ; then \ | |
120 | if [ $${my_config} = $${arch_config} ]; then \ | |
121 | found_arch=1; \ | |
122 | fi; \ | |
123 | else \ | |
124 | if [ $${found_arch} -eq 1 ]; then \ | |
125 | machine_config=$${my_config};\ | |
126 | break; \ | |
127 | fi; \ | |
128 | my_counter=0; \ | |
129 | fi; \ | |
130 | my_counter=$$((my_counter + 1)); \ | |
131 | done; \ | |
132 | \ | |
b0d623f7 A |
133 | if [ $${arch_config} = ARM ] ; then \ |
134 | if [ $${machine_config} = DEFAULT ] ; then \ | |
135 | machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \ | |
136 | fi; \ | |
137 | fi; \ | |
316670eb A |
138 | if [ $${arch_config} = L4_ARM ] ; then \ |
139 | if [ $${machine_config} = DEFAULT ] ; then \ | |
140 | machine_config=$(DEFAULT_L4_ARM_MACHINE_CONFIG); \ | |
141 | fi; \ | |
142 | fi; \ | |
b0d623f7 A |
143 | if [ $${machine_config} = DEFAULT ] ; then \ |
144 | objpath=${OBJROOT}/$${kernel_config}_$${arch_config}; \ | |
145 | else \ | |
146 | objpath=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}; \ | |
147 | fi; \ | |
148 | if [ -s "$${objpath}/$*.symbolset" ]; then \ | |
149 | per_arch_symbolsets="$${per_arch_symbolsets} $${objpath}/$*.symbolset"; \ | |
150 | fi; \ | |
151 | done; \ | |
152 | if [ -n "$${per_arch_symbolsets}" ]; then \ | |
153 | $(LIPO) $${per_arch_symbolsets} -create -output $@; \ | |
154 | else \ | |
155 | printf "" > $@; \ | |
156 | fi | |
55e303ae | 157 | |
6d2010ae | 158 | build_symbol_sets: $(SYMBOL_SET_BUILD) $(OBJPATH)/allsymbols |
2d21ac55 | 159 | $(_v)$(KEXT_CREATE_SYMBOL_SET) \ |
316670eb | 160 | $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_)) \ |
6d2010ae A |
161 | $(foreach comp,$(filter-out System6.0 Private,$(SYMBOL_COMPONENT_LIST)), \ |
162 | -export $(SRCROOT)/$(COMPONENT)/$(comp).exports \ | |
163 | -export $(SRCROOT)/$(COMPONENT)/$(comp).$(ARCH_CONFIG_LC).exports) \ | |
2d21ac55 | 164 | -import $(OBJPATH)/allsymbols \ |
b0d623f7 A |
165 | -output /dev/null $(_vstdout); |
166 | $(_v)$(KEXT_CREATE_SYMBOL_SET) \ | |
316670eb | 167 | $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_)) \ |
6d2010ae A |
168 | $(foreach comp,$(filter-out System6.0 Unsupported,$(SYMBOL_COMPONENT_LIST)), \ |
169 | -export $(SRCROOT)/$(COMPONENT)/$(comp).exports \ | |
170 | -export $(SRCROOT)/$(COMPONENT)/$(comp).$(ARCH_CONFIG_LC).exports) \ | |
b0d623f7 | 171 | -import $(OBJPATH)/allsymbols \ |
b0d623f7 A |
172 | -output /dev/null $(_vstdout); |
173 | $(_v) $(SRCROOT)/$(COMPONENT)/list_supported.sh $(SRCROOT)/$(COMPONENT) $(ARCH_CONFIG_LC) $(OBJPATH)/${MD_SUPPORTED_KPI_FILENAME}; | |
174 | $(_v)if [ -n `echo $${ARCH_CONFIGS%%\ *} | grep -i $(ARCH_CONFIG)` ]; \ | |
175 | then \ | |
176 | $(SRCROOT)/$(COMPONENT)/list_supported.sh $(SRCROOT)/$(COMPONENT) "ALL" $(OBJROOT)/${MI_SUPPORTED_KPI_FILENAME}; \ | |
177 | fi | |
178 | ||
91447636 | 179 | |
6d2010ae A |
180 | install_symbol_sets: $(SYMBOL_SET_FAT) $(SRCROOT)/config/MasterVersion $(INSTALL_KEXT_PLISTS) |
181 | $(_v)if [ -s "$(OBJROOT)/System6.0.symbolset" -a $(SUPPORT_SYSTEM60_KEXT) -eq 1 ]; then \ | |
182 | install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/System6.0.kext/kernel.6.0; \ | |
183 | install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Mach6.0.kext/Mach6.0; \ | |
184 | install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/BSDKernel6.0.kext/BSDKernel6.0; \ | |
185 | install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Libkern6.0.kext/Libkern6.0; \ | |
186 | install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/IOKit6.0.kext/IOKit6.0; \ | |
187 | fi | |
188 | $(_v)if [ -s "$(OBJROOT)/BSDKernel.symbolset" ]; then \ | |
189 | install $(INSTALL_FLAGS) $(OBJROOT)/BSDKernel.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/BSDKernel.kext/BSDKernel; \ | |
190 | install $(INSTALL_FLAGS) $(OBJROOT)/IOKit.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/IOKit.kext/IOKit; \ | |
191 | install $(INSTALL_FLAGS) $(OBJROOT)/Libkern.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Libkern.kext/Libkern; \ | |
192 | install $(INSTALL_FLAGS) $(OBJROOT)/Mach.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Mach.kext/Mach; \ | |
193 | install $(INSTALL_FLAGS) $(OBJROOT)/MACFramework.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/MACFramework.kext/MACFramework; \ | |
194 | install $(INSTALL_FLAGS) $(OBJROOT)/Unsupported.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Unsupported.kext/Unsupported; \ | |
195 | install $(INSTALL_FLAGS) $(OBJROOT)/Private.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Private.kext/Private; \ | |
b0d623f7 | 196 | fi |
6d2010ae A |
197 | $(_v)$(NEWVERS) $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/Info.plist \ |
198 | $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/AppleNMI.kext/Info.plist \ | |
199 | $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/ApplePlatformFamily.kext/Info.plist \ | |
200 | $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/BSDKernel.kext/Info.plist \ | |
201 | $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/IOKit.kext/Info.plist \ | |
202 | $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/IONVRAMFamily.kext/Info.plist \ | |
203 | $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/IOSystemManagement.kext/Info.plist \ | |
204 | $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Libkern.kext/Info.plist \ | |
205 | $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Mach.kext/Info.plist \ | |
206 | $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/MACFramework.kext/Info.plist \ | |
207 | $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Unsupported.kext/Info.plist \ | |
208 | $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Private.kext/Info.plist; | |
b0d623f7 A |
209 | $(_v)$(MKDIR) $(DSTROOT)/$(KRESDIR); |
210 | $(_v)install $(INSTALL_FLAGS) $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME) $(DSTROOT)/$(KRESDIR); | |
211 | $(_v)if [ -n `echo $${ARCH_CONFIGS%%\ *} | grep -i $(ARCH_CONFIG)` ]; then \ | |
212 | install $(INSTALL_FLAGS) $(OBJROOT)/$(MI_SUPPORTED_KPI_FILENAME) $(DSTROOT)/$(KRESDIR); \ | |
213 | fi | |
6d2010ae A |
214 | $(_v)$(MKDIR) $(SYMROOT) |
215 | $(_v)$(CP) -rf $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext $(SYMROOT) | |
55e303ae A |
216 | |
217 | do_build_all: build_symbol_sets | |
218 | ||
b0d623f7 | 219 | do_build_install: install_symbol_sets |
55e303ae | 220 | |
b7266188 A |
221 | EXPORTS_FILE_LIST = $(addprefix $(SOURCE)/,$(foreach set,$(SYMBOL_COMPONENT_LIST), $(set).exports $(set).$(ARCH_CONFIG_LC).exports)) |
222 | EXPORTS_FILE_LIST_NOSYSTEM60 = $(addprefix $(SOURCE)/,$(foreach set, $(filter-out System6.0,$(SYMBOL_COMPONENT_LIST)), $(set).exports $(set).$(ARCH_CONFIG_LC).exports)) | |
223 | ||
224 | # Does not include "whole-kernel" clients | |
225 | build_mach_kernel_exports: | |
226 | $(_v)if [ $(SUPPORT_SYSTEM60_KEXT) -eq 1 ]; then \ | |
227 | $(SOURCE)/generate_linker_exports.sh $(OBJPATH)/kernel-kpi.exp \ | |
228 | $(EXPORTS_FILE_LIST) || exit 1; \ | |
229 | else \ | |
230 | $(SOURCE)/generate_linker_exports.sh $(OBJPATH)/kernel-kpi.exp \ | |
231 | $(EXPORTS_FILE_LIST_NOSYSTEM60) || exit 1; \ | |
232 | fi; | |
233 | ||
d7e50217 A |
234 | include $(MakeInc_rule) |
235 | include $(MakeInc_dir) |