-
export SOURCE=$(shell /bin/pwd)
#
#
# Component List
#
+ifndef COMPONENT_LIST
export COMPONENT_LIST = osfmk bsd iokit pexpert libkern libsa
-export COMPONENT = $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE))))
-export COMPONENT_IMPORT_LIST = $(filter-out $(COMPONENT),$(COMPONENT_LIST))
+export COMPONENT_LIST_UC := $(shell echo -n $(COMPONENT_LIST) | $(TR) a-z A-Z)
+endif
+ifndef COMPONENT
+export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE))))
+export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST))
+else
+ifeq ($(COMPONENT), .)
+export COMPONENT := $(firstword $(subst /, ,$(shell $(RELPATH) $(SRCROOT) $(SOURCE))))
+export COMPONENT_IMPORT_LIST := $(filter-out $(COMPONENT),$(COMPONENT_LIST))
+endif
+endif
# Architecture options
#
# supported configurations : PPC I386
#
+ifndef ARCH_CONFIGS
ifdef RC_ARCHS
-export ARCH_CONFIGS = $(shell echo -n $(RC_ARCHS) | tr a-z A-Z)
+export ARCH_CONFIGS := $(shell echo -n $(RC_ARCHS) | $(TR) a-z A-Z)
else
-ifndef ARCH_CONFIGS
-export ARCH_CONFIGS = $(shell arch | tr a-z A-Z)
+export ARCH_CONFIGS := $(shell arch | $(TR) a-z A-Z)
+endif
+endif
+ifdef ARCH_CONFIG
+ifndef ARCH_CONFIG_LC
+export ARCH_CONFIG_LC := $(shell echo -n $(ARCH_CONFIG) | $(TR) A-Z a-z)
endif
endif
-export ARCH_CONFIG = $(firstword $(ARCH_CONFIGS))
-export arch_config = $(shell echo -n $(ARCH_CONFIG) | tr A-Z a-z)
# Kernel Configuration options
ifndef KERNEL_CONFIGS
export KERNEL_CONFIGS = RELEASE
endif
+ifndef KERNEL_CONFIG
export KERNEL_CONFIG = $(firstword $(KERNEL_CONFIGS))
+endif
#
# Kernel Configuration to install
# supported install architecture : PPC I386
#
export INSTALL_TYPE = RELEASE
+ifndef INSTALL_ARCHS
ifdef RC_ARCHS
export INSTALL_ARCHS = $(ARCH_CONFIGS)
else
export INSTALL_ARCHS = $(ARCH_CONFIGS)
endif
-export INSTALL_ARCH = $(ARCH_CONFIG)
+export INSTALL_ARCHS_LC := $(shell echo -n $(ARCH_CONFIGS) | $(TR) A-Z a-z)
+endif
export INSTALL_ARCH_DEFAULT = PPC
#
# Compiler command
#
-CC = /usr/bin/cc
-KCC = /usr/bin/cc
+KCC = /usr/bin/cc
+KC++ = /usr/bin/c++
+CC = $(KCC)
+
+
+#
+# Setup for parallel sub-makes when doing an RC build
+#
+ifndef MAKEJOBS
+ifeq "YES" "$(RC_XBS)"
+export MAKEJOBS = --jobs=3
+endif
+endif
#
# Default CFLAGS
export OTHER_CFLAGS = $(subst $(addprefix -arch ,$(RC_ARCHS)),,$(RC_CFLAGS))
endif
-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
+export CFLAGS_GEN = -static -g -nostdinc -nostdlib -no-cpp-precomp \
+ -fno-builtin -finline -fno-keep-inline-functions -msoft-float \
+ -fsigned-bitfields -Wpointer-arith $(OTHER_CFLAGS)
export CFLAGS_RELEASE =
-export CFLAGS_DEBUG = -fno-omit-frame-pointer
-export CFLAGS_PROFILE =
+export CFLAGS_DEBUG =
+export CFLAGS_PROFILE = -pg
-export CFLAGS_PPC = -arch ppc -Dppc -DPPC -D__PPC__ -D_BIG_ENDIAN=__BIG_ENDIAN__
-export CFLAGS_I386 = -arch i386 -Di386 -DI386 -D__I386__ -D_BIG_ENDIAN=__LITTLE_ENDIAN__
+export CFLAGS_PPC = -arch ppc -Dppc -DPPC -D__PPC__ -DPAGE_SIZE_FIXED
+export CFLAGS_I386 = -arch i386 -Di386 -DI386 -D__I386__ \
+ -march=i686 -mpreferred-stack-boundary=2 -falign-functions=4 -mcpu=pentium4
-export CFLAGS_RELEASEPPC = -O2 -mcpu=750 -fschedule-insns
-export CFLAGS_RELEASE_TRACEPPC = -O2 -mcpu=750 -fschedule-insns
-export CFLAGS_DEBUGPPC = -O1 -mcpu=750 -fschedule-insns
+export CFLAGS_RELEASEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
+export CFLAGS_RELEASE_TRACEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
+export CFLAGS_DEBUGPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
+export CFLAGS_PROFILEPPC = -O2 -mcpu=750 -mmultiple -fschedule-insns
export CFLAGS_RELEASEI386 = -O2
export CFLAGS_DEBUGI386 = -O2
+export CFLAGS_PROFILEI386 = -O2
export CFLAGS = $(CFLAGS_GEN) \
$($(addsuffix $(ARCH_CONFIG),CFLAGS_)) \
$($(addsuffix $(ARCH_CONFIG), $(addsuffix $(KERNEL_CONFIG),CFLAGS_))) \
$(DEFINES)
-# Default CCFLAGS
-#(we do not call it CPPFLAGS as that has a special meaning in unix tradition
-# and in gcc: CPPFLAGS is for C Pre-Processor flags. CCFLAGS has precedent
-# in ProjectBuilder because of the .cc extension)
+# Default C++ flags
#
-CPPFLAGS_GEN = -x c++ -fno-rtti -fno-exceptions -fcheck-new -fvtable-thunks
-CPPFLAGS_PPC =
-CPPFLAGS_I386 =
+CXXFLAGS_GEN = -fno-rtti -fno-exceptions -fcheck-new -fapple-kext -fpermissive
-CPPFLAGS = $(CPPFLAGS_GEN) \
- $($(addsuffix $(ARCH_CONFIG),CCFLAGS_)) \
- $($(addsuffix $(KERNEL_CONFIG),CCFLAGS_))
+CXXFLAGS = $(CXXFLAGS_GEN) \
+ $($(addsuffix $(ARCH_CONFIG),CXXFLAGS_)) \
+ $($(addsuffix $(KERNEL_CONFIG),CXXFLAGS_))
#
# Assembler command
#
# Default LDFLAGS
#
-export LDFLAGS_COMPONENT_GEN = -static -r
+export LDFLAGS_COMPONENT_GEN = -static -r $(COMP_LDFLAGS_COMPONENT_GEN)
-export LDFLAGS_COMPONENT_RELEASE =
-export LDFLAGS_COMPONENT_DEBUG =
-export LDFLAGS_COMPONENT_PROFILE =
+export LDFLAGS_COMPONENT_RELEASE = $(COMP_LDFLAGS_COMPONENT_RELEASE)
+export LDFLAGS_COMPONENT_DEBUG = $(COMP_LDFLAGS_COMPONENT_DEBUG)
+export LDFLAGS_COMPONENT_PROFILE = $(COMP_LDFLAGS_COMPONENT_PROFILE)
-export LDFLAGS_COMPONENT_PPC = -arch ppc
-export LDFLAGS_COMPONENT_I386 = -arch i386
+export LDFLAGS_COMPONENT_PPC = -arch ppc $(COMP_LDFLAGS_COMPONENT_PPC)
+export LDFLAGS_COMPONENT_I386 = -arch i386 $(COMP_LDFLAGS_COMPONENT_i386)
export LDFLAGS_COMPONENT = $(LDFLAGS_COMPONENT_GEN) \
$($(addsuffix $(ARCH_CONFIG),LDFLAGS_COMPONENT_)) \
export LDFLAGS_KERNEL_DEBUG =
export LDFLAGS_KERNEL_PROFILE =
-export LDFLAGS_KERNEL_PPC = -arch ppc -segaddr __VECTORS 0x0 -segaddr __TEXT 0x11000 -e __start -sectalign __DATA __common 0x1000 -sectalign __DATA __bss 0x1000
-export LDFLAGS_KERNEL_I386 = -arch i386 -segaddr __TEXT 0x100000 -segaddr __LINKEDIT 0x780000 -e _pstart
+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 -sectcreate __PRELINK __text /dev/null -sectcreate __PRELINK __symtab /dev/null -sectcreate __PRELINK __info /dev/null
+export LDFLAGS_KERNEL_I386 = -arch i386 -segaddr __TEXT 0x100000 -e _pstart -sectcreate __PRELINK __text /dev/null -sectcreate __PRELINK __symtab /dev/null -sectcreate __PRELINK __info /dev/null
export LDFLAGS_KERNEL = $(LDFLAGS_KERNEL_GEN) \
$($(addsuffix $(ARCH_CONFIG),LDFLAGS_KERNEL_)) \
export INCFLAGS_POSIX = -I$(OBJROOT)/EXPORT_HDRS/bsd
export INCFLAGS_LOCAL = -I.
-export INCFLAGS = -nostdinc $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE)
+export INCFLAGS = $(INCFLAGS_LOCAL) $(INCFLAGS_GEN) $(INCFLAGS_IMPORT) $(INCFLAGS_EXTERN) $(INCFLAGS_MAKEFILE)
#
# Default MIGFLAGS
# install flags for header files
#
INSTALL_FLAGS = -c -m 0444
+FILE_INSTALL_FLAGS = -c -m 0644
+DATA_INSTALL_FLAGS = -c -m 0644
#
# Header file destinations
KINCVERS = A
KINCFRAME = $(FRAMEDIR)/Kernel.framework
KINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/Headers
+KPINCDIR = $(KINCFRAME)/Versions/$(KINCVERS)/PrivateHeaders
#
# Compononent Header file destinations
#
# Strip Flags
#
-export STRIP_FLAGS_RELEASE = -S
-export STRIP_FLAGS_RELEASE_TRACE = -S
+export STRIP_FLAGS_RELEASE = -S -x
+export STRIP_FLAGS_RELEASE_TRACE = -S -x
export STRIP_FLAGS_DEBUG = -S
-export STRIP_FLAGS_PROFILE = -S
+export STRIP_FLAGS_DEBUG_TRACE = -S
+export STRIP_FLAGS_PROFILE = -S -x
export STRIP_FLAGS = $($(addsuffix $(KERNEL_CONFIG),STRIP_FLAGS_))
+#
+# Man Page destination
+#
+MANDIR = usr/share/man
+
#
# This must be here before any rules are possibly defined by the
# machine dependent makefile fragment so that a plain "make" command