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