]> git.saurik.com Git - apple/xnu.git/blame - config/Makefile
xnu-1486.2.11.tar.gz
[apple/xnu.git] / config / Makefile
CommitLineData
2d21ac55
A
1MAC = defined
2
d7e50217
A
3export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
4export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
5export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
6export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
7
8
9include $(MakeInc_cmd)
10include $(MakeInc_def)
11
12ALL_SUBDIRS =
13
14INSTINC_SUBDIRS =
15
16INSTINC_SUBDIRS_PPC =
17
18INSTINC_SUBDIRS_I386 =
19
b0d623f7
A
20INSTINC_SUBDIRS_X86_64 =
21
2d21ac55
A
22INSTINC_SUBDIRS_ARM =
23
d7e50217
A
24EXPINC_SUBDIRS =
25
26EXPINC_SUBDIRS_PPC =
27
28EXPINC_SUBDIRS_I386 =
29
b0d623f7
A
30EXPINC_SUBDIRS_X86_64 =
31
2d21ac55
A
32EXPINC_SUBDIRS_ARM =
33
d7e50217
A
34COMP_SUBDIRS =
35
36INST_SUBDIRS =
37
55e303ae 38
d7e50217 39INSTALL_DATA_LIST= \
55e303ae
A
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 \
2d21ac55 44 System.kext/PlugIns/MACFramework.kext/Info.plist \
55e303ae
A
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 \
91447636 50 System.kext/PlugIns/Unsupported.kext/Info.plist \
b0d623f7 51 System.kext/PlugIns/Private.kext/Info.plist \
55e303ae
A
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 \
d7e50217
A
58
59INSTALL_DATA_DIR= \
60 /System/Library/Extensions/
61
62INSTMAN_SUBDIRS =
63
b0d623f7
A
64MD_SUPPORTED_KPI_FILENAME="SupportedKPIs-${ARCH_CONFIG_LC}.txt"
65MI_SUPPORTED_KPI_FILENAME="SupportedKPIs-all-archs.txt"
55e303ae 66
2d21ac55
A
67ifneq ($(MACHINE_CONFIG), DEFAULT)
68OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)
69else
70OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)
71endif
72
b0d623f7
A
73ifeq ($(ARCH_CONFIG),I386)
74SUPPORT_SYSTEM60_KEXT = 1
75else ifeq ($(ARCH_CONFIG),ARM)
76SUPPORT_SYSTEM60_KEXT = 1
77else
78SUPPORT_SYSTEM60_KEXT = 0
79endif
80
55e303ae
A
81SYMBOL_COMPONENT_LIST = \
82 System6.0 \
83 BSDKernel \
84 IOKit \
85 Libkern \
91447636 86 Mach \
b0d623f7
A
87 Unsupported \
88 Private
55e303ae 89
2d21ac55
A
90ifdef MAC
91SYMBOL_COMPONENT_LIST += MACFramework
92MACFRAMEWORKEXPORTS = \
93 -export $(SRCROOT)/$(COMPONENT)/MACFramework.exports \
94 -export $(SRCROOT)/$(COMPONENT)/MACFramework.$(ARCH_CONFIG_LC).exports
95endif
96
97SYMBOL_SET_BUILD = $(foreach set, $(SYMBOL_COMPONENT_LIST), $(OBJPATH)/$(set).symbolset)
55e303ae
A
98SYMBOL_SET_FAT = $(foreach set, $(SYMBOL_COMPONENT_LIST), $(OBJROOT)/$(set).symbolset)
99
100## .SUFFIXES: .symbolset .symbollist
101
2d21ac55 102$(OBJPATH)/allsymbols: $(OBJPATH)/mach_kernel
b0d623f7 103 $(_v)$(NM) -gj $< > $@
55e303ae 104
2d21ac55 105$(SYMBOL_SET_BUILD): $(OBJPATH)/%.symbolset : %.exports %.$(ARCH_CONFIG_LC).exports $(OBJPATH)/allsymbols
b0d623f7
A
106 $(_v)if [ "$*" != System6.0 -o $(SUPPORT_SYSTEM60_KEXT) -eq 1 ]; then \
107 $(KEXT_CREATE_SYMBOL_SET) \
c910b4d9 108 $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_ALL_)) \
2d21ac55 109 -import $(OBJPATH)/allsymbols \
55e303ae
A
110 -export $*.exports \
111 -export $*.$(ARCH_CONFIG_LC).exports \
b0d623f7
A
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
55e303ae
A
145
146build_symbol_sets: $(SYMBOL_SET_BUILD)
2d21ac55 147 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
c910b4d9 148 $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_ALL_)) \
2d21ac55 149 -import $(OBJPATH)/allsymbols \
91447636
A
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 \
2d21ac55 158 $(MACFRAMEWORKEXPORTS) \
91447636
A
159 -export $(SRCROOT)/$(COMPONENT)/Unsupported.exports \
160 -export $(SRCROOT)/$(COMPONENT)/Unsupported.$(ARCH_CONFIG_LC).exports \
b0d623f7
A
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
91447636
A
183
184install_symbol_sets: $(SYMBOL_SET_FAT) $(SRCROOT)/config/MasterVersion
b0d623f7
A
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;
2d21ac55 198 $(_v)$(NEWVERS) $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext/Info.plist \
91447636
A
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 \
b0d623f7
A
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
214ifdef 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
217endif
218 $(_v)$(CP) -rf $(DSTROOT)/$(INSTALL_DATA_DIR)/System.kext $(SYMROOT)
55e303ae
A
219
220do_build_all: build_symbol_sets
221
b0d623f7 222do_build_install: install_symbol_sets
55e303ae 223
d7e50217
A
224include $(MakeInc_rule)
225include $(MakeInc_dir)