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_ALL_)) \
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 kernel_config=$(INSTALL_TYPE); \
111 machine_config=$(MACHINE_CONFIG); \
112 for arch_config in $(INSTALL_ARCHS); \
114 if [ $${arch_config} = ARM ] ; then \
115 if [ $${machine_config} = DEFAULT ] ; then \
116 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
119 if [ $${machine_config} = DEFAULT ] ; then \
120 objpath=${OBJROOT}/$${kernel_config}_$${arch_config}; \
122 objpath=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}; \
124 if [ -s "$${objpath}/$*.symbolset" ]; then \
125 per_arch_symbolsets="$${per_arch_symbolsets} $${objpath}/$*.symbolset"; \
128 if [ -n "$${per_arch_symbolsets}" ]; then \
129 $(LIPO) $${per_arch_symbolsets} -create -output $@; \
134 build_symbol_sets: $(SYMBOL_SET_BUILD) $(OBJPATH)/allsymbols
135 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
136 $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_ALL_)) \
137 $(foreach comp,$(filter-out System6.0 Private,$(SYMBOL_COMPONENT_LIST)), \
138 -export $(SRCROOT)/$(COMPONENT)/$(comp).exports \
139 -export $(SRCROOT)/$(COMPONENT)/$(comp).$(ARCH_CONFIG_LC).exports) \
140 -import $(OBJPATH)/allsymbols \
141 -output /dev/null $(_vstdout);
142 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
143 $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_ALL_)) \
144 $(foreach comp,$(filter-out System6.0 Unsupported,$(SYMBOL_COMPONENT_LIST)), \
145 -export $(SRCROOT)/$(COMPONENT)/$(comp).exports \
146 -export $(SRCROOT)/$(COMPONENT)/$(comp).$(ARCH_CONFIG_LC).exports) \
147 -import $(OBJPATH)/allsymbols \
148 -output /dev/null $(_vstdout);
149 $(_v) $(SRCROOT)/$(COMPONENT)/list_supported.sh $(SRCROOT)/$(COMPONENT) $(ARCH_CONFIG_LC) $(OBJPATH)/${MD_SUPPORTED_KPI_FILENAME};
150 $(_v)if [ -n `echo $${ARCH_CONFIGS%%\ *} | grep -i $(ARCH_CONFIG)` ]; \
152 $(SRCROOT)/$(COMPONENT)/list_supported.sh $(SRCROOT)/$(COMPONENT) "ALL" $(OBJROOT)/${MI_SUPPORTED_KPI_FILENAME}; \
156 install_symbol_sets: $(SYMBOL_SET_FAT) $(SRCROOT)/config/MasterVersion $(INSTALL_KEXT_PLISTS)
157 $(_v)if [ -s "$(OBJROOT)/System6.0.symbolset" -a $(SUPPORT_SYSTEM60_KEXT) -eq 1 ]; then \
158 install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/System6.0.kext/kernel.6.0; \
159 install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Mach6.0.kext/Mach6.0; \
160 install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/BSDKernel6.0.kext/BSDKernel6.0; \
161 install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Libkern6.0.kext/Libkern6.0; \
162 install $(INSTALL_FLAGS) $(OBJROOT)/System6.0.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/IOKit6.0.kext/IOKit6.0; \
164 $(_v)if [ -s "$(OBJROOT)/BSDKernel.symbolset" ]; then \
165 install $(INSTALL_FLAGS) $(OBJROOT)/BSDKernel.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/BSDKernel.kext/BSDKernel; \
166 install $(INSTALL_FLAGS) $(OBJROOT)/IOKit.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/IOKit.kext/IOKit; \
167 install $(INSTALL_FLAGS) $(OBJROOT)/Libkern.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Libkern.kext/Libkern; \
168 install $(INSTALL_FLAGS) $(OBJROOT)/Mach.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Mach.kext/Mach; \
169 install $(INSTALL_FLAGS) $(OBJROOT)/MACFramework.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/MACFramework.kext/MACFramework; \
170 install $(INSTALL_FLAGS) $(OBJROOT)/Unsupported.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Unsupported.kext/Unsupported; \
171 install $(INSTALL_FLAGS) $(OBJROOT)/Private.symbolset $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Private.kext/Private; \
173 $(_v)$(NEWVERS) $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/Info.plist \
174 $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/AppleNMI.kext/Info.plist \
175 $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/ApplePlatformFamily.kext/Info.plist \
176 $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/BSDKernel.kext/Info.plist \
177 $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/IOKit.kext/Info.plist \
178 $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/IONVRAMFamily.kext/Info.plist \
179 $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/IOSystemManagement.kext/Info.plist \
180 $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Libkern.kext/Info.plist \
181 $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Mach.kext/Info.plist \
182 $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/MACFramework.kext/Info.plist \
183 $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Unsupported.kext/Info.plist \
184 $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext/PlugIns/Private.kext/Info.plist;
185 $(_v)$(MKDIR) $(DSTROOT)/$(KRESDIR);
186 $(_v)install $(INSTALL_FLAGS) $(OBJPATH)/$(MD_SUPPORTED_KPI_FILENAME) $(DSTROOT)/$(KRESDIR);
187 $(_v)if [ -n `echo $${ARCH_CONFIGS%%\ *} | grep -i $(ARCH_CONFIG)` ]; then \
188 install $(INSTALL_FLAGS) $(OBJROOT)/$(MI_SUPPORTED_KPI_FILENAME) $(DSTROOT)/$(KRESDIR); \
190 $(_v)$(MKDIR) $(SYMROOT)
191 $(_v)$(CP) -rf $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext $(SYMROOT)
193 do_build_all: build_symbol_sets
195 do_build_install: install_symbol_sets
197 EXPORTS_FILE_LIST = $(addprefix $(SOURCE)/,$(foreach set,$(SYMBOL_COMPONENT_LIST), $(set).exports $(set).$(ARCH_CONFIG_LC).exports))
198 EXPORTS_FILE_LIST_NOSYSTEM60 = $(addprefix $(SOURCE)/,$(foreach set, $(filter-out System6.0,$(SYMBOL_COMPONENT_LIST)), $(set).exports $(set).$(ARCH_CONFIG_LC).exports))
200 # Does not include "whole-kernel" clients
201 build_mach_kernel_exports:
202 $(_v)if [ $(SUPPORT_SYSTEM60_KEXT) -eq 1 ]; then \
203 $(SOURCE)/generate_linker_exports.sh $(OBJPATH)/kernel-kpi.exp \
204 $(EXPORTS_FILE_LIST) || exit 1; \
206 $(SOURCE)/generate_linker_exports.sh $(OBJPATH)/kernel-kpi.exp \
207 $(EXPORTS_FILE_LIST_NOSYSTEM60) || exit 1; \
210 include $(MakeInc_rule)
211 include $(MakeInc_dir)