]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | export SOURCE=$(shell /bin/pwd) |
2 | ||
3 | # | |
4 | # gnumake 3.77 support | |
5 | # | |
6 | export USE_APPLE_PB_SUPPORT = all | |
7 | ||
8 | # | |
9 | # Incremental Build option | |
10 | # | |
11 | ifndef INCR_EXPORTHDRS | |
12 | ifeq ($(shell test -d $$OBJROOT/EXPORT_HDRS;echo $$?),0) | |
13 | export INCR_EXPORTHDRS = TRUE | |
14 | else | |
15 | export INCR_EXPORTHDRS = FALSE | |
16 | endif | |
17 | endif | |
18 | ||
1c79356b A |
19 | # |
20 | # Component List | |
21 | # | |
0b4e3aa0 | 22 | ifndef COMPONENT_LIST |
1c79356b | 23 | export COMPONENT_LIST = osfmk bsd iokit pexpert libkern libsa |
0b4e3aa0 A |
24 | export COMPONENT_LIST_UC := $(shell echo -n $(COMPONENT_LIST) | $(TR) a-z A-Z) |
25 | endif | |
26 | ifndef COMPONENT | |
27 | export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE)))) | |
28 | export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST)) | |
29 | else | |
30 | ifeq ($(COMPONENT), .) | |
31 | export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE)))) | |
32 | export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST)) | |
33 | endif | |
34 | endif | |
1c79356b A |
35 | |
36 | # Architecture options | |
37 | # | |
38 | # supported configurations : PPC I386 | |
39 | # | |
0b4e3aa0 | 40 | ifndef ARCH_CONFIGS |
1c79356b | 41 | ifdef RC_ARCHS |
0b4e3aa0 | 42 | export ARCH_CONFIGS := $(shell echo -n $(RC_ARCHS) | $(TR) a-z A-Z) |
1c79356b | 43 | else |
0b4e3aa0 A |
44 | export ARCH_CONFIGS := $(shell arch | $(TR) a-z A-Z) |
45 | endif | |
46 | endif | |
47 | ifdef ARCH_CONFIG | |
48 | ifndef ARCH_CONFIG_LC | |
49 | export ARCH_CONFIG_LC := $(shell echo -n $(ARCH_CONFIG) | $(TR) A-Z a-z) | |
1c79356b A |
50 | endif |
51 | endif | |
1c79356b A |
52 | |
53 | ||
54 | # Kernel Configuration options | |
55 | # | |
56 | # supported configurations : RELEASE DEBUG PROFILE | |
57 | # | |
58 | ifndef KERNEL_CONFIGS | |
59 | export KERNEL_CONFIGS = RELEASE | |
60 | endif | |
0b4e3aa0 | 61 | ifndef KERNEL_CONFIG |
1c79356b | 62 | export KERNEL_CONFIG = $(firstword $(KERNEL_CONFIGS)) |
0b4e3aa0 | 63 | endif |
1c79356b A |
64 | |
65 | # | |
66 | # Kernel Configuration to install | |
67 | # | |
68 | # supported install architecture : PPC I386 | |
69 | # | |
70 | export INSTALL_TYPE = RELEASE | |
0b4e3aa0 | 71 | ifndef INSTALL_ARCHS |
1c79356b A |
72 | ifdef RC_ARCHS |
73 | export INSTALL_ARCHS = $(ARCH_CONFIGS) | |
74 | else | |
75 | export INSTALL_ARCHS = $(ARCH_CONFIGS) | |
76 | endif | |
0b4e3aa0 A |
77 | export INSTALL_ARCHS_LC := $(shell echo -n $(ARCH_CONFIGS) | $(TR) A-Z a-z) |
78 | endif | |
1c79356b A |
79 | |
80 | export INSTALL_ARCH_DEFAULT = PPC | |
81 | ||
82 | # | |
83 | # Standard defines list | |
84 | # | |
91447636 | 85 | export DEFINES = -DAPPLE -DNeXT -DKERNEL -DKERNEL_PRIVATE -DXNU_KERNEL_PRIVATE -DPRIVATE -D__MACHO__=1 -Dvolatile=__volatile $(IDENT) |
1c79356b A |
86 | |
87 | # | |
88 | # Compiler command | |
89 | # | |
9bccf70c A |
90 | KCC = /usr/bin/cc |
91 | KC++ = /usr/bin/c++ | |
92 | CC = $(KCC) | |
93 | ||
91447636 A |
94 | # |
95 | # Compiler warning flags | |
96 | # | |
97 | ||
98 | CWARNFLAGS_STD = \ | |
99 | -Wall -Wno-format-y2k -W -Wstrict-prototypes -Wmissing-prototypes \ | |
100 | -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch \ | |
101 | -Wshadow -Wcast-align -Wbad-function-cast -Wchar-subscripts -Winline \ | |
102 | -Wnested-externs -Wredundant-decls | |
103 | ||
104 | export CWARNFLAGS ?= $(CWARNFLAGS_STD) | |
105 | ||
106 | MWARNFLAGS_STD = \ | |
107 | -Wall -Wno-format-y2k -W -Wstrict-prototypes -Wmissing-prototypes \ | |
108 | -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch \ | |
109 | -Wshadow -Wcast-align -Wbad-function-cast -Wchar-subscripts -Winline \ | |
110 | -Wnested-externs -Wredundant-decls | |
111 | ||
112 | export MWARNFLAGS ?= $(MWARNFLAGS_STD) | |
113 | ||
114 | CXXWARNFLAGS_STD = \ | |
115 | -Wall -Wno-format-y2k -W -Wstrict-prototypes -Wmissing-prototypes \ | |
116 | -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch \ | |
117 | -Wshadow -Wcast-align -Wchar-subscripts -Winline -Wredundant-decls \ | |
118 | -fpermissive | |
119 | ||
120 | export CXXWARNFLAGS ?= $(CXXWARNFLAGS_STD) | |
121 | ||
9bccf70c A |
122 | |
123 | # | |
124 | # Setup for parallel sub-makes when doing an RC build | |
125 | # | |
126 | ifndef MAKEJOBS | |
127 | ifeq "YES" "$(RC_XBS)" | |
128 | export MAKEJOBS = --jobs=3 | |
129 | endif | |
130 | endif | |
1c79356b A |
131 | |
132 | # | |
133 | # Default CFLAGS | |
134 | # | |
135 | ifdef RC_CFLAGS | |
136 | export OTHER_CFLAGS = $(subst $(addprefix -arch ,$(RC_ARCHS)),,$(RC_CFLAGS)) | |
137 | endif | |
138 | ||
9bccf70c A |
139 | export CFLAGS_GEN = -static -g -nostdinc -nostdlib -no-cpp-precomp \ |
140 | -fno-builtin -finline -fno-keep-inline-functions -msoft-float \ | |
91447636 | 141 | -fsigned-bitfields $(OTHER_CFLAGS) |
1c79356b A |
142 | |
143 | export CFLAGS_RELEASE = | |
55e303ae A |
144 | export CFLAGS_DEBUG = |
145 | export CFLAGS_PROFILE = -pg | |
1c79356b | 146 | |
55e303ae | 147 | export CFLAGS_PPC = -arch ppc -Dppc -DPPC -D__PPC__ -DPAGE_SIZE_FIXED |
91447636 A |
148 | export CFLAGS_I386 = -arch i386 -Di386 -DI386 -D__I386__ -DPAGE_SIZE_FIXED \ |
149 | -march=i686 -mpreferred-stack-boundary=2 -falign-functions=4 -mcpu=pentium4 -force_cpusubtype_ALL | |
1c79356b | 150 | |
0b4e3aa0 A |
151 | export CFLAGS_RELEASEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns |
152 | export CFLAGS_RELEASE_TRACEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns | |
55e303ae A |
153 | export CFLAGS_DEBUGPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns |
154 | export CFLAGS_PROFILEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns | |
91447636 A |
155 | export CFLAGS_RELEASEI386 = -Os |
156 | export CFLAGS_DEBUGI386 = -Os | |
157 | export CFLAGS_PROFILEI386 = -Os | |
1c79356b A |
158 | |
159 | export CFLAGS = $(CFLAGS_GEN) \ | |
160 | $($(addsuffix $(ARCH_CONFIG),CFLAGS_)) \ | |
161 | $($(addsuffix $(KERNEL_CONFIG),CFLAGS_)) \ | |
162 | $($(addsuffix $(ARCH_CONFIG), $(addsuffix $(KERNEL_CONFIG),CFLAGS_))) \ | |
163 | $(DEFINES) | |
164 | ||
55e303ae | 165 | # Default C++ flags |
1c79356b | 166 | # |
55e303ae | 167 | CXXFLAGS_GEN = -fno-rtti -fno-exceptions -fcheck-new -fapple-kext -fpermissive |
1c79356b | 168 | |
55e303ae A |
169 | CXXFLAGS = $(CXXFLAGS_GEN) \ |
170 | $($(addsuffix $(ARCH_CONFIG),CXXFLAGS_)) \ | |
171 | $($(addsuffix $(KERNEL_CONFIG),CXXFLAGS_)) | |
1c79356b A |
172 | |
173 | # | |
174 | # Assembler command | |
175 | # | |
176 | AS = /usr/bin/cc | |
177 | S_KCC = /usr/bin/cc | |
178 | ||
179 | # | |
180 | # Default SFLAGS | |
181 | # | |
182 | export SFLAGS_GEN = -static -D__ASSEMBLER__ -force_cpusubtype_ALL $(OTHER_CFLAGS) | |
183 | ||
184 | export SFLAGS_RELEASE = | |
185 | export SFLAGS_DEBUG = | |
186 | export SFLAGS_PROFILE = | |
187 | ||
188 | export SFLAGS_PPC = $(CFLAGS_PPC) | |
189 | export SFLAGS_I386 = $(CFLAGS_I386) | |
190 | ||
191 | export SFLAGS = $(SFLAGS_GEN) \ | |
192 | $($(addsuffix $(ARCH_CONFIG),SFLAGS_)) \ | |
193 | $($(addsuffix $(KERNEL_CONFIG),SFLAGS_)) \ | |
194 | $(DEFINES) | |
195 | ||
196 | # | |
197 | # Linker command | |
198 | # | |
199 | LD = /usr/bin/ld | |
200 | ||
201 | # | |
202 | # Default LDFLAGS | |
203 | # | |
55e303ae | 204 | export LDFLAGS_COMPONENT_GEN = -static -r $(COMP_LDFLAGS_COMPONENT_GEN) |
1c79356b | 205 | |
55e303ae A |
206 | export LDFLAGS_COMPONENT_RELEASE = $(COMP_LDFLAGS_COMPONENT_RELEASE) |
207 | export LDFLAGS_COMPONENT_DEBUG = $(COMP_LDFLAGS_COMPONENT_DEBUG) | |
208 | export LDFLAGS_COMPONENT_PROFILE = $(COMP_LDFLAGS_COMPONENT_PROFILE) | |
1c79356b | 209 | |
55e303ae A |
210 | export LDFLAGS_COMPONENT_PPC = -arch ppc $(COMP_LDFLAGS_COMPONENT_PPC) |
211 | export LDFLAGS_COMPONENT_I386 = -arch i386 $(COMP_LDFLAGS_COMPONENT_i386) | |
1c79356b A |
212 | |
213 | export LDFLAGS_COMPONENT = $(LDFLAGS_COMPONENT_GEN) \ | |
214 | $($(addsuffix $(ARCH_CONFIG),LDFLAGS_COMPONENT_)) \ | |
215 | $($(addsuffix $(KERNEL_CONFIG),LDFLAGS_COMPONENT_)) | |
216 | ||
91447636 A |
217 | export LDFLAGS_KERNEL_GEN = \ |
218 | -static \ | |
219 | -force_cpusubtype_ALL \ | |
220 | -e __start \ | |
221 | -segalign 0x1000 \ | |
222 | -sectalign __TEXT __text 0x1000 \ | |
223 | -sectalign __DATA __common 0x1000 \ | |
224 | -sectalign __DATA __bss 0x1000 \ | |
225 | -sectcreate __PRELINK __text /dev/null \ | |
226 | -sectcreate __PRELINK __symtab /dev/null \ | |
227 | -sectcreate __PRELINK __info /dev/null | |
1c79356b A |
228 | |
229 | export LDFLAGS_KERNEL_RELEASE = | |
230 | # -noseglinkedit | |
231 | export LDFLAGS_KERNEL_DEBUG = | |
232 | export LDFLAGS_KERNEL_PROFILE = | |
233 | ||
91447636 A |
234 | export LDFLAGS_KERNEL_PPC = \ |
235 | -arch ppc \ | |
236 | -segaddr __VECTORS 0x0 \ | |
237 | -segaddr __HIB 0x7000 \ | |
238 | -segaddr __TEXT 0xe000 | |
239 | ||
240 | export LDFLAGS_KERNEL_I386 = \ | |
241 | -arch i386 \ | |
242 | -segaddr __HIB 0xC0100000 \ | |
243 | -segaddr __TEXT 0xC0111000 | |
1c79356b A |
244 | |
245 | export LDFLAGS_KERNEL = $(LDFLAGS_KERNEL_GEN) \ | |
246 | $($(addsuffix $(ARCH_CONFIG),LDFLAGS_KERNEL_)) \ | |
247 | $($(addsuffix $(KERNEL_CONFIG),LDFLAGS_KERNEL_)) | |
248 | ||
249 | ||
250 | # | |
251 | # Default runtime libraries to be linked with the kernel | |
252 | # | |
253 | export LD_KERNEL_LIBS = -lcc_kext | |
254 | ||
255 | # | |
256 | # Default INCFLAGS | |
257 | # | |
258 | export INCFLAGS_IMPORT = $(patsubst %, -I$(OBJROOT)/EXPORT_HDRS/%, $(COMPONENT_IMPORT_LIST)) | |
259 | export INCFLAGS_EXTERN = -I$(OBJROOT)/EXTERN_HDRS -I$(SRCROOT)/EXTERNAL_HEADERS -I$(SRCROOT)/EXTERNAL_HEADERS/bsd | |
91447636 | 260 | export INCFLAGS_GEN = -I$(SRCROOT)/$(COMPONENT) -I$(OBJROOT)/EXPORT_HDRS/$(COMPONENT) |
1c79356b A |
261 | export INCFLAGS_POSIX = -I$(OBJROOT)/EXPORT_HDRS/bsd |
262 | export INCFLAGS_LOCAL = -I. | |
263 | ||
9bccf70c | 264 | export INCFLAGS = $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE) |
1c79356b A |
265 | |
266 | # | |
267 | # Default MIGFLAGS | |
268 | # | |
269 | export MIGFLAGS = $(DEFINES) $(INCFLAGS) $($(addsuffix $(ARCH_CONFIG),CFLAGS_)) | |
270 | ||
271 | # | |
272 | # Default VPATH | |
273 | # | |
274 | empty:= | |
275 | space:= $(empty) $(empty) | |
276 | export VPATH_IMPORT = $(subst $(space),:,$(patsubst %,$(OBJROOT)/EXPORT_HDRS/%,$(strip $(COMPONENT_IMPORT_LIST)))): | |
277 | export VPATH_EXTERN = $(OBJROOT)/EXTERN_HDRS: | |
278 | export VPATH_GEN = .:$(SOURCE): | |
279 | ||
280 | export VPATH = $(VPATH_GEN)$(VPATH_IMPORT)$(VPATH_EXTERN)$(VPATH_MAKEFILE) | |
281 | ||
282 | # | |
283 | # Macros that control installation of kernel and it's header files | |
284 | # | |
285 | # install flags for header files | |
286 | # | |
287 | INSTALL_FLAGS = -c -m 0444 | |
d7e50217 A |
288 | FILE_INSTALL_FLAGS = -c -m 0644 |
289 | DATA_INSTALL_FLAGS = -c -m 0644 | |
1c79356b A |
290 | |
291 | # | |
292 | # Header file destinations | |
293 | # | |
294 | FRAMEDIR = System/Library/Frameworks | |
295 | ifndef INCDIR | |
296 | INCDIR = /usr/include | |
297 | endif | |
298 | ifndef LCLDIR | |
299 | LCLDIR = $(FRAMEDIR)/System.framework/Versions/B/PrivateHeaders | |
300 | endif | |
301 | ||
302 | KINCVERS = A | |
303 | KINCFRAME = $(FRAMEDIR)/Kernel.framework | |
304 | KINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Headers | |
0b4e3aa0 | 305 | KPINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/PrivateHeaders |
91447636 A |
306 | KRESDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Resources |
307 | ||
308 | XNU_PRIVATE_UNIFDEF = -UMACH_KERNEL_PRIVATE -UBSD_KERNEL_PRIVATE -UIOKIT_KERNEL_PRIVATE -ULIBKERN_KERNEL_PRIVATE -ULIBSA_KERNEL_PRIVATE -UPEXPERT_KERNEL_PRIVATE -UXNU_KERNEL_PRIVATE | |
309 | ||
310 | SPINCFRAME_UNIFDEF = $(XNU_PRIVATE_UNIFDEF) -UKERNEL_PRIVATE -UKERNEL -DPRIVATE | |
311 | SINCFRAME_UNIFDEF = $(XNU_PRIVATE_UNIFDEF) -UKERNEL_PRIVATE -UKERNEL -UPRIVATE | |
312 | KPINCFRAME_UNIFDEF = $(XNU_PRIVATE_UNIFDEF) -DKERNEL_PRIVATE -DPRIVATE -DKERNEL | |
313 | KINCFRAME_UNIFDEF = $(XNU_PRIVATE_UNIFDEF) -UKERNEL_PRIVATE -UPRIVATE -DKERNEL | |
1c79356b A |
314 | |
315 | # | |
316 | # Compononent Header file destinations | |
317 | # | |
318 | EXPDIR = EXPORT_HDRS/$(COMPONENT) | |
319 | ||
320 | # | |
321 | # Strip Flags | |
322 | # | |
55e303ae A |
323 | export STRIP_FLAGS_RELEASE = -S -x |
324 | export STRIP_FLAGS_RELEASE_TRACE = -S -x | |
1c79356b | 325 | export STRIP_FLAGS_DEBUG = -S |
55e303ae A |
326 | export STRIP_FLAGS_DEBUG_TRACE = -S |
327 | export STRIP_FLAGS_PROFILE = -S -x | |
1c79356b A |
328 | |
329 | export STRIP_FLAGS = $($(addsuffix $(KERNEL_CONFIG),STRIP_FLAGS_)) | |
330 | ||
9bccf70c A |
331 | # |
332 | # Man Page destination | |
333 | # | |
334 | MANDIR = usr/share/man | |
335 | ||
1c79356b A |
336 | # |
337 | # This must be here before any rules are possibly defined by the | |
338 | # machine dependent makefile fragment so that a plain "make" command | |
339 | # always works. The config program will emit an appropriate rule to | |
340 | # cause "all" to depend on every kernel configuration it generates. | |
341 | # | |
342 | ||
343 | default: all | |
344 |