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