]> git.saurik.com Git - apple/xnu.git/blame - makedefs/MakeInc.def
xnu-517.7.21.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 \
55e303ae 121 -fsigned-bitfields -Wpointer-arith $(OTHER_CFLAGS)
1c79356b
A
122
123export CFLAGS_RELEASE =
55e303ae
A
124export CFLAGS_DEBUG =
125export CFLAGS_PROFILE = -pg
1c79356b 126
55e303ae
A
127export CFLAGS_PPC = -arch ppc -Dppc -DPPC -D__PPC__ -DPAGE_SIZE_FIXED
128export CFLAGS_I386 = -arch i386 -Di386 -DI386 -D__I386__ \
129 -march=i686 -mpreferred-stack-boundary=2 -falign-functions=4 -mcpu=pentium4
1c79356b 130
0b4e3aa0
A
131export CFLAGS_RELEASEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
132export CFLAGS_RELEASE_TRACEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
55e303ae
A
133export CFLAGS_DEBUGPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
134export CFLAGS_PROFILEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
1c79356b
A
135export CFLAGS_RELEASEI386 = -O2
136export CFLAGS_DEBUGI386 = -O2
55e303ae 137export CFLAGS_PROFILEI386 = -O2
1c79356b
A
138
139export CFLAGS = $(CFLAGS_GEN) \
140 $($(addsuffix $(ARCH_CONFIG),CFLAGS_)) \
141 $($(addsuffix $(KERNEL_CONFIG),CFLAGS_)) \
142 $($(addsuffix $(ARCH_CONFIG), $(addsuffix $(KERNEL_CONFIG),CFLAGS_))) \
143 $(DEFINES)
144
55e303ae 145# Default C++ flags
1c79356b 146#
55e303ae 147CXXFLAGS_GEN = -fno-rtti -fno-exceptions -fcheck-new -fapple-kext -fpermissive
1c79356b 148
55e303ae
A
149CXXFLAGS = $(CXXFLAGS_GEN) \
150 $($(addsuffix $(ARCH_CONFIG),CXXFLAGS_)) \
151 $($(addsuffix $(KERNEL_CONFIG),CXXFLAGS_))
1c79356b
A
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#
55e303ae 184export LDFLAGS_COMPONENT_GEN = -static -r $(COMP_LDFLAGS_COMPONENT_GEN)
1c79356b 185
55e303ae
A
186export LDFLAGS_COMPONENT_RELEASE = $(COMP_LDFLAGS_COMPONENT_RELEASE)
187export LDFLAGS_COMPONENT_DEBUG = $(COMP_LDFLAGS_COMPONENT_DEBUG)
188export LDFLAGS_COMPONENT_PROFILE = $(COMP_LDFLAGS_COMPONENT_PROFILE)
1c79356b 189
55e303ae
A
190export LDFLAGS_COMPONENT_PPC = -arch ppc $(COMP_LDFLAGS_COMPONENT_PPC)
191export LDFLAGS_COMPONENT_I386 = -arch i386 $(COMP_LDFLAGS_COMPONENT_i386)
1c79356b
A
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
55e303ae
A
204export LDFLAGS_KERNEL_PPC = -arch ppc -segaddr __VECTORS 0x0 -segaddr __TEXT 0x7000 -e __start -sectalign __TEXT __text 0x1000 -sectalign __DATA __common 0x1000 -sectalign __DATA __bss 0x1000 -sectcreate __PRELINK __text /dev/null -sectcreate __PRELINK __symtab /dev/null -sectcreate __PRELINK __info /dev/null
205export LDFLAGS_KERNEL_I386 = -arch i386 -segaddr __TEXT 0x100000 -e _pstart -sectcreate __PRELINK __text /dev/null -sectcreate __PRELINK __symtab /dev/null -sectcreate __PRELINK __info /dev/null
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#
55e303ae
A
277export STRIP_FLAGS_RELEASE = -S -x
278export STRIP_FLAGS_RELEASE_TRACE = -S -x
1c79356b 279export STRIP_FLAGS_DEBUG = -S
55e303ae
A
280export STRIP_FLAGS_DEBUG_TRACE = -S
281export STRIP_FLAGS_PROFILE = -S -x
1c79356b
A
282
283export STRIP_FLAGS = $($(addsuffix $(KERNEL_CONFIG),STRIP_FLAGS_))
284
9bccf70c
A
285#
286# Man Page destination
287#
288MANDIR = usr/share/man
289
1c79356b
A
290#
291# This must be here before any rules are possibly defined by the
292# machine dependent makefile fragment so that a plain "make" command
293# always works. The config program will emit an appropriate rule to
294# cause "all" to depend on every kernel configuration it generates.
295#
296
297default: all
298