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