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