]> git.saurik.com Git - apple/xnu.git/blame - config/Makefile
xnu-1699.22.73.tar.gz
[apple/xnu.git] / config / Makefile
CommitLineData
d7e50217
A
1export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
2export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
3export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
4export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
5
6
7include $(MakeInc_cmd)
8include $(MakeInc_def)
9
10ALL_SUBDIRS =
11
12INSTINC_SUBDIRS =
d7e50217 13INSTINC_SUBDIRS_I386 =
b0d623f7 14INSTINC_SUBDIRS_X86_64 =
2d21ac55
A
15INSTINC_SUBDIRS_ARM =
16
d7e50217 17EXPINC_SUBDIRS =
d7e50217 18EXPINC_SUBDIRS_I386 =
b0d623f7 19EXPINC_SUBDIRS_X86_64 =
2d21ac55
A
20EXPINC_SUBDIRS_ARM =
21
6d2010ae 22
d7e50217
A
23COMP_SUBDIRS =
24
25INST_SUBDIRS =
26
55e303ae 27
6d2010ae 28INSTALL_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 42INSTALL_KEXT_DIR = /System/Library/Extensions/
d7e50217 43
d7e50217 44
b0d623f7
A
45MD_SUPPORTED_KPI_FILENAME="SupportedKPIs-${ARCH_CONFIG_LC}.txt"
46MI_SUPPORTED_KPI_FILENAME="SupportedKPIs-all-archs.txt"
55e303ae 47
2d21ac55
A
48ifneq ($(MACHINE_CONFIG), DEFAULT)
49OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)
50else
51OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)
52endif
53
b0d623f7
A
54ifeq ($(ARCH_CONFIG),I386)
55SUPPORT_SYSTEM60_KEXT = 1
b0d623f7
A
56else
57SUPPORT_SYSTEM60_KEXT = 0
58endif
59
6d2010ae
A
60ifeq ($(SUPPORT_SYSTEM60_KEXT),1)
61INSTALL_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
67endif
68
55e303ae
A
69SYMBOL_COMPONENT_LIST = \
70 System6.0 \
71 BSDKernel \
72 IOKit \
6d2010ae
A
73 Libkern \
74 Mach \
75 MACFramework \
76 Unsupported \
77 Private
2d21ac55
A
78
79SYMBOL_SET_BUILD = $(foreach set, $(SYMBOL_COMPONENT_LIST), $(OBJPATH)/$(set).symbolset)
55e303ae
A
80SYMBOL_SET_FAT = $(foreach set, $(SYMBOL_COMPONENT_LIST), $(OBJROOT)/$(set).symbolset)
81
6d2010ae
A
82INSTALL_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) \
c910b4d9 96 $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_ALL_)) \
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=""; \
110 kernel_config=$(INSTALL_TYPE); \
111 machine_config=$(MACHINE_CONFIG); \
112 for arch_config in $(INSTALL_ARCHS); \
113 do \
114 if [ $${arch_config} = ARM ] ; then \
115 if [ $${machine_config} = DEFAULT ] ; then \
116 machine_config=$(DEFAULT_ARM_MACHINE_CONFIG); \
117 fi; \
118 fi; \
119 if [ $${machine_config} = DEFAULT ] ; then \
120 objpath=${OBJROOT}/$${kernel_config}_$${arch_config}; \
121 else \
122 objpath=${OBJROOT}/$${kernel_config}_$${arch_config}_$${machine_config}; \
123 fi; \
124 if [ -s "$${objpath}/$*.symbolset" ]; then \
125 per_arch_symbolsets="$${per_arch_symbolsets} $${objpath}/$*.symbolset"; \
126 fi; \
127 done; \
128 if [ -n "$${per_arch_symbolsets}" ]; then \
129 $(LIPO) $${per_arch_symbolsets} -create -output $@; \
130 else \
131 printf "" > $@; \
132 fi
55e303ae 133
6d2010ae 134build_symbol_sets: $(SYMBOL_SET_BUILD) $(OBJPATH)/allsymbols
2d21ac55 135 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
c910b4d9 136 $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_ALL_)) \
6d2010ae
A
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) \
2d21ac55 140 -import $(OBJPATH)/allsymbols \
b0d623f7
A
141 -output /dev/null $(_vstdout);
142 $(_v)$(KEXT_CREATE_SYMBOL_SET) \
6d2010ae
A
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) \
b0d623f7 147 -import $(OBJPATH)/allsymbols \
b0d623f7
A
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)` ]; \
151 then \
152 $(SRCROOT)/$(COMPONENT)/list_supported.sh $(SRCROOT)/$(COMPONENT) "ALL" $(OBJROOT)/${MI_SUPPORTED_KPI_FILENAME}; \
153 fi
154
91447636 155
6d2010ae
A
156install_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; \
163 fi
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; \
b0d623f7 172 fi
6d2010ae
A
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;
b0d623f7
A
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); \
189 fi
6d2010ae
A
190 $(_v)$(MKDIR) $(SYMROOT)
191 $(_v)$(CP) -rf $(DSTROOT)/$(INSTALL_KEXT_DIR)/System.kext $(SYMROOT)
55e303ae
A
192
193do_build_all: build_symbol_sets
194
b0d623f7 195do_build_install: install_symbol_sets
55e303ae 196
b7266188
A
197EXPORTS_FILE_LIST = $(addprefix $(SOURCE)/,$(foreach set,$(SYMBOL_COMPONENT_LIST), $(set).exports $(set).$(ARCH_CONFIG_LC).exports))
198EXPORTS_FILE_LIST_NOSYSTEM60 = $(addprefix $(SOURCE)/,$(foreach set, $(filter-out System6.0,$(SYMBOL_COMPONENT_LIST)), $(set).exports $(set).$(ARCH_CONFIG_LC).exports))
199
200# Does not include "whole-kernel" clients
201build_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; \
205 else \
206 $(SOURCE)/generate_linker_exports.sh $(OBJPATH)/kernel-kpi.exp \
207 $(EXPORTS_FILE_LIST_NOSYSTEM60) || exit 1; \
208 fi;
209
d7e50217
A
210include $(MakeInc_rule)
211include $(MakeInc_dir)