]>
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 | ||
b0d623f7 | 19 | |
1c79356b A |
20 | # |
21 | # Component List | |
22 | # | |
0b4e3aa0 | 23 | ifndef COMPONENT_LIST |
2d21ac55 | 24 | export COMPONENT_LIST = osfmk bsd libkern iokit pexpert libsa security |
0c530ab8 | 25 | export COMPONENT_LIST_UC := $(shell printf "%s" "$(COMPONENT_LIST)" | $(TR) a-z A-Z) |
0b4e3aa0 A |
26 | endif |
27 | ifndef COMPONENT | |
28 | export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE)))) | |
29 | export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST)) | |
30 | else | |
31 | ifeq ($(COMPONENT), .) | |
32 | export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE)))) | |
33 | export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST)) | |
34 | endif | |
35 | endif | |
1c79356b A |
36 | |
37 | # Architecture options | |
38 | # | |
2d21ac55 | 39 | ifndef SUPPORTED_ARCH_CONFIGS |
b0d623f7 | 40 | export SUPPORTED_ARCH_CONFIGS = PPC I386 X86_64 ARM |
2d21ac55 A |
41 | endif |
42 | ||
0b4e3aa0 | 43 | ifndef ARCH_CONFIGS |
1c79356b | 44 | ifdef RC_ARCHS |
0c530ab8 | 45 | export ARCH_CONFIGS := $(shell printf "%s" "$(RC_ARCHS)" | $(TR) a-z A-Z) |
1c79356b | 46 | else |
0b4e3aa0 A |
47 | export ARCH_CONFIGS := $(shell arch | $(TR) a-z A-Z) |
48 | endif | |
49 | endif | |
50 | ifdef ARCH_CONFIG | |
51 | ifndef ARCH_CONFIG_LC | |
0c530ab8 | 52 | export ARCH_CONFIG_LC := $(shell printf "%s" "$(ARCH_CONFIG)" | $(TR) A-Z a-z) |
1c79356b A |
53 | endif |
54 | endif | |
1c79356b | 55 | |
2d21ac55 | 56 | # |
1c79356b A |
57 | # Kernel Configuration options |
58 | # | |
2d21ac55 A |
59 | ifndef SUPPORTED_KERNEL_CONFIGS |
60 | export SUPPORTED_KERNEL_CONFIGS = RELEASE DEVELOPMENT DEBUG PROFILE | |
61 | endif | |
0c530ab8 | 62 | |
2d21ac55 | 63 | ifndef DEFAULT_KERNEL_CONFIG |
b0d623f7 A |
64 | ifeq ($(RC_ProjectName),xnu_debug) |
65 | export DEFAULT_KERNEL_CONFIG = DEBUG | |
66 | else | |
2d21ac55 | 67 | export DEFAULT_KERNEL_CONFIG = RELEASE |
1c79356b | 68 | endif |
b0d623f7 | 69 | endif |
2d21ac55 A |
70 | |
71 | # If KERNEL_CONFIGS is specified it should override KERNEL_CONFIG. | |
72 | # If KERNEL_CONFIG is specified it will override the default. Will quit with | |
73 | # error if more than one config is specified. | |
74 | # If DEFAULT_KERNEL_CONFIG is not specified then it will be built RELEASE. | |
75 | ifndef KERNEL_CONFIGS | |
76 | ifndef KERNEL_CONFIG | |
77 | export KERNEL_CONFIGS = $(DEFAULT_KERNEL_CONFIG) | |
78 | else | |
79 | export KERNEL_CONFIGS = $(KERNEL_CONFIG) | |
80 | endif | |
0c530ab8 A |
81 | endif |
82 | ||
0b4e3aa0 | 83 | ifndef KERNEL_CONFIG |
1c79356b | 84 | export KERNEL_CONFIG = $(firstword $(KERNEL_CONFIGS)) |
0b4e3aa0 | 85 | endif |
1c79356b | 86 | |
2d21ac55 A |
87 | ifneq ($(words $(KERNEL_CONFIG)), 1) |
88 | $(error There were $(words $(KERNEL_CONFIG)) parameters passed to KERNEL_CONFIG = $(KERNEL_CONFG). \ | |
89 | Are you sure? To specify multiple configurations please use KERNEL_CONFIGS) | |
90 | endif | |
91 | ||
2d21ac55 A |
92 | ifndef MACHINE_CONFIG |
93 | export MACHINE_CONFIG = DEFAULT | |
94 | endif | |
95 | ||
2d21ac55 A |
96 | |
97 | # | |
98 | # Target configuration options. NOTE - target configurations will | |
99 | # override ARCH_CONFIGS and KERNEL_CONFIGS. | |
100 | # | |
101 | # Target configs come in groups of three parameters. The first is the | |
102 | # kernel configuration, the second is the architecture configuration, | |
103 | # and the third is the machine configuration. You may pass in as | |
104 | # many groups of configurations as you wish. Each item passed in is | |
105 | # seperated by whitespace. | |
106 | # | |
107 | # Example: | |
108 | # TARGET_CONFIGS="release ppc default debug i386 default release arm MX31ADS" | |
109 | # Parameters may be in upper or lower case (they are converted to upper). | |
110 | # | |
111 | # "default" parameter is a special case. It means use the default value for | |
112 | # that parameter. Here are the default values for each configuration: | |
113 | # | |
114 | # default kernel configuration = DEFAULT_KERNEL_CONFIG | |
115 | # default architecture configuration = system architecture where you are running make. | |
116 | # default machine configuration for ppc = none at this time. | |
117 | # default machine configuration for i386 = none at this time. | |
b0d623f7 | 118 | # default machine configuration for x86_64 = none at this time. |
cf7d32b8 | 119 | # default machine configuration for arm = "S5L8900X". |
2d21ac55 A |
120 | # |
121 | ifndef TARGET_CONFIGS_UC | |
122 | ifdef TARGET_CONFIGS | |
b0d623f7 | 123 | export TARGET_CONFIGS_UC := $(strip $(shell printf "%s" "$(TARGET_CONFIGS)" | $(TR) a-z A-Z)) |
2d21ac55 A |
124 | export MACHINE_CONFIG = $(word 3, $(TARGET_CONFIGS_UC)) |
125 | export DEFAULT_KERNEL_CONFIG = $(word 1, $(TARGET_CONFIGS_UC)) | |
1c79356b | 126 | else |
2d21ac55 A |
127 | # generate TARGET_CONFIGS using KERNEL_CONFIGS and ARCH_CONFIGS and MACHINE_CONFIG (which defaults to "DEFAULT") |
128 | temp_list = $(foreach my_kern_config, $(KERNEL_CONFIGS), $(my_kern_config) arch_slot $(MACHINE_CONFIG)) | |
129 | export TARGET_CONFIGS = $(strip $(foreach my_arch_config, $(ARCH_CONFIGS), $(subst arch_slot,$(my_arch_config),$(temp_list)))) | |
130 | export TARGET_CONFIGS_UC := $(shell printf "%s" "$(TARGET_CONFIGS)" | $(TR) a-z A-Z) | |
131 | export MACHINE_CONFIG = $(word 3, $(TARGET_CONFIGS_UC)) | |
132 | export DEFAULT_KERNEL_CONFIG = $(word 1, $(TARGET_CONFIGS_UC)) | |
1c79356b | 133 | endif |
2d21ac55 A |
134 | endif |
135 | ||
136 | export MACHINE_CONFIG_LC := $(shell printf "%s" "$(MACHINE_CONFIG)" | $(TR) A-Z a-z) | |
137 | export KERNEL_CONFIG_LC := $(shell printf "%s" "$(KERNEL_CONFIG)" | $(TR) A-Z a-z) | |
138 | ||
139 | # | |
140 | # Kernel Configuration to install | |
141 | # | |
b0d623f7 | 142 | # supported install architecture : PPC I386 X86_64 ARM |
2d21ac55 A |
143 | # |
144 | export INSTALL_TYPE = $(DEFAULT_KERNEL_CONFIG) | |
145 | ||
146 | ifndef INSTALL_ARCHS | |
147 | export INSTALL_ARCHS = $(strip $(foreach my_config, $(SUPPORTED_ARCH_CONFIGS), $(findstring $(my_config), $(TARGET_CONFIGS_UC)))) | |
148 | export INSTALL_ARCHS_LC := $(shell printf "%s" "$(INSTALL_ARCHS)" | $(TR) A-Z a-z) | |
0b4e3aa0 | 149 | endif |
1c79356b | 150 | |
b0d623f7 | 151 | export INSTALL_ARCH_DEFAULT = $(firstword $(INSTALL_ARCHS)) |
1c79356b A |
152 | |
153 | # | |
154 | # Standard defines list | |
155 | # | |
2d21ac55 | 156 | export DEFINES = -DAPPLE -DKERNEL -DKERNEL_PRIVATE -DXNU_KERNEL_PRIVATE -DPRIVATE -D__MACHO__=1 -Dvolatile=__volatile $(IDENT) |
1c79356b A |
157 | |
158 | # | |
159 | # Compiler command | |
160 | # | |
0c530ab8 A |
161 | KCC := $(CC) |
162 | KC++ := $(CXX) | |
9bccf70c | 163 | |
91447636 A |
164 | # |
165 | # Compiler warning flags | |
166 | # | |
167 | ||
168 | CWARNFLAGS_STD = \ | |
169 | -Wall -Wno-format-y2k -W -Wstrict-prototypes -Wmissing-prototypes \ | |
170 | -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch \ | |
b0d623f7 | 171 | -Wshadow -Wcast-align -Wchar-subscripts -Winline \ |
91447636 A |
172 | -Wnested-externs -Wredundant-decls |
173 | ||
174 | export CWARNFLAGS ?= $(CWARNFLAGS_STD) | |
175 | ||
91447636 | 176 | CXXWARNFLAGS_STD = \ |
0c530ab8 | 177 | -Wall -Wno-format-y2k -W \ |
91447636 | 178 | -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch \ |
b0d623f7 | 179 | -Wcast-align -Wchar-subscripts -Wredundant-decls |
91447636 A |
180 | |
181 | export CXXWARNFLAGS ?= $(CXXWARNFLAGS_STD) | |
182 | ||
9bccf70c A |
183 | |
184 | # | |
2d21ac55 | 185 | # Setup for parallel sub-makes based on 2 times number of logical CPUs |
9bccf70c A |
186 | # |
187 | ifndef MAKEJOBS | |
2d21ac55 | 188 | export MAKEJOBS = --jobs=$(shell expr `/usr/sbin//sysctl -n hw.logicalcpu` \* 2) |
9bccf70c | 189 | endif |
1c79356b | 190 | |
2d21ac55 A |
191 | # |
192 | # Default ARCH_FLAGS, for use with compiler/linker/assembler/mig drivers | |
193 | ||
194 | ARCH_FLAGS_PPC = -arch ppc | |
195 | ARCH_FLAGS_I386 = -arch i386 | |
b0d623f7 | 196 | ARCH_FLAGS_X86_64 = -arch x86_64 |
2d21ac55 A |
197 | ARCH_FLAGS_ARM = $($(addsuffix $(MACHINE_CONFIG),ARCH_FLAGS_ARM_)) |
198 | ||
c910b4d9 A |
199 | ARCH_FLAGS_ALL_PPC = $(ARCH_FLAGS_PPC) |
200 | ARCH_FLAGS_ALL_I386 = $(ARCH_FLAGS_I386) | |
b0d623f7 | 201 | ARCH_FLAGS_ALL_X86_64 = $(ARCH_FLAGS_X86_64) |
c910b4d9 A |
202 | ARCH_FLAGS_ALL_ARM = -arch arm |
203 | ||
2d21ac55 | 204 | |
1c79356b A |
205 | # |
206 | # Default CFLAGS | |
207 | # | |
208 | ifdef RC_CFLAGS | |
209 | export OTHER_CFLAGS = $(subst $(addprefix -arch ,$(RC_ARCHS)),,$(RC_CFLAGS)) | |
210 | endif | |
211 | ||
2d21ac55 A |
212 | export DSYMBUILDDIR = ./Contents/Resources/DWARF/ |
213 | ||
214 | # | |
215 | # We must not use -fno-keep-inline-functions, or it will remove the dtrace | |
216 | # probes from the kernel. | |
217 | # | |
cf7d32b8 | 218 | export CFLAGS_GEN = -static $(DEBUG_CFLAGS) -nostdinc -nostdlib \ |
b0d623f7 A |
219 | -fno-builtin -finline -fno-common -msoft-float \ |
220 | -fsigned-bitfields -fno-stack-protector $(OTHER_CFLAGS) | |
1c79356b | 221 | |
c910b4d9 A |
222 | ifeq ($(BUILD_STABS),1) |
223 | export CFLAGS_GEN += -gstabs+ | |
224 | export BUILD_DWARF = 0 | |
225 | export BUILD_STABS = 1 | |
226 | else | |
227 | export CFLAGS_GEN += -gdwarf-2 | |
228 | export BUILD_DWARF = 1 | |
229 | export BUILD_STABS = 0 | |
230 | endif | |
231 | ||
1c79356b | 232 | export CFLAGS_RELEASE = |
2d21ac55 | 233 | export CFLAGS_DEVELOPMENT = |
55e303ae A |
234 | export CFLAGS_DEBUG = |
235 | export CFLAGS_PROFILE = -pg | |
1c79356b | 236 | |
2d21ac55 | 237 | export CFLAGS_PPC = -Dppc -DPPC -D__PPC__ -DPAGE_SIZE_FIXED \ |
c910b4d9 | 238 | -mno-altivec -force_cpusubtype_ALL |
2d21ac55 | 239 | export CFLAGS_I386 = -Di386 -DI386 -D__I386__ \ |
c910b4d9 | 240 | -DPAGE_SIZE_FIXED -force_cpusubtype_ALL |
b0d623f7 A |
241 | export CFLAGS_X86_64 = -Dx86_64 -DX86_64 -D__X86_64__ -DLP64 \ |
242 | -DPAGE_SIZE_FIXED -mkernel | |
2d21ac55 | 243 | export CFLAGS_ARM = -Darm -DARM -D__ARM__ -DPAGE_SIZE_FIXED \ |
c910b4d9 A |
244 | -fno-strict-aliasing -fno-keep-inline-functions |
245 | ||
246 | ifeq (-arch armv7,$(ARCH_FLAGS_ARM)) | |
247 | CFLAGS_ARM += -mthumb | |
2d21ac55 A |
248 | endif |
249 | ifeq (-arch armv6,$(ARCH_FLAGS_ARM)) | |
250 | CFLAGS_ARM += -mthumb | |
251 | endif | |
4a3eedf9 | 252 | ifeq (-arch armv5,$(ARCH_FLAGS_ARM)) |
b7266188 | 253 | CFLAGS_ARM += -mno-thumb |
4a3eedf9 A |
254 | endif |
255 | ifeq (-arch xscale,$(ARCH_FLAGS_ARM)) | |
256 | CFLAGS_ARM += -mthumb | |
257 | endif | |
2d21ac55 A |
258 | |
259 | export CFLAGS_RELEASEPPC = -O2 -mcpu=750 -mmultiple | |
2d21ac55 A |
260 | export CFLAGS_DEVELOPMENTPPC = -O2 -mcpu=750 -mmultiple |
261 | export CFLAGS_DEBUGPPC = -O2 -mcpu=750 -mmultiple | |
262 | export CFLAGS_PROFILEPPC = -O2 -mcpu=750 -mmultiple | |
1c79356b | 263 | |
91447636 | 264 | export CFLAGS_RELEASEI386 = -Os |
2d21ac55 | 265 | export CFLAGS_DEVELOPMENTI386 = -Os |
91447636 A |
266 | export CFLAGS_DEBUGI386 = -Os |
267 | export CFLAGS_PROFILEI386 = -Os | |
1c79356b | 268 | |
b0d623f7 A |
269 | export CFLAGS_RELEASEX86_64 = -Os |
270 | export CFLAGS_DEVELOPMENTX86_64 = -Os | |
271 | # No space optimization for the DEBUG kernel for the benefit of gdb: | |
272 | export CFLAGS_DEBUGX86_64 = -O0 | |
273 | export CFLAGS_PROFILEX86_64 = -Os | |
274 | ||
2d21ac55 A |
275 | export CFLAGS_RELEASEARM = -O2 |
276 | export CFLAGS_DEVELOPMENTARM = -O2 | |
277 | export CFLAGS_DEBUGARM = -O2 | |
278 | export CFLAGS_PROFILEARM = -O2 | |
279 | ||
1c79356b | 280 | export CFLAGS = $(CFLAGS_GEN) \ |
2d21ac55 A |
281 | $($(addsuffix $(MACHINE_CONFIG),MACHINE_FLAGS_)) \ |
282 | $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_)) \ | |
1c79356b A |
283 | $($(addsuffix $(ARCH_CONFIG),CFLAGS_)) \ |
284 | $($(addsuffix $(KERNEL_CONFIG),CFLAGS_)) \ | |
285 | $($(addsuffix $(ARCH_CONFIG), $(addsuffix $(KERNEL_CONFIG),CFLAGS_))) \ | |
286 | $(DEFINES) | |
287 | ||
55e303ae | 288 | # Default C++ flags |
1c79356b | 289 | # |
0c530ab8 | 290 | CXXFLAGS_GEN = -fno-rtti -fno-exceptions -fcheck-new -fapple-kext |
1c79356b | 291 | |
55e303ae A |
292 | CXXFLAGS = $(CXXFLAGS_GEN) \ |
293 | $($(addsuffix $(ARCH_CONFIG),CXXFLAGS_)) \ | |
294 | $($(addsuffix $(KERNEL_CONFIG),CXXFLAGS_)) | |
1c79356b A |
295 | |
296 | # | |
297 | # Assembler command | |
298 | # | |
0c530ab8 A |
299 | AS = $(CC) |
300 | S_KCC = $(CC) | |
1c79356b A |
301 | |
302 | # | |
303 | # Default SFLAGS | |
304 | # | |
2d21ac55 | 305 | export SFLAGS_GEN = -static -D__ASSEMBLER__ $(OTHER_CFLAGS) |
1c79356b A |
306 | |
307 | export SFLAGS_RELEASE = | |
2d21ac55 | 308 | export SFLAGS_DEVELOPMENT = |
1c79356b A |
309 | export SFLAGS_DEBUG = |
310 | export SFLAGS_PROFILE = | |
311 | ||
2d21ac55 A |
312 | export SFLAGS_PPC = $(CFLAGS_PPC) -force_cpusubtype_ALL |
313 | export SFLAGS_I386 = $(CFLAGS_I386) | |
314 | export SFLAGS_ARM = $(CFLAGS_ARM) | |
b0d623f7 | 315 | export SFLAGS_X86_64 = $(CFLAGS_X86_64) |
1c79356b A |
316 | |
317 | export SFLAGS = $(SFLAGS_GEN) \ | |
2d21ac55 A |
318 | $($(addsuffix $(MACHINE_CONFIG),MACHINE_FLAGS_)) \ |
319 | $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_)) \ | |
1c79356b A |
320 | $($(addsuffix $(ARCH_CONFIG),SFLAGS_)) \ |
321 | $($(addsuffix $(KERNEL_CONFIG),SFLAGS_)) \ | |
322 | $(DEFINES) | |
323 | ||
324 | # | |
325 | # Linker command | |
326 | # | |
0c530ab8 | 327 | LD = $(KC++) -nostdlib |
1c79356b A |
328 | |
329 | # | |
330 | # Default LDFLAGS | |
331 | # | |
1c79356b | 332 | |
91447636 A |
333 | export LDFLAGS_KERNEL_GEN = \ |
334 | -static \ | |
0c530ab8 | 335 | -fapple-kext \ |
0c530ab8 | 336 | -Wl,-e,__start \ |
0c530ab8 A |
337 | -Wl,-sectalign,__TEXT,__text,0x1000 \ |
338 | -Wl,-sectalign,__DATA,__common,0x1000 \ | |
339 | -Wl,-sectalign,__DATA,__bss,0x1000 \ | |
b0d623f7 A |
340 | -Wl,-sectcreate,__PRELINK_TEXT,__text,/dev/null \ |
341 | -Wl,-sectcreate,__PRELINK_STATE,__kernel,/dev/null \ | |
342 | -Wl,-sectcreate,__PRELINK_STATE,__kexts,/dev/null \ | |
343 | -Wl,-sectcreate,__PRELINK_INFO,__info,/dev/null | |
344 | ||
345 | # Availability of DWARF allows DTrace CTF (compressed type format) to be constructed | |
346 | ifeq ($(BUILD_DWARF),1) | |
347 | export LDFLAGS_KERNEL_GEN += \ | |
348 | -Wl,-sectcreate,__CTF,__ctf,/dev/null | |
349 | endif | |
1c79356b A |
350 | |
351 | export LDFLAGS_KERNEL_RELEASE = | |
2d21ac55 | 352 | export LDFLAGS_KERNEL_DEVELOPMENT = |
1c79356b A |
353 | export LDFLAGS_KERNEL_DEBUG = |
354 | export LDFLAGS_KERNEL_PROFILE = | |
355 | ||
91447636 | 356 | export LDFLAGS_KERNEL_PPC = \ |
2d21ac55 A |
357 | -force_cpusubtype_ALL \ |
358 | -Wl,-new_linker \ | |
b0d623f7 | 359 | -Wl,-pagezero_size,0x0 \ |
0c530ab8 A |
360 | -Wl,-segaddr,__VECTORS,0x0 \ |
361 | -Wl,-segaddr,__HIB,0x7000 \ | |
362 | -Wl,-segaddr,__TEXT,0xe000 | |
91447636 | 363 | |
b0d623f7 A |
364 | export LDFLAGS_KERNEL_RELEASEI386 = \ |
365 | -Wl,-new_linker \ | |
366 | -Wl,-pagezero_size,0x0 \ | |
367 | -Wl,-segaddr,__INITPT,0x00100000 \ | |
368 | -Wl,-segaddr,__INITGDT,0x00106000 \ | |
369 | -Wl,-segaddr,__SLEEP,0x00107000 \ | |
370 | -Wl,-segaddr,__HIB,0x00108000 \ | |
371 | -Wl,-image_base,0x200000 \ | |
372 | -Wl,-seg_page_size,__TEXT,0x200000 | |
373 | ||
374 | export LDFLAGS_KERNEL_DEBUGI386 = $(LDFLAGS_KERNEL_RELEASEI386) | |
375 | export LDFLAGS_KERNEL_DEVELOPMENTI386 = $(LDFLAGS_KERNEL_RELEASEI386) | |
376 | export LDFLAGS_KERNEL_PROFILEI386 = $(LDFLAGS_KERNEL_RELEASEI386) | |
377 | ||
378 | # Keep these constants in sync with the *_SEG_BASE definitions in i386/pmap.h | |
379 | export LDFLAGS_KERNEL_RELEASEX86_64 = \ | |
2d21ac55 | 380 | -Wl,-new_linker \ |
b0d623f7 A |
381 | -Wl,-pagezero_size,0x0 \ |
382 | -Wl,-segaddr,__INITPT,0xffffff8000100000 \ | |
383 | -Wl,-segaddr,__INITGDT,0xffffff8000106000 \ | |
384 | -Wl,-segaddr,__SLEEP,0xffffff8000107000 \ | |
385 | -Wl,-segaddr,__HIB,0xffffff8000108000 \ | |
386 | -Wl,-image_base,0xffffff8000200000 \ | |
387 | -Wl,-seg_page_size,__TEXT,0x200000 | |
388 | ||
389 | export LDFLAGS_KERNEL_DEBUGX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64) | |
390 | export LDFLAGS_KERNEL_DEVELOPMENTX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64) | |
391 | export LDFLAGS_KERNEL_PROFILEX86_64 = $(LDFLAGS_KERNEL_RELEASEX86_64) | |
2d21ac55 | 392 | |
d1ecb069 | 393 | export LDFLAGS_KERNEL_RELEASEARM = \ |
c910b4d9 | 394 | -Wl,-new_linker \ |
b0d623f7 | 395 | -Wl,-pagezero_size,0x0 \ |
d1ecb069 | 396 | -Wl,-image_base,0xC0001000 \ |
b7266188 | 397 | -Wl,-exported_symbols_list,$(TARGET)/kernel-kpi.exp |
b0d623f7 | 398 | |
d1ecb069 A |
399 | export LDFLAGS_KERNEL_DEVELOPMENTARM = \ |
400 | -Wl,-new_linker \ | |
401 | -Wl,-pagezero_size,0x0 \ | |
402 | -Wl,-image_base,0xC0001000 | |
403 | ||
404 | export LDFLAGS_KERNEL_DEBUGARM = $(LDFLAGS_KERNEL_DEVELOPMENTARM) | |
405 | ||
1c79356b A |
406 | |
407 | export LDFLAGS_KERNEL = $(LDFLAGS_KERNEL_GEN) \ | |
2d21ac55 A |
408 | $($(addsuffix $(MACHINE_CONFIG),MACHINE_FLAGS_)) \ |
409 | $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_)) \ | |
1c79356b | 410 | $($(addsuffix $(ARCH_CONFIG),LDFLAGS_KERNEL_)) \ |
b0d623f7 A |
411 | $($(addsuffix $(KERNEL_CONFIG),LDFLAGS_KERNEL_)) \ |
412 | $($(addsuffix $(ARCH_CONFIG), $(addsuffix $(KERNEL_CONFIG),LDFLAGS_KERNEL_))) \ | |
1c79356b A |
413 | |
414 | ||
415 | # | |
416 | # Default runtime libraries to be linked with the kernel | |
417 | # | |
418 | export LD_KERNEL_LIBS = -lcc_kext | |
419 | ||
b0d623f7 A |
420 | # |
421 | # Command to generate host binaries. Intentionally not | |
422 | # $(CC), which controls the target compiler | |
423 | # | |
424 | HOST_CC = cc | |
425 | ||
1c79356b A |
426 | # |
427 | # Default INCFLAGS | |
428 | # | |
429 | export INCFLAGS_IMPORT = $(patsubst %, -I$(OBJROOT)/EXPORT_HDRS/%, $(COMPONENT_IMPORT_LIST)) | |
430 | export INCFLAGS_EXTERN = -I$(OBJROOT)/EXTERN_HDRS -I$(SRCROOT)/EXTERNAL_HEADERS -I$(SRCROOT)/EXTERNAL_HEADERS/bsd | |
91447636 | 431 | export INCFLAGS_GEN = -I$(SRCROOT)/$(COMPONENT) -I$(OBJROOT)/EXPORT_HDRS/$(COMPONENT) |
1c79356b A |
432 | export INCFLAGS_POSIX = -I$(OBJROOT)/EXPORT_HDRS/bsd |
433 | export INCFLAGS_LOCAL = -I. | |
434 | ||
9bccf70c | 435 | export INCFLAGS = $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE) |
1c79356b A |
436 | |
437 | # | |
438 | # Default MIGFLAGS | |
439 | # | |
2d21ac55 | 440 | export MIGFLAGS = $(DEFINES) $(INCFLAGS) $($(addsuffix $(ARCH_CONFIG),CFLAGS_)) $($(addsuffix $(ARCH_CONFIG),ARCH_FLAGS_)) |
1c79356b A |
441 | |
442 | # | |
443 | # Default VPATH | |
444 | # | |
445 | empty:= | |
446 | space:= $(empty) $(empty) | |
447 | export VPATH_IMPORT = $(subst $(space),:,$(patsubst %,$(OBJROOT)/EXPORT_HDRS/%,$(strip $(COMPONENT_IMPORT_LIST)))): | |
448 | export VPATH_EXTERN = $(OBJROOT)/EXTERN_HDRS: | |
449 | export VPATH_GEN = .:$(SOURCE): | |
450 | ||
451 | export VPATH = $(VPATH_GEN)$(VPATH_IMPORT)$(VPATH_EXTERN)$(VPATH_MAKEFILE) | |
452 | ||
453 | # | |
2d21ac55 | 454 | # Macros that control installation of kernel and its header files |
1c79356b A |
455 | # |
456 | # install flags for header files | |
457 | # | |
458 | INSTALL_FLAGS = -c -m 0444 | |
d7e50217 A |
459 | FILE_INSTALL_FLAGS = -c -m 0644 |
460 | DATA_INSTALL_FLAGS = -c -m 0644 | |
1c79356b A |
461 | |
462 | # | |
463 | # Header file destinations | |
464 | # | |
465 | FRAMEDIR = System/Library/Frameworks | |
466 | ifndef INCDIR | |
467 | INCDIR = /usr/include | |
468 | endif | |
469 | ifndef LCLDIR | |
470 | LCLDIR = $(FRAMEDIR)/System.framework/Versions/B/PrivateHeaders | |
471 | endif | |
472 | ||
473 | KINCVERS = A | |
474 | KINCFRAME = $(FRAMEDIR)/Kernel.framework | |
475 | KINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Headers | |
0b4e3aa0 | 476 | KPINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/PrivateHeaders |
91447636 A |
477 | KRESDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Resources |
478 | ||
479 | XNU_PRIVATE_UNIFDEF = -UMACH_KERNEL_PRIVATE -UBSD_KERNEL_PRIVATE -UIOKIT_KERNEL_PRIVATE -ULIBKERN_KERNEL_PRIVATE -ULIBSA_KERNEL_PRIVATE -UPEXPERT_KERNEL_PRIVATE -UXNU_KERNEL_PRIVATE | |
480 | ||
2d21ac55 A |
481 | SPINCFRAME_UNIFDEF = $(XNU_PRIVATE_UNIFDEF) -UKERNEL_PRIVATE -UKERNEL -DPRIVATE -U_OPEN_SOURCE_ |
482 | SINCFRAME_UNIFDEF = $(XNU_PRIVATE_UNIFDEF) -UKERNEL_PRIVATE -UKERNEL -UPRIVATE -D_OPEN_SOURCE_ | |
483 | KPINCFRAME_UNIFDEF = $(XNU_PRIVATE_UNIFDEF) -DKERNEL_PRIVATE -DPRIVATE -DKERNEL -U_OPEN_SOURCE_ | |
484 | KINCFRAME_UNIFDEF = $(XNU_PRIVATE_UNIFDEF) -UKERNEL_PRIVATE -UPRIVATE -DKERNEL -D_OPEN_SOURCE_ | |
1c79356b | 485 | |
b0d623f7 | 486 | |
1c79356b A |
487 | # |
488 | # Compononent Header file destinations | |
489 | # | |
490 | EXPDIR = EXPORT_HDRS/$(COMPONENT) | |
491 | ||
492 | # | |
493 | # Strip Flags | |
494 | # | |
55e303ae | 495 | export STRIP_FLAGS_RELEASE = -S -x |
2d21ac55 | 496 | export STRIP_FLAGS_DEVELOPMENT = -S -x |
1c79356b | 497 | export STRIP_FLAGS_DEBUG = -S |
55e303ae | 498 | export STRIP_FLAGS_PROFILE = -S -x |
1c79356b A |
499 | |
500 | export STRIP_FLAGS = $($(addsuffix $(KERNEL_CONFIG),STRIP_FLAGS_)) | |
501 | ||
2d21ac55 A |
502 | # |
503 | # dsymutil flags | |
504 | # | |
505 | export DSYMUTIL_FLAGS_I386 = --arch=i386 | |
b0d623f7 | 506 | export DSYMUTIL_FLAGS_X86_64 = --arch=x86_64 |
2d21ac55 A |
507 | export DSYMUTIL_FLAGS_PPC = --arch=ppc |
508 | export DSYMUTIL_FLAGS_ARM = --arch=arm | |
509 | ||
510 | export DSYMUTIL_FLAGS = $($(addsuffix $(ARCH_CONFIG),DSYMUTIL_FLAGS_)) | |
511 | ||
9bccf70c A |
512 | # |
513 | # Man Page destination | |
514 | # | |
515 | MANDIR = usr/share/man | |
516 | ||
b0d623f7 A |
517 | # |
518 | # DEBUG alias location | |
519 | # | |
520 | DEVELOPER_EXTRAS_DIR = AppleInternal/Developer/Extras | |
2d21ac55 | 521 | |
1c79356b A |
522 | # |
523 | # This must be here before any rules are possibly defined by the | |
524 | # machine dependent makefile fragment so that a plain "make" command | |
525 | # always works. The config program will emit an appropriate rule to | |
526 | # cause "all" to depend on every kernel configuration it generates. | |
527 | # | |
528 | ||
529 | default: all | |
530 | ||
2d21ac55 | 531 | # vim: set ft=make: |