2 export SOURCE=$(shell /bin/pwd)
7 export USE_APPLE_PB_SUPPORT = all
10 # Incremental Build option
12 ifndef INCR_EXPORTHDRS
13 ifeq ($(shell test -d $$OBJROOT/EXPORT_HDRS;echo $$?),0)
14 export INCR_EXPORTHDRS = TRUE
16 export INCR_EXPORTHDRS = FALSE
20 ifndef INCR_INSTALLHDRS
21 ifeq ($(shell test -d $$DSTROOT/$INCDIR;echo $$?),0)
22 export INCR_INSTALLHDRS = TRUE
24 export INCR_INSTALLHDRS = FALSE
32 export COMPONENT_LIST = osfmk bsd iokit pexpert libkern libsa
33 export COMPONENT_LIST_UC := $(shell echo -n $(COMPONENT_LIST) | $(TR) a-z A-Z)
36 export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE))))
37 export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST))
39 ifeq ($(COMPONENT), .)
40 export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE))))
41 export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST))
45 # Architecture options
47 # supported configurations : PPC I386
51 export ARCH_CONFIGS := $(shell echo -n $(RC_ARCHS) | $(TR) a-z A-Z)
53 export ARCH_CONFIGS := $(shell arch | $(TR) a-z A-Z)
58 export ARCH_CONFIG_LC := $(shell echo -n $(ARCH_CONFIG) | $(TR) A-Z a-z)
63 # Kernel Configuration options
65 # supported configurations : RELEASE DEBUG PROFILE
68 export KERNEL_CONFIGS = RELEASE
71 export KERNEL_CONFIG = $(firstword $(KERNEL_CONFIGS))
75 # Kernel Configuration to install
77 # supported install architecture : PPC I386
79 export INSTALL_TYPE = RELEASE
82 export INSTALL_ARCHS = $(ARCH_CONFIGS)
84 export INSTALL_ARCHS = $(ARCH_CONFIGS)
86 export INSTALL_ARCHS_LC := $(shell echo -n $(ARCH_CONFIGS) | $(TR) A-Z a-z)
89 export INSTALL_ARCH_DEFAULT = PPC
92 # Standard defines list
94 export DEFINES = -DAPPLE -DNeXT -DKERNEL_PRIVATE -D__MACHO__=1 -Dvolatile=__volatile $(IDENT)
106 export OTHER_CFLAGS = $(subst $(addprefix -arch ,$(RC_ARCHS)),,$(RC_CFLAGS))
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
111 export CFLAGS_RELEASE =
112 export CFLAGS_DEBUG = -fno-omit-frame-pointer
113 export CFLAGS_PROFILE =
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__
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
121 export CFLAGS_RELEASEI386 = -O2
122 export CFLAGS_DEBUGI386 = -O2
124 export CFLAGS = $(CFLAGS_GEN) \
125 $($(addsuffix $(ARCH_CONFIG),CFLAGS_)) \
126 $($(addsuffix $(KERNEL_CONFIG),CFLAGS_)) \
127 $($(addsuffix $(ARCH_CONFIG), $(addsuffix $(KERNEL_CONFIG),CFLAGS_))) \
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)
135 CPPFLAGS_GEN = -x c++ -fno-rtti -fno-exceptions -fcheck-new -fvtable-thunks
139 CPPFLAGS = $(CPPFLAGS_GEN) \
140 $($(addsuffix $(ARCH_CONFIG),CCFLAGS_)) \
141 $($(addsuffix $(KERNEL_CONFIG),CCFLAGS_))
152 export SFLAGS_GEN = -static -D__ASSEMBLER__ -force_cpusubtype_ALL $(OTHER_CFLAGS)
154 export SFLAGS_RELEASE =
155 export SFLAGS_DEBUG =
156 export SFLAGS_PROFILE =
158 export SFLAGS_PPC = $(CFLAGS_PPC)
159 export SFLAGS_I386 = $(CFLAGS_I386)
161 export SFLAGS = $(SFLAGS_GEN) \
162 $($(addsuffix $(ARCH_CONFIG),SFLAGS_)) \
163 $($(addsuffix $(KERNEL_CONFIG),SFLAGS_)) \
174 export LDFLAGS_COMPONENT_GEN = -static -r
176 export LDFLAGS_COMPONENT_RELEASE =
177 export LDFLAGS_COMPONENT_DEBUG =
178 export LDFLAGS_COMPONENT_PROFILE =
180 export LDFLAGS_COMPONENT_PPC = -arch ppc
181 export LDFLAGS_COMPONENT_I386 = -arch i386
183 export LDFLAGS_COMPONENT = $(LDFLAGS_COMPONENT_GEN) \
184 $($(addsuffix $(ARCH_CONFIG),LDFLAGS_COMPONENT_)) \
185 $($(addsuffix $(KERNEL_CONFIG),LDFLAGS_COMPONENT_))
187 export LDFLAGS_KERNEL_GEN = -static -force_cpusubtype_ALL -segalign 0x1000
189 export LDFLAGS_KERNEL_RELEASE =
191 export LDFLAGS_KERNEL_DEBUG =
192 export LDFLAGS_KERNEL_PROFILE =
194 export LDFLAGS_KERNEL_PPC = -arch ppc -segaddr __VECTORS 0x0 -segaddr __TEXT 0x11000 -e __start -sectalign __DATA __common 0x1000 -sectalign __DATA __bss 0x1000
195 export LDFLAGS_KERNEL_I386 = -arch i386 -segaddr __TEXT 0x100000 -e _pstart
197 export LDFLAGS_KERNEL = $(LDFLAGS_KERNEL_GEN) \
198 $($(addsuffix $(ARCH_CONFIG),LDFLAGS_KERNEL_)) \
199 $($(addsuffix $(KERNEL_CONFIG),LDFLAGS_KERNEL_))
203 # Default runtime libraries to be linked with the kernel
205 export LD_KERNEL_LIBS = -lcc_kext
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.
216 export INCFLAGS = -nostdinc $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE)
221 export MIGFLAGS = $(DEFINES) $(INCFLAGS) $($(addsuffix $(ARCH_CONFIG),CFLAGS_))
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):
232 export VPATH = $(VPATH_GEN)$(VPATH_IMPORT)$(VPATH_EXTERN)$(VPATH_MAKEFILE)
235 # Macros that control installation of kernel and it's header files
237 # install flags for header files
239 INSTALL_FLAGS = -c -m 0444
242 # Header file destinations
244 FRAMEDIR = System/Library/Frameworks
246 INCDIR = /usr/include
249 LCLDIR = $(FRAMEDIR)/System.framework/Versions/B/PrivateHeaders
253 KINCFRAME = $(FRAMEDIR)/Kernel.framework
254 KINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Headers
255 KPINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/PrivateHeaders
258 # Compononent Header file destinations
260 EXPDIR = EXPORT_HDRS/$(COMPONENT)
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
270 export STRIP_FLAGS = $($(addsuffix $(KERNEL_CONFIG),STRIP_FLAGS_))
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.