]> git.saurik.com Git - apple/xnu.git/blame - makedefs/MakeInc.def
xnu-792.6.76.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
0b4e3aa0
A
24export COMPONENT_LIST_UC := $(shell echo -n $(COMPONENT_LIST) | $(TR) a-z A-Z)
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
0b4e3aa0 42export ARCH_CONFIGS := $(shell echo -n $(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
49export ARCH_CONFIG_LC := $(shell echo -n $(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
57#
58ifndef KERNEL_CONFIGS
59export KERNEL_CONFIGS = RELEASE
60endif
0b4e3aa0 61ifndef KERNEL_CONFIG
1c79356b 62export KERNEL_CONFIG = $(firstword $(KERNEL_CONFIGS))
0b4e3aa0 63endif
1c79356b
A
64
65#
66# Kernel Configuration to install
67#
68# supported install architecture : PPC I386
69#
70export INSTALL_TYPE = RELEASE
0b4e3aa0 71ifndef INSTALL_ARCHS
1c79356b
A
72ifdef RC_ARCHS
73export INSTALL_ARCHS = $(ARCH_CONFIGS)
74else
75export INSTALL_ARCHS = $(ARCH_CONFIGS)
76endif
0b4e3aa0
A
77export INSTALL_ARCHS_LC := $(shell echo -n $(ARCH_CONFIGS) | $(TR) A-Z a-z)
78endif
1c79356b
A
79
80export INSTALL_ARCH_DEFAULT = PPC
81
82#
83# Standard defines list
84#
91447636 85export 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
90KCC = /usr/bin/cc
91KC++ = /usr/bin/c++
92CC = $(KCC)
93
91447636
A
94#
95# Compiler warning flags
96#
97
98CWARNFLAGS_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
104export CWARNFLAGS ?= $(CWARNFLAGS_STD)
105
106MWARNFLAGS_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 MWARNFLAGS ?= $(MWARNFLAGS_STD)
113
114CXXWARNFLAGS_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
120export CXXWARNFLAGS ?= $(CXXWARNFLAGS_STD)
121
9bccf70c
A
122
123#
124# Setup for parallel sub-makes when doing an RC build
125#
126ifndef MAKEJOBS
127ifeq "YES" "$(RC_XBS)"
128export MAKEJOBS = --jobs=3
129endif
130endif
1c79356b
A
131
132#
133# Default CFLAGS
134#
135ifdef RC_CFLAGS
136export OTHER_CFLAGS = $(subst $(addprefix -arch ,$(RC_ARCHS)),,$(RC_CFLAGS))
137endif
138
9bccf70c
A
139export 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
143export CFLAGS_RELEASE =
55e303ae
A
144export CFLAGS_DEBUG =
145export CFLAGS_PROFILE = -pg
1c79356b 146
55e303ae 147export CFLAGS_PPC = -arch ppc -Dppc -DPPC -D__PPC__ -DPAGE_SIZE_FIXED
91447636
A
148export 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
151export CFLAGS_RELEASEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
152export CFLAGS_RELEASE_TRACEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
55e303ae
A
153export CFLAGS_DEBUGPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
154export CFLAGS_PROFILEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
91447636
A
155export CFLAGS_RELEASEI386 = -Os
156export CFLAGS_DEBUGI386 = -Os
157export CFLAGS_PROFILEI386 = -Os
1c79356b
A
158
159export 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 167CXXFLAGS_GEN = -fno-rtti -fno-exceptions -fcheck-new -fapple-kext -fpermissive
1c79356b 168
55e303ae
A
169CXXFLAGS = $(CXXFLAGS_GEN) \
170 $($(addsuffix $(ARCH_CONFIG),CXXFLAGS_)) \
171 $($(addsuffix $(KERNEL_CONFIG),CXXFLAGS_))
1c79356b
A
172
173#
174# Assembler command
175#
176AS = /usr/bin/cc
177S_KCC = /usr/bin/cc
178
179#
180# Default SFLAGS
181#
182export SFLAGS_GEN = -static -D__ASSEMBLER__ -force_cpusubtype_ALL $(OTHER_CFLAGS)
183
184export SFLAGS_RELEASE =
185export SFLAGS_DEBUG =
186export SFLAGS_PROFILE =
187
188export SFLAGS_PPC = $(CFLAGS_PPC)
189export SFLAGS_I386 = $(CFLAGS_I386)
190
191export SFLAGS = $(SFLAGS_GEN) \
192 $($(addsuffix $(ARCH_CONFIG),SFLAGS_)) \
193 $($(addsuffix $(KERNEL_CONFIG),SFLAGS_)) \
194 $(DEFINES)
195
196#
197# Linker command
198#
199LD = /usr/bin/ld
200
201#
202# Default LDFLAGS
203#
55e303ae 204export LDFLAGS_COMPONENT_GEN = -static -r $(COMP_LDFLAGS_COMPONENT_GEN)
1c79356b 205
55e303ae
A
206export LDFLAGS_COMPONENT_RELEASE = $(COMP_LDFLAGS_COMPONENT_RELEASE)
207export LDFLAGS_COMPONENT_DEBUG = $(COMP_LDFLAGS_COMPONENT_DEBUG)
208export LDFLAGS_COMPONENT_PROFILE = $(COMP_LDFLAGS_COMPONENT_PROFILE)
1c79356b 209
55e303ae
A
210export LDFLAGS_COMPONENT_PPC = -arch ppc $(COMP_LDFLAGS_COMPONENT_PPC)
211export LDFLAGS_COMPONENT_I386 = -arch i386 $(COMP_LDFLAGS_COMPONENT_i386)
1c79356b
A
212
213export LDFLAGS_COMPONENT = $(LDFLAGS_COMPONENT_GEN) \
214 $($(addsuffix $(ARCH_CONFIG),LDFLAGS_COMPONENT_)) \
215 $($(addsuffix $(KERNEL_CONFIG),LDFLAGS_COMPONENT_))
216
91447636
A
217export 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
229export LDFLAGS_KERNEL_RELEASE =
230# -noseglinkedit
231export LDFLAGS_KERNEL_DEBUG =
232export LDFLAGS_KERNEL_PROFILE =
233
91447636
A
234export LDFLAGS_KERNEL_PPC = \
235 -arch ppc \
236 -segaddr __VECTORS 0x0 \
237 -segaddr __HIB 0x7000 \
238 -segaddr __TEXT 0xe000
239
240export LDFLAGS_KERNEL_I386 = \
241 -arch i386 \
242 -segaddr __HIB 0xC0100000 \
243 -segaddr __TEXT 0xC0111000
1c79356b
A
244
245export 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#
253export LD_KERNEL_LIBS = -lcc_kext
254
255#
256# Default INCFLAGS
257#
258export INCFLAGS_IMPORT = $(patsubst %, -I$(OBJROOT)/EXPORT_HDRS/%, $(COMPONENT_IMPORT_LIST))
259export INCFLAGS_EXTERN = -I$(OBJROOT)/EXTERN_HDRS -I$(SRCROOT)/EXTERNAL_HEADERS -I$(SRCROOT)/EXTERNAL_HEADERS/bsd
91447636 260export INCFLAGS_GEN = -I$(SRCROOT)/$(COMPONENT) -I$(OBJROOT)/EXPORT_HDRS/$(COMPONENT)
1c79356b
A
261export INCFLAGS_POSIX = -I$(OBJROOT)/EXPORT_HDRS/bsd
262export INCFLAGS_LOCAL = -I.
263
9bccf70c 264export INCFLAGS = $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE)
1c79356b
A
265
266#
267# Default MIGFLAGS
268#
269export MIGFLAGS = $(DEFINES) $(INCFLAGS) $($(addsuffix $(ARCH_CONFIG),CFLAGS_))
270
271#
272# Default VPATH
273#
274empty:=
275space:= $(empty) $(empty)
276export VPATH_IMPORT = $(subst $(space),:,$(patsubst %,$(OBJROOT)/EXPORT_HDRS/%,$(strip $(COMPONENT_IMPORT_LIST)))):
277export VPATH_EXTERN = $(OBJROOT)/EXTERN_HDRS:
278export VPATH_GEN = .:$(SOURCE):
279
280export 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#
287INSTALL_FLAGS = -c -m 0444
d7e50217
A
288FILE_INSTALL_FLAGS = -c -m 0644
289DATA_INSTALL_FLAGS = -c -m 0644
1c79356b
A
290
291#
292# Header file destinations
293#
294FRAMEDIR = System/Library/Frameworks
295ifndef INCDIR
296 INCDIR = /usr/include
297endif
298ifndef LCLDIR
299 LCLDIR = $(FRAMEDIR)/System.framework/Versions/B/PrivateHeaders
300endif
301
302KINCVERS = A
303KINCFRAME = $(FRAMEDIR)/Kernel.framework
304KINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Headers
0b4e3aa0 305KPINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/PrivateHeaders
91447636
A
306KRESDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Resources
307
308XNU_PRIVATE_UNIFDEF = -UMACH_KERNEL_PRIVATE -UBSD_KERNEL_PRIVATE -UIOKIT_KERNEL_PRIVATE -ULIBKERN_KERNEL_PRIVATE -ULIBSA_KERNEL_PRIVATE -UPEXPERT_KERNEL_PRIVATE -UXNU_KERNEL_PRIVATE
309
310SPINCFRAME_UNIFDEF = $(XNU_PRIVATE_UNIFDEF) -UKERNEL_PRIVATE -UKERNEL -DPRIVATE
311SINCFRAME_UNIFDEF = $(XNU_PRIVATE_UNIFDEF) -UKERNEL_PRIVATE -UKERNEL -UPRIVATE
312KPINCFRAME_UNIFDEF = $(XNU_PRIVATE_UNIFDEF) -DKERNEL_PRIVATE -DPRIVATE -DKERNEL
313KINCFRAME_UNIFDEF = $(XNU_PRIVATE_UNIFDEF) -UKERNEL_PRIVATE -UPRIVATE -DKERNEL
1c79356b
A
314
315#
316# Compononent Header file destinations
317#
318EXPDIR = EXPORT_HDRS/$(COMPONENT)
319
320#
321# Strip Flags
322#
55e303ae
A
323export STRIP_FLAGS_RELEASE = -S -x
324export STRIP_FLAGS_RELEASE_TRACE = -S -x
1c79356b 325export STRIP_FLAGS_DEBUG = -S
55e303ae
A
326export STRIP_FLAGS_DEBUG_TRACE = -S
327export STRIP_FLAGS_PROFILE = -S -x
1c79356b
A
328
329export STRIP_FLAGS = $($(addsuffix $(KERNEL_CONFIG),STRIP_FLAGS_))
330
9bccf70c
A
331#
332# Man Page destination
333#
334MANDIR = 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
343default: all
344