]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | export SOURCE=$(shell /bin/pwd) |
2 | ||
3 | # | |
4 | # gnumake 3.77 support | |
5 | # | |
6 | export USE_APPLE_PB_SUPPORT = all | |
7 | ||
8 | # | |
9 | # Incremental Build option | |
10 | # | |
11 | ifndef INCR_EXPORTHDRS | |
12 | ifeq ($(shell test -d $$OBJROOT/EXPORT_HDRS;echo $$?),0) | |
13 | export INCR_EXPORTHDRS = TRUE | |
14 | else | |
15 | export INCR_EXPORTHDRS = FALSE | |
16 | endif | |
17 | endif | |
18 | ||
19 | ifndef INCR_INSTALLHDRS | |
20 | ifeq ($(shell test -d $$DSTROOT/$INCDIR;echo $$?),0) | |
21 | export INCR_INSTALLHDRS = TRUE | |
22 | else | |
23 | export INCR_INSTALLHDRS = FALSE | |
24 | endif | |
25 | endif | |
26 | ||
27 | # | |
28 | # Component List | |
29 | # | |
0b4e3aa0 | 30 | ifndef COMPONENT_LIST |
1c79356b | 31 | export COMPONENT_LIST = osfmk bsd iokit pexpert libkern libsa |
0b4e3aa0 A |
32 | export COMPONENT_LIST_UC := $(shell echo -n $(COMPONENT_LIST) | $(TR) a-z A-Z) |
33 | endif | |
34 | ifndef COMPONENT | |
35 | export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE)))) | |
36 | export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST)) | |
37 | else | |
38 | ifeq ($(COMPONENT), .) | |
39 | export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE)))) | |
40 | export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST)) | |
41 | endif | |
42 | endif | |
1c79356b A |
43 | |
44 | # Architecture options | |
45 | # | |
46 | # supported configurations : PPC I386 | |
47 | # | |
0b4e3aa0 | 48 | ifndef ARCH_CONFIGS |
1c79356b | 49 | ifdef RC_ARCHS |
0b4e3aa0 | 50 | export ARCH_CONFIGS := $(shell echo -n $(RC_ARCHS) | $(TR) a-z A-Z) |
1c79356b | 51 | else |
0b4e3aa0 A |
52 | export ARCH_CONFIGS := $(shell arch | $(TR) a-z A-Z) |
53 | endif | |
54 | endif | |
55 | ifdef ARCH_CONFIG | |
56 | ifndef ARCH_CONFIG_LC | |
57 | export ARCH_CONFIG_LC := $(shell echo -n $(ARCH_CONFIG) | $(TR) A-Z a-z) | |
1c79356b A |
58 | endif |
59 | endif | |
1c79356b A |
60 | |
61 | ||
62 | # Kernel Configuration options | |
63 | # | |
64 | # supported configurations : RELEASE DEBUG PROFILE | |
65 | # | |
66 | ifndef KERNEL_CONFIGS | |
67 | export KERNEL_CONFIGS = RELEASE | |
68 | endif | |
0b4e3aa0 | 69 | ifndef KERNEL_CONFIG |
1c79356b | 70 | export KERNEL_CONFIG = $(firstword $(KERNEL_CONFIGS)) |
0b4e3aa0 | 71 | endif |
1c79356b A |
72 | |
73 | # | |
74 | # Kernel Configuration to install | |
75 | # | |
76 | # supported install architecture : PPC I386 | |
77 | # | |
78 | export INSTALL_TYPE = RELEASE | |
0b4e3aa0 | 79 | ifndef INSTALL_ARCHS |
1c79356b A |
80 | ifdef RC_ARCHS |
81 | export INSTALL_ARCHS = $(ARCH_CONFIGS) | |
82 | else | |
83 | export INSTALL_ARCHS = $(ARCH_CONFIGS) | |
84 | endif | |
0b4e3aa0 A |
85 | export INSTALL_ARCHS_LC := $(shell echo -n $(ARCH_CONFIGS) | $(TR) A-Z a-z) |
86 | endif | |
1c79356b A |
87 | |
88 | export INSTALL_ARCH_DEFAULT = PPC | |
89 | ||
90 | # | |
91 | # Standard defines list | |
92 | # | |
93 | export DEFINES = -DAPPLE -DNeXT -DKERNEL_PRIVATE -D__MACHO__=1 -Dvolatile=__volatile $(IDENT) | |
94 | ||
95 | # | |
96 | # Compiler command | |
97 | # | |
9bccf70c A |
98 | KCC = /usr/bin/cc |
99 | KC++ = /usr/bin/c++ | |
100 | CC = $(KCC) | |
101 | ||
102 | ||
103 | # | |
104 | # Setup for parallel sub-makes when doing an RC build | |
105 | # | |
106 | ifndef MAKEJOBS | |
107 | ifeq "YES" "$(RC_XBS)" | |
108 | export MAKEJOBS = --jobs=3 | |
109 | endif | |
110 | endif | |
1c79356b A |
111 | |
112 | # | |
113 | # Default CFLAGS | |
114 | # | |
115 | ifdef RC_CFLAGS | |
116 | export OTHER_CFLAGS = $(subst $(addprefix -arch ,$(RC_ARCHS)),,$(RC_CFLAGS)) | |
117 | endif | |
118 | ||
9bccf70c A |
119 | export 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 | |
123 | export CFLAGS_RELEASE = | |
124 | export CFLAGS_DEBUG = -fno-omit-frame-pointer | |
125 | export CFLAGS_PROFILE = | |
126 | ||
127 | export CFLAGS_PPC = -arch ppc -Dppc -DPPC -D__PPC__ -D_BIG_ENDIAN=__BIG_ENDIAN__ | |
128 | export CFLAGS_I386 = -arch i386 -Di386 -DI386 -D__I386__ -D_BIG_ENDIAN=__LITTLE_ENDIAN__ | |
129 | ||
0b4e3aa0 A |
130 | export CFLAGS_RELEASEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns |
131 | export CFLAGS_RELEASE_TRACEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns | |
d7e50217 | 132 | export CFLAGS_DEBUGPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns |
1c79356b A |
133 | export CFLAGS_RELEASEI386 = -O2 |
134 | export CFLAGS_DEBUGI386 = -O2 | |
135 | ||
136 | export 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 | 147 | CPPFLAGS_GEN = -fno-rtti -fno-exceptions -fcheck-new -fapple-kext |
1c79356b A |
148 | |
149 | CPPFLAGS = $(CPPFLAGS_GEN) \ | |
150 | $($(addsuffix $(ARCH_CONFIG),CCFLAGS_)) \ | |
151 | $($(addsuffix $(KERNEL_CONFIG),CCFLAGS_)) | |
152 | ||
153 | # | |
154 | # Assembler command | |
155 | # | |
156 | AS = /usr/bin/cc | |
157 | S_KCC = /usr/bin/cc | |
158 | ||
159 | # | |
160 | # Default SFLAGS | |
161 | # | |
162 | export SFLAGS_GEN = -static -D__ASSEMBLER__ -force_cpusubtype_ALL $(OTHER_CFLAGS) | |
163 | ||
164 | export SFLAGS_RELEASE = | |
165 | export SFLAGS_DEBUG = | |
166 | export SFLAGS_PROFILE = | |
167 | ||
168 | export SFLAGS_PPC = $(CFLAGS_PPC) | |
169 | export SFLAGS_I386 = $(CFLAGS_I386) | |
170 | ||
171 | export SFLAGS = $(SFLAGS_GEN) \ | |
172 | $($(addsuffix $(ARCH_CONFIG),SFLAGS_)) \ | |
173 | $($(addsuffix $(KERNEL_CONFIG),SFLAGS_)) \ | |
174 | $(DEFINES) | |
175 | ||
176 | # | |
177 | # Linker command | |
178 | # | |
179 | LD = /usr/bin/ld | |
180 | ||
181 | # | |
182 | # Default LDFLAGS | |
183 | # | |
184 | export LDFLAGS_COMPONENT_GEN = -static -r | |
185 | ||
186 | export LDFLAGS_COMPONENT_RELEASE = | |
187 | export LDFLAGS_COMPONENT_DEBUG = | |
188 | export LDFLAGS_COMPONENT_PROFILE = | |
189 | ||
190 | export LDFLAGS_COMPONENT_PPC = -arch ppc | |
191 | export LDFLAGS_COMPONENT_I386 = -arch i386 | |
192 | ||
193 | export LDFLAGS_COMPONENT = $(LDFLAGS_COMPONENT_GEN) \ | |
194 | $($(addsuffix $(ARCH_CONFIG),LDFLAGS_COMPONENT_)) \ | |
195 | $($(addsuffix $(KERNEL_CONFIG),LDFLAGS_COMPONENT_)) | |
196 | ||
197 | export LDFLAGS_KERNEL_GEN = -static -force_cpusubtype_ALL -segalign 0x1000 | |
198 | ||
199 | export LDFLAGS_KERNEL_RELEASE = | |
200 | # -noseglinkedit | |
201 | export LDFLAGS_KERNEL_DEBUG = | |
202 | export LDFLAGS_KERNEL_PROFILE = | |
203 | ||
d7e50217 | 204 | export 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 |
0b4e3aa0 | 205 | export LDFLAGS_KERNEL_I386 = -arch i386 -segaddr __TEXT 0x100000 -e _pstart |
1c79356b A |
206 | |
207 | export 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 | # | |
215 | export LD_KERNEL_LIBS = -lcc_kext | |
216 | ||
217 | # | |
218 | # Default INCFLAGS | |
219 | # | |
220 | export INCFLAGS_IMPORT = $(patsubst %, -I$(OBJROOT)/EXPORT_HDRS/%, $(COMPONENT_IMPORT_LIST)) | |
221 | export INCFLAGS_EXTERN = -I$(OBJROOT)/EXTERN_HDRS -I$(SRCROOT)/EXTERNAL_HEADERS -I$(SRCROOT)/EXTERNAL_HEADERS/bsd | |
222 | export INCFLAGS_GEN = -I$(SRCROOT)/$(COMPONENT) | |
223 | export INCFLAGS_POSIX = -I$(OBJROOT)/EXPORT_HDRS/bsd | |
224 | export INCFLAGS_LOCAL = -I. | |
225 | ||
9bccf70c | 226 | export INCFLAGS = $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE) |
1c79356b A |
227 | |
228 | # | |
229 | # Default MIGFLAGS | |
230 | # | |
231 | export MIGFLAGS = $(DEFINES) $(INCFLAGS) $($(addsuffix $(ARCH_CONFIG),CFLAGS_)) | |
232 | ||
233 | # | |
234 | # Default VPATH | |
235 | # | |
236 | empty:= | |
237 | space:= $(empty) $(empty) | |
238 | export VPATH_IMPORT = $(subst $(space),:,$(patsubst %,$(OBJROOT)/EXPORT_HDRS/%,$(strip $(COMPONENT_IMPORT_LIST)))): | |
239 | export VPATH_EXTERN = $(OBJROOT)/EXTERN_HDRS: | |
240 | export VPATH_GEN = .:$(SOURCE): | |
241 | ||
242 | export 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 | # | |
249 | INSTALL_FLAGS = -c -m 0444 | |
d7e50217 A |
250 | FILE_INSTALL_FLAGS = -c -m 0644 |
251 | DATA_INSTALL_FLAGS = -c -m 0644 | |
1c79356b A |
252 | |
253 | # | |
254 | # Header file destinations | |
255 | # | |
256 | FRAMEDIR = System/Library/Frameworks | |
257 | ifndef INCDIR | |
258 | INCDIR = /usr/include | |
259 | endif | |
260 | ifndef LCLDIR | |
261 | LCLDIR = $(FRAMEDIR)/System.framework/Versions/B/PrivateHeaders | |
262 | endif | |
263 | ||
264 | KINCVERS = A | |
265 | KINCFRAME = $(FRAMEDIR)/Kernel.framework | |
266 | KINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Headers | |
0b4e3aa0 | 267 | KPINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/PrivateHeaders |
1c79356b A |
268 | |
269 | # | |
270 | # Compononent Header file destinations | |
271 | # | |
272 | EXPDIR = EXPORT_HDRS/$(COMPONENT) | |
273 | ||
274 | # | |
275 | # Strip Flags | |
276 | # | |
277 | export STRIP_FLAGS_RELEASE = -S | |
278 | export STRIP_FLAGS_RELEASE_TRACE = -S | |
279 | export STRIP_FLAGS_DEBUG = -S | |
280 | export STRIP_FLAGS_PROFILE = -S | |
281 | ||
282 | export STRIP_FLAGS = $($(addsuffix $(KERNEL_CONFIG),STRIP_FLAGS_)) | |
283 | ||
9bccf70c A |
284 | # |
285 | # Man Page destination | |
286 | # | |
287 | MANDIR = 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 | ||
296 | default: all | |
297 |