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
13 INSTINC_SUBDIRS_I386 =
14 INSTINC_SUBDIRS_X86_64 =
19 EXPINC_SUBDIRS_X86_64 =
28 INSTALL_KEXT_PLIST_LIST= \
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 \
33 System.kext/PlugIns/MACFramework.kext/Info.plist \
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 \
39 System.kext/PlugIns/Unsupported.kext/Info.plist \
40 System.kext/PlugIns/Private.kext/Info.plist
42 INSTALL_KEXT_DIR = /System/Library/Extensions/
45 MD_SUPPORTED_KPI_FILENAME="SupportedKPIs-${ARCH_CONFIG_LC}.txt"
46 MI_SUPPORTED_KPI_FILENAME="SupportedKPIs-all-archs.txt"
48 ifneq ($(MACHINE_CONFIG), DEFAULT)
49 OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)
51 OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)
54 ifeq ($(ARCH_CONFIG),I386)
55 SUPPORT_SYSTEM60_KEXT = 1
57 SUPPORT_SYSTEM60_KEXT = 0
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
69 SYMBOL_COMPONENT_LIST = \
79 SYMBOL_SET_BUILD = $(foreach set, $(SYMBOL_COMPONENT_LIST), $(OBJPATH)/$(set).symbolset)
80 SYMBOL_SET_FAT = $(foreach set, $(SYMBOL_COMPONENT_LIST), $(OBJROOT)/$(set).symbolset)
82 INSTALL_KEXT_PLISTS = $(addprefix $(DSTROOT)$(INSTALL_KEXT_DIR), $(INSTALL_KEXT_PLIST_LIST))
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 $@)
90 $(OBJPATH)/allsymbols: $(OBJPATH)/mach_kernel
91 $(_v)$(NM) -gj $< > $@
93 $(SYMBOL_SET_BUILD): $(OBJPATH)/%.symbolset : %.exports %.$(ARCH_CONFIG_LC).exports $(OBJPATH)/allsymbols
94 $(_v)if [ "$*" != System6.0 -o $(SUPPORT_SYSTEM60_KEXT) -eq 1 ]; then \
95 $(KEXT_CREATE_SYMBOL_SET) \
96 $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_)) \
97 -import $(OBJPATH)/allsymbols \
99 -export $*.$(ARCH_CONFIG_LC).exports \
100 -output $@ $(_vstdout); \
102 $(_v)if [ ! -e $@ ]; then \
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=""; \
110 for arch_config in $(INSTALL_ARCHS); \
115 for my_config in $(TARGET_CONFIGS_UC); \
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 \
124 if [ $${found_arch} -eq 1 ]; then \
125 machine_config=$${my_config};\
130 my_counter=$$((my_counter + 1)); \
133 if [ $${arch_config} = ARM ] ; then \
134 if [ $${machine_config} = DEFAULT ] ; then \
135 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
138 if [ $${arch_config} = L4_ARM ] ; then \
139 if [ $${machine_config} = DEFAULT ] ; then \
140 machine_config=$(DEFAULT_L4_ARM_MACHINE_CONFIG); \
143 if [ $${machine_config} = DEFAULT ] ; then \
144 objpath=${OBJROOT}/$${kernel_config}_$${arch_config}; \
146 objpath=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}; \
148 if [ -s "$${objpath}/$*.symbolset" ]; then \
149 per_arch_symbolsets="$${per_arch_symbolsets} $${objpath}/$*.symbolset"; \
152 if [ -n "$${per_arch_symbolsets}" ]; then \
153 $(LIPO) $${per_arch_symbolsets} -create -output $@; \
158 build_symbol_sets: $(SYMBOL_SET_BUILD) $(OBJPATH)/allsymbols
159 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
160 $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_)) \
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) \
164 -import $(OBJPATH)/allsymbols \
165 -output /dev/null $(_vstdout);
166 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
167 $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_)) \
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) \
171 -import $(OBJPATH)/allsymbols \
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)` ]; \
176 $(SRCROOT)/$(COMPONENT)/list_supported.sh $(SRCROOT)/$(COMPONENT) "ALL" $(OBJROOT)/${MI_SUPPORTED_KPI_FILENAME}; \
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; \
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; \
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;
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); \
214 $(_v)$(MKDIR) $(SYMROOT)
215 $(_v)$(CP) -rf $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext $(SYMROOT)
217 do_build_all: build_symbol_sets
219 do_build_install: install_symbol_sets
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))
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; \
230 $(SOURCE)/generate_linker_exports.sh $(OBJPATH)/kernel-kpi.exp \
231 $(EXPORTS_FILE_LIST_NOSYSTEM60) || exit 1; \
234 include $(MakeInc_rule)
235 include $(MakeInc_dir)