1 export SOURCE=$(shell /bin/pwd)
6 export USE_APPLE_PB_SUPPORT = all
9 # Incremental Build option
11 ifndef INCR_EXPORTHDRS
12 ifeq ($(shell test -d $$OBJROOT/EXPORT_HDRS;echo $$?),0)
13 export INCR_EXPORTHDRS = TRUE
15 export INCR_EXPORTHDRS = FALSE
19 ifndef INCR_INSTALLHDRS
20 ifeq ($(shell test -d $$DSTROOT/$INCDIR;echo $$?),0)
21 export INCR_INSTALLHDRS = TRUE
23 export INCR_INSTALLHDRS = FALSE
31 export COMPONENT_LIST = osfmk bsd iokit pexpert libkern libsa
32 export COMPONENT_LIST_UC := $(shell echo -n $(COMPONENT_LIST) | $(TR) a-z A-Z)
35 export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE))))
36 export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST))
38 ifeq ($(COMPONENT), .)
39 export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE))))
40 export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST))
44 # Architecture options
46 # supported configurations : PPC I386
50 export ARCH_CONFIGS := $(shell echo -n $(RC_ARCHS) | $(TR) a-z A-Z)
52 export ARCH_CONFIGS := $(shell arch | $(TR) a-z A-Z)
57 export ARCH_CONFIG_LC := $(shell echo -n $(ARCH_CONFIG) | $(TR) A-Z a-z)
62 # Kernel Configuration options
64 # supported configurations : RELEASE DEBUG PROFILE
67 export KERNEL_CONFIGS = RELEASE
70 export KERNEL_CONFIG = $(firstword $(KERNEL_CONFIGS))
74 # Kernel Configuration to install
76 # supported install architecture : PPC I386
78 export INSTALL_TYPE = RELEASE
81 export INSTALL_ARCHS = $(ARCH_CONFIGS)
83 export INSTALL_ARCHS = $(ARCH_CONFIGS)
85 export INSTALL_ARCHS_LC := $(shell echo -n $(ARCH_CONFIGS) | $(TR) A-Z a-z)
88 export INSTALL_ARCH_DEFAULT = PPC
91 # Standard defines list
93 export DEFINES = -DAPPLE -DNeXT -DKERNEL_PRIVATE -D__MACHO__=1 -Dvolatile=__volatile $(IDENT)
104 # Setup for parallel sub-makes when doing an RC build
107 ifeq "YES" "$(RC_XBS)"
108 export MAKEJOBS = --jobs=3
116 export OTHER_CFLAGS = $(subst $(addprefix -arch ,$(RC_ARCHS)),,$(RC_CFLAGS))
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
123 export CFLAGS_RELEASE =
124 export CFLAGS_DEBUG = -fno-omit-frame-pointer
125 export CFLAGS_PROFILE =
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__
130 export CFLAGS_RELEASEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
131 export CFLAGS_RELEASE_TRACEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
132 export CFLAGS_DEBUGPPC = -O1 -mcpu=750 -mmultiple -fschedule-insns
133 export CFLAGS_RELEASEI386 = -O2
134 export CFLAGS_DEBUGI386 = -O2
136 export CFLAGS = $(CFLAGS_GEN) \
137 $($(addsuffix $(ARCH_CONFIG),CFLAGS_)) \
138 $($(addsuffix $(KERNEL_CONFIG),CFLAGS_)) \
139 $($(addsuffix $(ARCH_CONFIG), $(addsuffix $(KERNEL_CONFIG),CFLAGS_))) \
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)
147 CPPFLAGS_GEN = -fno-rtti -fno-exceptions -fcheck-new -fapple-kext
149 CPPFLAGS = $(CPPFLAGS_GEN) \
150 $($(addsuffix $(ARCH_CONFIG),CCFLAGS_)) \
151 $($(addsuffix $(KERNEL_CONFIG),CCFLAGS_))
162 export SFLAGS_GEN = -static -D__ASSEMBLER__ -force_cpusubtype_ALL $(OTHER_CFLAGS)
164 export SFLAGS_RELEASE =
165 export SFLAGS_DEBUG =
166 export SFLAGS_PROFILE =
168 export SFLAGS_PPC = $(CFLAGS_PPC)
169 export SFLAGS_I386 = $(CFLAGS_I386)
171 export SFLAGS = $(SFLAGS_GEN) \
172 $($(addsuffix $(ARCH_CONFIG),SFLAGS_)) \
173 $($(addsuffix $(KERNEL_CONFIG),SFLAGS_)) \
184 export LDFLAGS_COMPONENT_GEN = -static -r
186 export LDFLAGS_COMPONENT_RELEASE =
187 export LDFLAGS_COMPONENT_DEBUG =
188 export LDFLAGS_COMPONENT_PROFILE =
190 export LDFLAGS_COMPONENT_PPC = -arch ppc
191 export LDFLAGS_COMPONENT_I386 = -arch i386
193 export LDFLAGS_COMPONENT = $(LDFLAGS_COMPONENT_GEN) \
194 $($(addsuffix $(ARCH_CONFIG),LDFLAGS_COMPONENT_)) \
195 $($(addsuffix $(KERNEL_CONFIG),LDFLAGS_COMPONENT_))
197 export LDFLAGS_KERNEL_GEN = -static -force_cpusubtype_ALL -segalign 0x1000
199 export LDFLAGS_KERNEL_RELEASE =
201 export LDFLAGS_KERNEL_DEBUG =
202 export LDFLAGS_KERNEL_PROFILE =
204 export LDFLAGS_KERNEL_PPC = -arch ppc -segaddr __VECTORS 0x0 -segaddr __TEXT 0x11000 -e __start -sectalign __DATA __common 0x1000 -sectalign __DATA __bss 0x1000
205 export LDFLAGS_KERNEL_I386 = -arch i386 -segaddr __TEXT 0x100000 -e _pstart
207 export LDFLAGS_KERNEL = $(LDFLAGS_KERNEL_GEN) \
208 $($(addsuffix $(ARCH_CONFIG),LDFLAGS_KERNEL_)) \
209 $($(addsuffix $(KERNEL_CONFIG),LDFLAGS_KERNEL_))
213 # Default runtime libraries to be linked with the kernel
215 export LD_KERNEL_LIBS = -lcc_kext
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.
226 export INCFLAGS = $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE)
231 export MIGFLAGS = $(DEFINES) $(INCFLAGS) $($(addsuffix $(ARCH_CONFIG),CFLAGS_))
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):
242 export VPATH = $(VPATH_GEN)$(VPATH_IMPORT)$(VPATH_EXTERN)$(VPATH_MAKEFILE)
245 # Macros that control installation of kernel and it's header files
247 # install flags for header files
249 INSTALL_FLAGS = -c -m 0444
250 FILE_INSTALL_FLAGS = -c -m 0644
251 DATA_INSTALL_FLAGS = -c -m 0644
254 # Header file destinations
256 FRAMEDIR = System/Library/Frameworks
258 INCDIR = /usr/include
261 LCLDIR = $(FRAMEDIR)/System.framework/Versions/B/PrivateHeaders
265 KINCFRAME = $(FRAMEDIR)/Kernel.framework
266 KINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Headers
267 KPINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/PrivateHeaders
270 # Compononent Header file destinations
272 EXPDIR = EXPORT_HDRS/$(COMPONENT)
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
282 export STRIP_FLAGS = $($(addsuffix $(KERNEL_CONFIG),STRIP_FLAGS_))
285 # Man Page destination
287 MANDIR = usr/share/man
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.