]> git.saurik.com Git - apple/xnu.git/blame - makedefs/MakeInc.def
xnu-344.49.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
19ifndef INCR_INSTALLHDRS
20ifeq ($(shell test -d $$DSTROOT/$INCDIR;echo $$?),0)
21export INCR_INSTALLHDRS = TRUE
22else
23export INCR_INSTALLHDRS = FALSE
24endif
25endif
26
27#
28# Component List
29#
0b4e3aa0 30ifndef COMPONENT_LIST
1c79356b 31export COMPONENT_LIST = osfmk bsd iokit pexpert libkern libsa
0b4e3aa0
A
32export COMPONENT_LIST_UC := $(shell echo -n $(COMPONENT_LIST) | $(TR) a-z A-Z)
33endif
34ifndef COMPONENT
35export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE))))
36export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST))
37else
38ifeq ($(COMPONENT), .)
39export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE))))
40export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST))
41endif
42endif
1c79356b
A
43
44# Architecture options
45#
46# supported configurations : PPC I386
47#
0b4e3aa0 48ifndef ARCH_CONFIGS
1c79356b 49ifdef RC_ARCHS
0b4e3aa0 50export ARCH_CONFIGS := $(shell echo -n $(RC_ARCHS) | $(TR) a-z A-Z)
1c79356b 51else
0b4e3aa0
A
52export ARCH_CONFIGS := $(shell arch | $(TR) a-z A-Z)
53endif
54endif
55ifdef ARCH_CONFIG
56ifndef ARCH_CONFIG_LC
57export ARCH_CONFIG_LC := $(shell echo -n $(ARCH_CONFIG) | $(TR) A-Z a-z)
1c79356b
A
58endif
59endif
1c79356b
A
60
61
62# Kernel Configuration options
63#
64# supported configurations : RELEASE DEBUG PROFILE
65#
66ifndef KERNEL_CONFIGS
67export KERNEL_CONFIGS = RELEASE
68endif
0b4e3aa0 69ifndef KERNEL_CONFIG
1c79356b 70export KERNEL_CONFIG = $(firstword $(KERNEL_CONFIGS))
0b4e3aa0 71endif
1c79356b
A
72
73#
74# Kernel Configuration to install
75#
76# supported install architecture : PPC I386
77#
78export INSTALL_TYPE = RELEASE
0b4e3aa0 79ifndef INSTALL_ARCHS
1c79356b
A
80ifdef RC_ARCHS
81export INSTALL_ARCHS = $(ARCH_CONFIGS)
82else
83export INSTALL_ARCHS = $(ARCH_CONFIGS)
84endif
0b4e3aa0
A
85export INSTALL_ARCHS_LC := $(shell echo -n $(ARCH_CONFIGS) | $(TR) A-Z a-z)
86endif
1c79356b
A
87
88export INSTALL_ARCH_DEFAULT = PPC
89
90#
91# Standard defines list
92#
93export DEFINES = -DAPPLE -DNeXT -DKERNEL_PRIVATE -D__MACHO__=1 -Dvolatile=__volatile $(IDENT)
94
95#
96# Compiler command
97#
9bccf70c
A
98KCC = /usr/bin/cc
99KC++ = /usr/bin/c++
100CC = $(KCC)
101
102
103#
104# Setup for parallel sub-makes when doing an RC build
105#
106ifndef MAKEJOBS
107ifeq "YES" "$(RC_XBS)"
108export MAKEJOBS = --jobs=3
109endif
110endif
1c79356b
A
111
112#
113# Default CFLAGS
114#
115ifdef RC_CFLAGS
116export OTHER_CFLAGS = $(subst $(addprefix -arch ,$(RC_ARCHS)),,$(RC_CFLAGS))
117endif
118
9bccf70c
A
119export CFLAGS_GEN = -static -g -nostdinc -nostdlib -no-cpp-precomp \
120 -fno-builtin -finline -fno-keep-inline-functions -msoft-float \
121 -fsigned-bitfields -Wpointer-arith $(OTHER_CFLAGS) -fpermissive
1c79356b
A
122
123export CFLAGS_RELEASE =
124export CFLAGS_DEBUG = -fno-omit-frame-pointer
125export CFLAGS_PROFILE =
126
127export CFLAGS_PPC = -arch ppc -Dppc -DPPC -D__PPC__ -D_BIG_ENDIAN=__BIG_ENDIAN__
128export CFLAGS_I386 = -arch i386 -Di386 -DI386 -D__I386__ -D_BIG_ENDIAN=__LITTLE_ENDIAN__
129
0b4e3aa0
A
130export CFLAGS_RELEASEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
131export CFLAGS_RELEASE_TRACEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
de355530 132export CFLAGS_DEBUGPPC = -O1 -mcpu=750 -mmultiple -fschedule-insns
1c79356b
A
133export CFLAGS_RELEASEI386 = -O2
134export CFLAGS_DEBUGI386 = -O2
135
136export CFLAGS = $(CFLAGS_GEN) \
137 $($(addsuffix $(ARCH_CONFIG),CFLAGS_)) \
138 $($(addsuffix $(KERNEL_CONFIG),CFLAGS_)) \
139 $($(addsuffix $(ARCH_CONFIG), $(addsuffix $(KERNEL_CONFIG),CFLAGS_))) \
140 $(DEFINES)
141
142# Default CCFLAGS
143#(we do not call it CPPFLAGS as that has a special meaning in unix tradition
144# and in gcc: CPPFLAGS is for C Pre-Processor flags. CCFLAGS has precedent
145# in ProjectBuilder because of the .cc extension)
146#
9bccf70c 147CPPFLAGS_GEN = -fno-rtti -fno-exceptions -fcheck-new -fapple-kext
1c79356b
A
148
149CPPFLAGS = $(CPPFLAGS_GEN) \
150 $($(addsuffix $(ARCH_CONFIG),CCFLAGS_)) \
151 $($(addsuffix $(KERNEL_CONFIG),CCFLAGS_))
152
153#
154# Assembler command
155#
156AS = /usr/bin/cc
157S_KCC = /usr/bin/cc
158
159#
160# Default SFLAGS
161#
162export SFLAGS_GEN = -static -D__ASSEMBLER__ -force_cpusubtype_ALL $(OTHER_CFLAGS)
163
164export SFLAGS_RELEASE =
165export SFLAGS_DEBUG =
166export SFLAGS_PROFILE =
167
168export SFLAGS_PPC = $(CFLAGS_PPC)
169export SFLAGS_I386 = $(CFLAGS_I386)
170
171export SFLAGS = $(SFLAGS_GEN) \
172 $($(addsuffix $(ARCH_CONFIG),SFLAGS_)) \
173 $($(addsuffix $(KERNEL_CONFIG),SFLAGS_)) \
174 $(DEFINES)
175
176#
177# Linker command
178#
179LD = /usr/bin/ld
180
181#
182# Default LDFLAGS
183#
184export LDFLAGS_COMPONENT_GEN = -static -r
185
186export LDFLAGS_COMPONENT_RELEASE =
187export LDFLAGS_COMPONENT_DEBUG =
188export LDFLAGS_COMPONENT_PROFILE =
189
190export LDFLAGS_COMPONENT_PPC = -arch ppc
191export LDFLAGS_COMPONENT_I386 = -arch i386
192
193export LDFLAGS_COMPONENT = $(LDFLAGS_COMPONENT_GEN) \
194 $($(addsuffix $(ARCH_CONFIG),LDFLAGS_COMPONENT_)) \
195 $($(addsuffix $(KERNEL_CONFIG),LDFLAGS_COMPONENT_))
196
197export LDFLAGS_KERNEL_GEN = -static -force_cpusubtype_ALL -segalign 0x1000
198
199export LDFLAGS_KERNEL_RELEASE =
200# -noseglinkedit
201export LDFLAGS_KERNEL_DEBUG =
202export LDFLAGS_KERNEL_PROFILE =
203
de355530 204export LDFLAGS_KERNEL_PPC = -arch ppc -segaddr __VECTORS 0x0 -segaddr __TEXT 0x11000 -e __start -sectalign __DATA __common 0x1000 -sectalign __DATA __bss 0x1000
0b4e3aa0 205export LDFLAGS_KERNEL_I386 = -arch i386 -segaddr __TEXT 0x100000 -e _pstart
1c79356b
A
206
207export LDFLAGS_KERNEL = $(LDFLAGS_KERNEL_GEN) \
208 $($(addsuffix $(ARCH_CONFIG),LDFLAGS_KERNEL_)) \
209 $($(addsuffix $(KERNEL_CONFIG),LDFLAGS_KERNEL_))
210
211
212#
213# Default runtime libraries to be linked with the kernel
214#
215export LD_KERNEL_LIBS = -lcc_kext
216
217#
218# Default INCFLAGS
219#
220export INCFLAGS_IMPORT = $(patsubst %, -I$(OBJROOT)/EXPORT_HDRS/%, $(COMPONENT_IMPORT_LIST))
221export INCFLAGS_EXTERN = -I$(OBJROOT)/EXTERN_HDRS -I$(SRCROOT)/EXTERNAL_HEADERS -I$(SRCROOT)/EXTERNAL_HEADERS/bsd
222export INCFLAGS_GEN = -I$(SRCROOT)/$(COMPONENT)
223export INCFLAGS_POSIX = -I$(OBJROOT)/EXPORT_HDRS/bsd
224export INCFLAGS_LOCAL = -I.
225
9bccf70c 226export INCFLAGS = $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE)
1c79356b
A
227
228#
229# Default MIGFLAGS
230#
231export MIGFLAGS = $(DEFINES) $(INCFLAGS) $($(addsuffix $(ARCH_CONFIG),CFLAGS_))
232
233#
234# Default VPATH
235#
236empty:=
237space:= $(empty) $(empty)
238export VPATH_IMPORT = $(subst $(space),:,$(patsubst %,$(OBJROOT)/EXPORT_HDRS/%,$(strip $(COMPONENT_IMPORT_LIST)))):
239export VPATH_EXTERN = $(OBJROOT)/EXTERN_HDRS:
240export VPATH_GEN = .:$(SOURCE):
241
242export VPATH = $(VPATH_GEN)$(VPATH_IMPORT)$(VPATH_EXTERN)$(VPATH_MAKEFILE)
243
244#
245# Macros that control installation of kernel and it's header files
246#
247# install flags for header files
248#
249INSTALL_FLAGS = -c -m 0444
d7e50217
A
250FILE_INSTALL_FLAGS = -c -m 0644
251DATA_INSTALL_FLAGS = -c -m 0644
1c79356b
A
252
253#
254# Header file destinations
255#
256FRAMEDIR = System/Library/Frameworks
257ifndef INCDIR
258 INCDIR = /usr/include
259endif
260ifndef LCLDIR
261 LCLDIR = $(FRAMEDIR)/System.framework/Versions/B/PrivateHeaders
262endif
263
264KINCVERS = A
265KINCFRAME = $(FRAMEDIR)/Kernel.framework
266KINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Headers
0b4e3aa0 267KPINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/PrivateHeaders
1c79356b
A
268
269#
270# Compononent Header file destinations
271#
272EXPDIR = EXPORT_HDRS/$(COMPONENT)
273
274#
275# Strip Flags
276#
277export STRIP_FLAGS_RELEASE = -S
278export STRIP_FLAGS_RELEASE_TRACE = -S
279export STRIP_FLAGS_DEBUG = -S
280export STRIP_FLAGS_PROFILE = -S
281
282export STRIP_FLAGS = $($(addsuffix $(KERNEL_CONFIG),STRIP_FLAGS_))
283
9bccf70c
A
284#
285# Man Page destination
286#
287MANDIR = usr/share/man
288
1c79356b
A
289#
290# This must be here before any rules are possibly defined by the
291# machine dependent makefile fragment so that a plain "make" command
292# always works. The config program will emit an appropriate rule to
293# cause "all" to depend on every kernel configuration it generates.
294#
295
296default: all
297