haiku/build/jam/BuildSetup

1020 lines
32 KiB
Plaintext
Raw Normal View History

# Variable naming conventions:
# TARGET_*: A build system variable specifying a property for building for
# the target platform (usually Haiku). E.g. TARGET_CC specifies the
# compiler when building a target for the target platform.
# HOST_*: A build system variable specifying a property of the platform
# hosting the build. E.g. HOST_CC specifies the compiler when
# building a target for the host platform (a build tool for
# instance).
# HAIKU_*: A build system variable specifying a build system property. Usually
# directory paths and the like.
#pragma mark - container settings
# Haiku image
HAIKU_IMAGE_CONTAINER_NAME = haiku-image-container ;
HAIKU_CONTAINER_GRIST on $(HAIKU_IMAGE_CONTAINER_NAME) = HaikuImage ;
HAIKU_INCLUDE_IN_CONTAINER_VAR on $(HAIKU_IMAGE_CONTAINER_NAME)
= HAIKU_INCLUDE_IN_IMAGE ;
HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_IMAGE_CONTAINER_NAME)
= HAIKU_IMAGE_INSTALL_TARGETS ;
# network boot archive
HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME = haiku-netboot-archive-container ;
HAIKU_CONTAINER_GRIST on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
= NetBootArchive ;
# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
= HAIKU_NET_BOOT_ARCHIVE_INSTALL_TARGETS ;
# boot floppy
HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-floppy-container ;
HAIKU_CONTAINER_GRIST on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
= FloppyBootImage ;
# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
= HAIKU_FLOPPY_BOOT_IMAGE_INSTALL_TARGETS ;
# boot CD image
HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-cd-container ;
HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) = CDBootImage ;
# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME)
= HAIKU_CD_BOOT_IMAGE_INSTALL_TARGETS ;
# boot CD for PPC image
HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME = haiku-boot-cd-ppc-container ;
HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME) = CDBootPPCImage ;
# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME)
= HAIKU_CD_BOOT_PPC_IMAGE_INSTALL_TARGETS ;
# Haiku image/install defaults
HAIKU_DEFAULT_IMAGE_NAME = haiku.image ;
HAIKU_DEFAULT_IMAGE_DIR = $(HAIKU_OUTPUT_DIR) ;
HAIKU_DEFAULT_VMWARE_IMAGE_NAME = haiku.vmdk ;
HAIKU_DEFAULT_INSTALL_DIR = /Haiku ;
HAIKU_DEFAULT_IMAGE_SIZE ?= 128 ; # 128 MB
HAIKU_DEFAULT_IMAGE_LABEL ?= Haiku ;
# Haiku CD defaults
HAIKU_DEFAULT_CD_NAME = haiku-cd.iso ;
HAIKU_DEFAULT_CD_DIR = $(HAIKU_OUTPUT_DIR) ;
HAIKU_DEFAULT_CD_LABEL = Haiku ;
# analyze and optionally replace jam's target parameters
ProcessCommandLineArguments ;
# include Timezones/libgccObjects
{
local timezones = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : Timezones ] ;
local libgccObjects = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : libgccObjects ] ;
if ! ( $(timezones) && $(libgccObjects) ) {
ECHO "No `Timezones' or `libgccObjects' found in"
"$(HAIKU_BUILD_OUTPUT_DIR)!" ;
EXIT "Please run ./configure in the source tree's root directory"
"again!" ;
}
LOCATE on Timezones = $(HAIKU_BUILD_OUTPUT_DIR) ;
LOCATE on libgccObjects = $(HAIKU_BUILD_OUTPUT_DIR) ;
include Timezones ;
include libgccObjects ;
}
# supported debug levels
HAIKU_DEBUG_LEVELS = 0 1 2 3 4 5 ;
# BeOS, BONE, Dan0 compatible platforms
HAIKU_BEOS_COMPATIBLE_PLATFORMS = haiku r5 bone dano haiku_host ;
HAIKU_BONE_COMPATIBLE_PLATFORMS = haiku bone dano haiku_host ;
HAIKU_DANO_COMPATIBLE_PLATFORMS = haiku dano haiku_host ;
HAIKU_HAIKU_COMPATIBLE_PLATFORMS = haiku haiku_host ;
# configuration header directories
HAIKU_CONFIG_HEADERS = [ FDirName $(HAIKU_TOP) build user_config_headers ]
[ FDirName $(HAIKU_TOP) build config_headers ] ;
#pragma mark -
# haiku target platform settings
# analyze GCC version
HAIKU_GCC_VERSION = [ FAnalyzeGCCVersion HAIKU_GCC_RAW_VERSION ] ;
# enable GCC -pipe option, if requested
if $(HAIKU_USE_GCC_PIPE) = 1 {
HAIKU_GCC_BASE_FLAGS = -pipe ;
}
# disable strict aliasing on anything newer than gcc 2 as it may lead to
# unexpected results. also disable the tree-vrp (value range propagation)
# optimization for now as with the current gcc4 version we are using this
# results in some broken code.
# TODO: remove the -fno-strict-aliasing option when all code has been
# analyzed/fixed with regard to aliasing.
# TODO: retest/remove the -fno-tree-vrp option as soon as we have updated our
# gcc4 compiler.
if $(HAIKU_GCC_VERSION[1]) >= 3 {
HAIKU_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-tree-vrp ;
}
# override gcc 2.95.3's header directory -- strictly necessary only when using
# the BeOS native compiler (since its headers are incompatible), but it doesn't
# harm for the cross-compiler either.
if $(HAIKU_GCC_VERSION[1]) = 2 {
HAIKU_GCC_HEADERS_DIR = [ FDirName $(HAIKU_TOP) headers build gcc-2.95.3 ] ;
}
# initial state for flags etc.
HAIKU_C++ ?= $(HAIKU_CC) ;
HAIKU_LINK = $(HAIKU_CC) ;
HAIKU_LINKFLAGS = $(HAIKU_GCC_BASE_FLAGS) ;
HAIKU_HDRS = [ FStandardHeaders ] ;
HAIKU_CCFLAGS = $(HAIKU_GCC_BASE_FLAGS) -nostdinc ;
HAIKU_C++FLAGS = $(HAIKU_GCC_BASE_FLAGS) -nostdinc ;
HAIKU_KERNEL_CCFLAGS = $(HAIKU_GCC_BASE_FLAGS) ;
HAIKU_KERNEL_C++FLAGS = $(HAIKU_GCC_BASE_FLAGS) ;
HAIKU_DEFINES = __HAIKU__ ;
# distro compatibility level defines
HAIKU_DISTRO_COMPATIBILITY ?= "default" ;
switch $(HAIKU_DISTRO_COMPATIBILITY) {
case official : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_OFFICIAL ;
case compatible : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_COMPATIBLE ;
case "default" : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_DEFAULT ;
case * : Exit "Invalid value for HAIKU_DISTRO_COMPATIBILITY:"
$(HAIKU_DISTRO_COMPATIBILITY) ;
}
# analyze the gcc machine spec to determine HAIKU_CPU
switch $(HAIKU_GCC_MACHINE) {
case i386-* : HAIKU_CPU = x86 ;
case i486-* : HAIKU_CPU = x86 ;
case i586-* : HAIKU_CPU = x86 ;
case i686-* : HAIKU_CPU = x86 ;
case powerpc-* : HAIKU_CPU = ppc ;
case m68k-* : HAIKU_CPU = m68k ;
case * : Exit "Unsupported gcc target machine:" $(HAIKU_GCC_MACHINE) ;
}
switch $(HAIKU_CPU) {
case ppc :
{
HAIKU_DEFINES += __POWERPC__ ;
HAIKU_BOOT_PLATFORM = openfirmware ;
# offset in floppy image (>= sizeof(haiku_loader))
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet
}
case x86 :
{
HAIKU_DEFINES += __INTEL__ ;
HAIKU_BOOT_PLATFORM = bios_ia32 ;
# offset in floppy image (>= sizeof(haiku_loader))
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 300 ; # in kB
# yasm is required for target arch x86
if ! $(HAIKU_YASM) {
Exit "HAIKU_YASM not set. Please re-run configure." ;
}
}
case m68k :
{
HAIKU_DEFINES += __M68K__ ;
HAIKU_BOOT_PLATFORM = atari_m68k ;
# offset in floppy image (>= sizeof(haiku_loader))
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 130 ; # in kB
}
case * :
Exit "Currently unsupported target CPU:" $(HAIKU_CPU) ;
}
HAIKU_ARCH ?= $(HAIKU_CPU) ;
HAIKU_ARCH_MACRO_DEFINE = ARCH_$(HAIKU_ARCH) ;
HAIKU_DEFINES += $(HAIKU_ARCH_MACRO_DEFINE) ;
HAIKU_DEFINES += BOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ;
# directories
HAIKU_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) haiku ] ;
HAIKU_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) common ] ;
HAIKU_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) $(HAIKU_ARCH) ] ;
HAIKU_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) common ] ;
HAIKU_DEBUG_0_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) release ] ;
local level ;
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
HAIKU_DEBUG_$(level)_OBJECT_DIR
= [ FDirName $(HAIKU_ARCH_OBJECT_DIR) debug_$(level) ] ;
}
# set variables for gcc header options
SetIncludePropertiesVariables HAIKU ;
# assembler flags
HAIKU_ASFLAGS = ;
# C/C++ flags
HAIKU_KERNEL_CCFLAGS += -finline -fno-builtin
Merged branch haiku/branches/developer/bonefish/optimization revision 23139 into trunk, with roughly the following changes (for details svn log the branch): * The int 99 syscall handler is now fully in assembly. * Added a sysenter/sysexit handler and use it on Pentiums that support it (via commpage). * Got rid of i386_handle_trap(). A bit of functionality was moved into the assembly handler which now uses a jump table to call C functions handling the respective interrupt. * Some optimizations to get user debugger support code out of the interrupt handling path. * Introduced a thread::flags fields which allows to skip handling of rare events (signals, user debug enabling/disabling) on the common interrupt handling path. * Got rid of the explicit iframe stack. The iframes can still be retrieved by iterating through the stack frames. * Made the commpage an architecture independent feature. It's used for the real time data stuff (instead of creating a separate area). * The x86 CPU modules can now provide processor optimized versions for common functions (currently memcpy() only). They are used in the kernel and are provided to the userland via commpage entries. * Introduced build system feature allowing easy use of C structure member offsets in assembly code. Changes after merging: * Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp (caused by refactoring and introduction of "call" debugger command). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-11 03:36:44 +03:00
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) ;
HAIKU_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions
Merged branch haiku/branches/developer/bonefish/optimization revision 23139 into trunk, with roughly the following changes (for details svn log the branch): * The int 99 syscall handler is now fully in assembly. * Added a sysenter/sysexit handler and use it on Pentiums that support it (via commpage). * Got rid of i386_handle_trap(). A bit of functionality was moved into the assembly handler which now uses a jump table to call C functions handling the respective interrupt. * Some optimizations to get user debugger support code out of the interrupt handling path. * Introduced a thread::flags fields which allows to skip handling of rare events (signals, user debug enabling/disabling) on the common interrupt handling path. * Got rid of the explicit iframe stack. The iframes can still be retrieved by iterating through the stack frames. * Made the commpage an architecture independent feature. It's used for the real time data stuff (instead of creating a separate area). * The x86 CPU modules can now provide processor optimized versions for common functions (currently memcpy() only). They are used in the kernel and are provided to the userland via commpage entries. * Introduced build system feature allowing easy use of C structure member offsets in assembly code. Changes after merging: * Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp (caused by refactoring and introduction of "call" debugger command). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-11 03:36:44 +03:00
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) ;
HAIKU_KERNEL_DEFINES += _KERNEL_MODE ;
if $(HAIKU_GCC_VERSION[1]) >= 3 {
HAIKU_KERNEL_C++FLAGS += -fno-use-cxa-atexit ;
}
if $(HAIKU_GCC_VERSION[1]) >= 4 {
HAIKU_C++FLAGS += -Wno-deprecated ;
if $(HAIKU_GCC_VERSION[2]) >= 3 {
HAIKU_KERNEL_CCFLAGS += -ffreestanding ;
HAIKU_KERNEL_C++FLAGS += -ffreestanding ;
}
}
HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ;
HAIKU_KERNEL_PIC_LINKFLAGS = ;
if $(HAIKU_ARCH) = ppc {
# Build a position independent PPC kernel. We need to be able to relocate
# the kernel, since the virtual address space layout at boot time is not
# fixed.
HAIKU_KERNEL_PIC_CCFLAGS = -fPIE ;
HAIKU_KERNEL_PIC_LINKFLAGS = -shared -fPIE ;
}
if $(HAIKU_ARCH) = m68k {
# We don't need a PIC kernel as it's always at the same place.
# it's actually needed to not use pic, else linking fails due to too large
# pc refs.
HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ;
HAIKU_KERNEL_PIC_LINKFLAGS = ;
# we don't want to have to handle emulating missing FPU opcodes for 040 and
# 060 in the kernel
HAIKU_KERNEL_CCFLAGS += -m68020-60 ;
HAIKU_KERNEL_C++FLAGS += -m68020-60 ;
}
# If the environment variable DEBUG_PRINTF is defined we define an equally
# named macro to the variable value. Some components use the macro to allow
# another function than printf() to print the debug output. The variable should
# be set to the name of the alternative function.
#
if $(DEBUG_PRINTF) {
HAIKU_CCFLAGS += [ FDefines DEBUG_PRINTF=$(DEBUG_PRINTF) ] ;
HAIKU_C++FLAGS += [ FDefines DEBUG_PRINTF=$(DEBUG_PRINTF) ] ;
}
# warning flags
HAIKU_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes
-Wpointer-arith -Wcast-align -Wsign-compare -Wno-multichar ;
HAIKU_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy
-Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare
-Wno-multichar ;
HAIKU_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes
-Wno-multichar ;
HAIKU_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-multichar ;
# debug flags
HAIKU_DEBUG_FLAGS ?= -ggdb ;
# debug 0: suppress asserts
HAIKU_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
HAIKU_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
HAIKU_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
HAIKU_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
local level ;
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
local flags = $(HAIKU_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ;
HAIKU_DEBUG_$(level)_CCFLAGS = $(flags) ;
HAIKU_DEBUG_$(level)_C++FLAGS = $(flags) ;
HAIKU_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ;
HAIKU_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ;
}
if $(HAIKU_GCC_VERSION[1]) >= 3 {
# TODO: Temporary work-around. Should be defined in the compiler specs
HAIKU_LINKFLAGS += -Xlinker --no-undefined ;
} else {
HAIKU_DEFINES += _BEOS_R5_COMPATIBLE_ ;
}
# private shared kernel/libroot headers
HAIKU_PRIVATE_SYSTEM_HEADERS =
[ PrivateHeaders $(DOT) system system/arch/$(HAIKU_ARCH) ]
;
# private kernel headers to be used when compiling kernel code
HAIKU_PRIVATE_KERNEL_HEADERS =
[ PrivateHeaders $(DOT) kernel libroot
kernel/boot/platform/$(HAIKU_BOOT_PLATFORM) ]
[ ArchHeaders $(HAIKU_ARCH) ]
$(HAIKU_PRIVATE_SYSTEM_HEADERS)
;
# Add some grist to the libgcc objects
HAIKU_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS:G=libgcc) ;
# the C++ library
if $(HAIKU_SHARED_LIBSTDC++) {
HAIKU_LIBSTDC++ = $(HAIKU_SHARED_LIBSTDC++) ;
} else if $(HAIKU_STATIC_LIBSTDC++) {
HAIKU_LIBSTDC++ = $(HAIKU_STATIC_LIBSTDC++) ;
} else {
HAIKU_LIBSTDC++ = libstdc++.r4.so ;
}
# the C++ support library
if $(HAIKU_SHARED_LIBSUPC++) {
HAIKU_LIBSUPC++ = $(HAIKU_SHARED_LIBSUPC++) ;
} else if $(HAIKU_STATIC_LIBSUPC++) {
HAIKU_LIBSUPC++ = $(HAIKU_STATIC_LIBSUPC++) ;
} else {
HAIKU_LIBSUPC++ = ;
}
# network libraries
HAIKU_NETWORK_LIBS = network ;
HAIKU_NETAPI_LIB = bnetapi ;
HAIKU_SELECT_UNAME_ETC_LIB = ; # libroot, against which we link anyway
# library and executable glue code
local commonGlueCode =
<src!system!glue>init_term_dyn.o
<src!system!glue!arch!$(HAIKU_ARCH)>crti.o
<src!system!glue!arch!$(HAIKU_ARCH)>crtn.o
;
HAIKU_LIBRARY_BEGIN_GLUE_CODE =
<src!system!glue!arch!$(HAIKU_ARCH)>crti.o
crtbegin.o
<src!system!glue>init_term_dyn.o
;
HAIKU_LIBRARY_END_GLUE_CODE =
# TODO: For the time being always link against libsupc++.a.
$(HAIKU_STATIC_LIBSUPC++)
crtend.o
<src!system!glue!arch!$(HAIKU_ARCH)>crtn.o
;
HAIKU_EXECUTABLE_BEGIN_GLUE_CODE =
<src!system!glue!arch!$(HAIKU_ARCH)>crti.o
crtbegin.o
<src!system!glue>start_dyn.o
<src!system!glue>init_term_dyn.o
;
HAIKU_EXECUTABLE_END_GLUE_CODE = $(HAIKU_LIBRARY_END_GLUE_CODE) ;
HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE = crtbegin.o ;
HAIKU_KERNEL_ADDON_END_GLUE_CODE = $(HAIKU_GCC_LIBGCC) crtend.o ;
SEARCH on crtbegin.o crtend.o = $(HAIKU_GCC_LIB_DIR) ;
HAIKU_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ;
# TODO: The version stuff should probably go into a separate file and be made
# available as macro, too.
# Set our version number if not already set and mark it as a developer build
if ! $(HAIKU_BUILD_VERSION) {
HAIKU_BUILD_VERSION ?= "1 0 0 a 1" ;
HAIKU_BUILD_DESCRIPTION ?= "Developer Build" ;
}
# If HAIKU_BUILD_VERSION is set, but HAIKU_BUILD_DESCRIPTION isn't, mark it as
# an unknown build.
HAIKU_BUILD_DESCRIPTION ?= "Unknown Build" ;
# init library name map
{
local i ;
for i in be game GL mail media midi midi2 network bnetapi opengl
screensaver root z textencoding tracker translation {
HAIKU_LIBRARY_NAME_MAP_$(i) = lib$(i).so ;
}
HAIKU_LIBRARY_NAME_MAP_libstdc++ = $(HAIKU_LIBSTDC++) ;
HAIKU_LIBRARY_NAME_MAP_input_server = <nogrist>input_server ;
}
#pragma mark -
# host platform settings
# enable GCC -m32 option, if requested
if $(HAIKU_HOST_USE_32BIT) = 1 {
HOST_GCC_BASE_FLAGS = -m32 ;
}
# save jam's variables for the build platform
HOST_AR ?= $(AR) ;
HOST_CC ?= $(CC) ;
HOST_C++ ?= $(C++) ;
HOST_LINK ?= $(LINK) ;
HOST_LD ?= ld ; # TODO: Fix this!
HOST_OBJCOPY ?= objcopy ; #
HOST_RANLIB ?= $(RANLIB) ;
HOST_CPPFLAGS ?= $(CPPFLAGS) ;
HOST_CCFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(CCFLAGS) ;
HOST_C++FLAGS ?= $(HOST_GCC_BASE_FLAGS) $(C++FLAGS) ;
HOST_LDFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(LDFLAGS) ;
HOST_LINKFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(LINKFLAGS) ;
HOST_DEFINES ?= $(DEFINES) ;
HOST_HDRS ?= $(HDRS) ;
# split up HOST_AR into the command name and flags
HOST_AR = [ Match "([^ ]*) *(.*)" : $(HOST_AR[1]) ]
$(HOST_AR[2-]) ;
HOST_ARFLAGS = $(HOST_AR[2-]) ;
HOST_AR = $(HOST_AR[1]) ;
HOST_UNARFLAGS ?= x ;
# check the host platform compatibility
SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host
: linux openbsd freebsd darwin sunos cygwin ;
if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd
|| $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = cygwin
|| $(HOST_PLATFORM) = sunos || $(HOST_PLATFORM) = openbsd {
# don't use lex: otherwise rc will not work correctly
if $(LEX) = lex {
LEX = flex ;
}
}
if $(HOST_PLATFORM) = cygwin {
HOST_LINKFLAGS += -Xlinker --allow-multiple-definition -Xlinker
--enable-auto-import ;
}
HOST_CPU ?= $(OSPLAT:L) ;
HOST_ARCH ?= $(HOST_CPU) ;
HOST_ARCH_MACRO_DEFINE = ARCH_$(HOST_CPU) ;
# directories
HOST_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) ] ;
HOST_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) common ] ;
HOST_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) $(HOST_ARCH) ] ;
HOST_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) common ] ;
HOST_DEBUG_0_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) release ] ;
local level ;
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
HOST_DEBUG_$(level)_OBJECT_DIR
= [ FDirName $(HOST_ARCH_OBJECT_DIR) debug_$(level) ] ;
}
# analyze GCC version
HOST_GCC_VERSION = [ FAnalyzeGCCVersion HOST_GCC_RAW_VERSION ] ;
# set variables for gcc header options
SetIncludePropertiesVariables HOST ;
# assembler flags
HOST_ASFLAGS = ;
# C/C++ flags
HOST_CCFLAGS += -Wno-multichar ;
HOST_C++FLAGS += -Wno-multichar ;
if $(HOST_PLATFORM) != cygwin {
HOST_PIC_CCFLAGS += -fPIC ;
HOST_PIC_C++FLAGS += -fPIC ;
}
HOST_KERNEL_CCFLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
HOST_KERNEL_C++FLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin
-fno-exceptions -DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
Merged branch haiku/branches/developer/bonefish/optimization revision 23139 into trunk, with roughly the following changes (for details svn log the branch): * The int 99 syscall handler is now fully in assembly. * Added a sysenter/sysexit handler and use it on Pentiums that support it (via commpage). * Got rid of i386_handle_trap(). A bit of functionality was moved into the assembly handler which now uses a jump table to call C functions handling the respective interrupt. * Some optimizations to get user debugger support code out of the interrupt handling path. * Introduced a thread::flags fields which allows to skip handling of rare events (signals, user debug enabling/disabling) on the common interrupt handling path. * Got rid of the explicit iframe stack. The iframes can still be retrieved by iterating through the stack frames. * Made the commpage an architecture independent feature. It's used for the real time data stuff (instead of creating a separate area). * The x86 CPU modules can now provide processor optimized versions for common functions (currently memcpy() only). They are used in the kernel and are provided to the userland via commpage entries. * Introduced build system feature allowing easy use of C structure member offsets in assembly code. Changes after merging: * Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp (caused by refactoring and introduction of "call" debugger command). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-11 03:36:44 +03:00
HOST_KERNEL_DEFINES += _KERNEL_MODE ;
HOST_KERNEL_PIC_CCFLAGS = -fno-pic ;
HOST_KERNEL_PIC_LINKFLAGS = ;
if $(HOST_ARCH) = ppc {
# Build a position independent PPC kernel. We need to be able to relocate
# the kernel, since the virtual address space layout at boot time is not
# fixed.
HOST_KERNEL_PIC_CCFLAGS = -fPIE ;
HOST_KERNEL_PIC_LINKFLAGS = -shared -fPIE ;
}
if $(HOST_ARCH) = m68k {
# Build a position independent M68K kernel. We need to be able to relocate
# the kernel, since the virtual address space layout at boot time is not
# fixed.
HOST_KERNEL_PIC_CCFLAGS = $(HAIKU_KERNEL_PIC_CCFLAGS) ;
HOST_KERNEL_PIC_LINKFLAGS = $(HAIKU_KERNEL_PIC_LINKFLAGS) ;
}
# warning flags
HOST_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes -Wpointer-arith
-Wcast-align -Wsign-compare ;
HOST_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy
-Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare ;
HOST_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes ;
HOST_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs ;
# debug flags
switch $(HOST_PLATFORM) {
case haiku : HOST_DEBUG_FLAGS ?= -ggdb ;
case haiku_host : HOST_DEBUG_FLAGS ?= -ggdb ;
case linux : HOST_DEBUG_FLAGS ?= -ggdb ;
case freebsd : HOST_DEBUG_FLAGS ?= -ggdb ;
case darwin : HOST_DEBUG_FLAGS ?= -ggdb ;
case * : HOST_DEBUG_FLAGS ?= -g ;
}
# debug 0: suppress asserts
HOST_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
HOST_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
HOST_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
HOST_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ;
local level ;
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
local flags = $(HOST_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ;
HOST_DEBUG_$(level)_CCFLAGS = $(flags) ;
HOST_DEBUG_$(level)_C++FLAGS = $(flags) ;
HOST_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ;
HOST_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ;
}
# ld flags
if $(HOST_ARCH) = x86 && $(HAIKU_HOST_USE_32BIT) = 1 {
HOST_LDFLAGS += -melf_i386 ;
}
# private kernel headers do be used when compiling kernel code
HOST_PRIVATE_KERNEL_HEADERS = ;
# private shared kernel/libroot headers
HOST_PRIVATE_SYSTEM_HEADERS = ;
# under BeOS use copyattr instead of cp
if $(HOST_PLATFORM_BEOS_COMPATIBLE)
{
CP = copyattr --data ;
}
HOST_DEFINES += $(HOST_ARCH_MACRO_DEFINE) ;
HOST_DEFINES += _NO_INLINE_ASM ;
if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
# TODO: That's obviously not correct, but in the way the COMPILE_FOR_R5
# macro is used, it actually seems to mean r5/bone/dano.
# TODO: Deprecated. Remove!
HOST_DEFINES += COMPILE_FOR_R5 ;
}
# for builds of tools in the current environment
HOST_BUILD_COMPATIBILITY_LIB_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) lib ] ;
# For the generic attributes emulation: Target rm_attrs -- rm replacement that
# also removes the attributes.
HOST_RM_ATTRS_TARGET = ;
if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
if $(HOST_GCC_VERSION[1]) < 3 {
HOST_LIBSTDC++ = stdc++.r4 ;
} else {
HOST_LIBSTDC++ = stdc++ ;
}
HOST_LIBROOT = root ;
HOST_STATIC_LIBROOT = $(HOST_LIBROOT) ;
HOST_LIBBE = be ;
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR = ;
HOST_LIBRARY_NAME_MAP_input_server = /system/servers/input_server ;
} else {
HOST_LIBSTDC++ = stdc++ ;
HOST_LIBROOT = libroot_build.so ;
HOST_STATIC_LIBROOT = libroot_build.a ;
HOST_LIBBE = libbe_build.so ;
if $(HOST_PLATFORM) = cygwin {
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
= "export PATH=$PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
} else {
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
= "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
}
# the C++ support library
if $(HOST_GCC_VERSION[1]) < 3 {
HOST_LIBSUPC++ = ;
} else {
HOST_LIBSUPC++ = supc++ ;
}
if $(HOST_PLATFORM) = darwin {
# part of the C++ runtime lives in libstdc++ on Darwin
HOST_LIBSUPC++ = gcc_s.1 stdc++ ;
HOST_LIBSTDC++ = ;
}
# Unlike glibc FreeBSD's libc doesn't have built-in regex support.
if $(HOST_PLATFORM) = freebsd {
HOST_LIBROOT += /usr/lib/libgnuregex.so ;
HOST_STATIC_LIBROOT += /usr/lib/libgnuregex.so ;
} else if $(HOST_PLATFORM) = darwin {
HOST_LIBROOT += /opt/local/lib/libgnuregex.dylib ;
HOST_STATIC_LIBROOT += /opt/local/lib/libgnuregex.dylib ;
}
# The BeOS compilers define __INTEL__ respectively __POWERPC__. On the
# build platform we need to make sure, this is also defined.
if $(HOST_CPU) = x86 {
HOST_DEFINES += __INTEL__ ;
} else if $(HOST_CPU) = ppc {
HOST_DEFINES += __POWERPC__ ;
} else if $(HOST_CPU) = m68k {
HOST_DEFINES += __M68K__ ;
}
# Supposing this is a glibc platform, let's try to get features like large
# file support, ISO C 99 definitions, etc. On some platforms we need to
# request 64 bit off_t support explicitely.
HOST_DEFINES += _GNU_SOURCE _FILE_OFFSET_BITS=64 ;
# On Linux with xattr support we can use it for our attribute emulation,
# which is somewhat more robust.
if $(HAIKU_HOST_USE_XATTR) = 1 {
HOST_DEFINES += HAIKU_HOST_USE_XATTR ;
} else {
# Otherwise the generic attribute emulation is used, which uses a
# directory per file to store its attribute. We need to redefine RM so
# that the attributes are removed as well. We use a wrapper script,
# which invokes a build tool. If the build tool hasn't been built yet,
# the normal "rm" is used and the attributes are leaked (likely there
# aren't any yet).
RM = $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ";"
[ FDirName $(HAIKU_TOP) build scripts rm_attrs ]
[ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) $(HOST_ARCH) release
tools rm_attrs ] -f ;
# assumes that rm_attrs is built with debugging disabled
HOST_RM_ATTRS_TARGET = <build>rm_attrs ;
}
}
# network libraries
if $(HOST_PLATFORM_HAIKU_COMPATIBLE) {
HOST_NETWORK_LIBS = network ;
HOST_NETAPI_LIB = bnetapi ;
HOST_SELECT_UNAME_ETC_LIB = ; # libroot
} else if $(HOST_PLATFORM_BONE_COMPATIBLE) {
HOST_NETWORK_LIBS = socket bind ;
HOST_NETAPI_LIB = bnetapi ;
HOST_SELECT_UNAME_ETC_LIB = ; # libroot
} else if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
HOST_NETWORK_LIBS = net ;
HOST_NETAPI_LIB = netapi ;
HOST_SELECT_UNAME_ETC_LIB = net ;
} else if $(HOST_PLATFORM) = "sunos" {
HOST_NETWORK_LIBS = xnet ;
HOST_NETAPI_LIB = ;
HOST_SELECT_UNAME_ETC_LIB = ;
} else {
# Linux,...
HOST_NETWORK_LIBS = ;
HOST_NETAPI_LIB = ;
HOST_SELECT_UNAME_ETC_LIB = ;
}
# define the executable MIME type
HOST_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ;
if $(METROWERKS) {
# at least parts of Haiku still can be compiled with
# the Metrowerks compiler on BeOS/PPC
HOST_EXECUTABLE_MIME_TYPE = "application/x-be-executable" ;
}
# Be API compatibility
HOST_BE_API_HEADERS = ;
HOST_BE_API_CCFLAGS = ;
HOST_BE_API_C++FLAGS = ;
if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) {
HOST_BE_API_HEADERS =
[ FDirName $(HAIKU_TOP) headers build ]
[ FDirName $(HAIKU_TOP) headers build os ]
[ FDirName $(HAIKU_TOP) headers build os app ]
[ FDirName $(HAIKU_TOP) headers build os drivers ]
[ FDirName $(HAIKU_TOP) headers build os kernel ]
[ FDirName $(HAIKU_TOP) headers build os interface ]
[ FDirName $(HAIKU_TOP) headers build os opengl ]
[ FDirName $(HAIKU_TOP) headers build os storage ]
[ FDirName $(HAIKU_TOP) headers build os support ]
;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
HOST_BE_API_CCFLAGS = -include BeOSBuildCompatibility.h ;
HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ;
}
# Add directory with system headers we need when building something for the host
# platform, e.g. containing missing POSIX/GNU headers.
HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host $(HOST_PLATFORM) ] ;
# For all versions of BeOS also add the common beos directory.
if $(HOST_PLATFORM) in r5 bone dano {
HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host beos_common ] ;
}
#pragma mark -
# target platform settings
# check the target platform compatibility
SetPlatformCompatibilityFlagVariables TARGET_PLATFORM : TARGET : target ;
# check the compatibility between host and target platform
if $(TARGET_PLATFORM) != haiku {
if ! $(HOST_PLATFORM_($(TARGET_PLATFORM))_COMPATIBLE) {
Exit ERROR: The host platform is not compatible with target platform
$(TARGET_PLATFORM). ;
}
}
# Set TARGET_* variables either from HAIKU_* or HOST_* depending on the
# specified TARGET_PLATFORM.
local buildVars =
ARCH CPU GCC_VERSION
AR CC C++ LD OBJCOPY RANLIB
INCLUDES_SEPARATOR LOCAL_INCLUDES_OPTION SYSTEM_INCLUDES_OPTION
HDRS CPPFLAGS CCFLAGS C++FLAGS LDFLAGS LINK LINKFLAGS DEFINES
ARFLAGS UNARFLAGS
Merged branch haiku/branches/developer/bonefish/optimization revision 23139 into trunk, with roughly the following changes (for details svn log the branch): * The int 99 syscall handler is now fully in assembly. * Added a sysenter/sysexit handler and use it on Pentiums that support it (via commpage). * Got rid of i386_handle_trap(). A bit of functionality was moved into the assembly handler which now uses a jump table to call C functions handling the respective interrupt. * Some optimizations to get user debugger support code out of the interrupt handling path. * Introduced a thread::flags fields which allows to skip handling of rare events (signals, user debug enabling/disabling) on the common interrupt handling path. * Got rid of the explicit iframe stack. The iframes can still be retrieved by iterating through the stack frames. * Made the commpage an architecture independent feature. It's used for the real time data stuff (instead of creating a separate area). * The x86 CPU modules can now provide processor optimized versions for common functions (currently memcpy() only). They are used in the kernel and are provided to the userland via commpage entries. * Introduced build system feature allowing easy use of C structure member offsets in assembly code. Changes after merging: * Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp (caused by refactoring and introduction of "call" debugger command). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-11 03:36:44 +03:00
KERNEL_DEFINES
KERNEL_CCFLAGS KERNEL_C++FLAGS
KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS
WARNING_CCFLAGS WARNING_C++FLAGS
KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS
DEBUG_FLAGS
DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS
KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS
KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS
PRIVATE_KERNEL_HEADERS
PRIVATE_SYSTEM_HEADERS
LIBSTDC++ LIBSUPC++
NETWORK_LIBS NETAPI_LIB SELECT_UNAME_ETC_LIB
ARCH_MACRO_DEFINE EXECUTABLE_MIME_TYPE
OBJECT_BASE_DIR COMMON_ARCH_OBJECT_DIR COMMON_DEBUG_OBJECT_DIR
DEBUG_$(HAIKU_DEBUG_LEVELS)_OBJECT_DIR
;
if $(TARGET_PLATFORM) = haiku {
local var ;
for var in $(buildVars) {
TARGET_$(var) = $(HAIKU_$(var)) ;
}
TARGET_GCC_LIB_DIR = $(HAIKU_GCC_LIB_DIR) ;
TARGET_GCC_HEADERS_DIR = $(HAIKU_GCC_HEADERS_DIR) ;
TARGET_GCC_LIBGCC = $(HAIKU_GCC_LIBGCC) ;
TARGET_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS) ;
TARGET_BOOT_PLATFORM ?= $(HAIKU_BOOT_PLATFORM) ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
TARGET_LIBRARY_NAME_MAP = HAIKU_LIBRARY_NAME_MAP ;
} else {
local var ;
for var in $(buildVars) {
TARGET_$(var) = $(HOST_$(var)) ;
}
TARGET_GCC_LIB_DIR = ;
TARGET_GCC_HEADERS_DIR = ;
TARGET_GCC_LIBGCC = ;
TARGET_GCC_LIBGCC_OBJECTS = ;
TARGET_BOOT_PLATFORM = ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
TARGET_LIBRARY_NAME_MAP = HOST_LIBRARY_NAME_MAP ;
}
# define macro, for identifying the platform
switch $(TARGET_PLATFORM) {
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
case r5 : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_BEOS ;
case bone : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_BONE ;
case dano : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_DANO ;
case haiku_host : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_HAIKU ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
case haiku : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_HAIKU ;
case linux : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_LINUX ;
case freebsd : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_FREEBSD ;
case darwin : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_DARWIN ;
case cygwin : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_CYGWIN ;
case sunos : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_SUNOS ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
case libbe_test : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_LIBBE_TEST ;
}
# define macro, for identifying the host platform
switch $(HOST_PLATFORM) {
case r5 : HOST_DEFINES += HAIKU_HOST_PLATFORM_BEOS ;
case bone : HOST_DEFINES += HAIKU_HOST_PLATFORM_BONE ;
case dano : HOST_DEFINES += HAIKU_HOST_PLATFORM_DANO ;
case haiku_host : HOST_DEFINES += HAIKU_HOST_PLATFORM_HAIKU ;
case linux : HOST_DEFINES += HAIKU_HOST_PLATFORM_LINUX ;
case freebsd : HOST_DEFINES += HAIKU_HOST_PLATFORM_FREEBSD ;
case darwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_DARWIN ;
case cygwin : HOST_DEFINES += HAIKU_HOST_PLATFORM_CYGWIN ;
case sunos : HOST_DEFINES += HAIKU_HOST_PLATFORM_SUNOS ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
}
#pragma mark -
# In case we build for a BeOS compatible platform, but not for Haiku, we
# include the HaikuBuildCompatibility.h header and link against
# libhaikucompat.a.
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) && $(TARGET_PLATFORM_BEOS_COMPATIBLE) {
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
# headers and flags
local compatibilityHeader = -include [ FDirName $(HAIKU_TOP) headers build
HaikuBuildCompatibility.h ] ;
TARGET_CCFLAGS += $(compatibilityHeader) ;
TARGET_C++FLAGS += $(compatibilityHeader) ;
# compatibility library
TARGET_HAIKU_COMPATIBILITY_LIBS = libhaikucompat.a ;
}
# special target libbe_test
if $(TARGET_PLATFORM) = libbe_test {
# headers and flags
TARGET_HDRS +=
[ PublicHeaders $(DOT) app drivers game interface kernel storage
support ]
[ PrivateHeaders $(DOT) ] ;
TARGET_DEFINES += __HAIKU__ ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
TARGET_PRIVATE_SYSTEM_HEADERS =
[ PrivateHeaders $(DOT) system system/arch/$(TARGET_ARCH) ] ;
* Reintroduced third LinkAgainst parameter <mapLibs>, defaulting to true. Library names are now mapped for all targets but "host" (not only for "haiku") -- added one more level of indirection to achieve that. (TARGET_LIBRARY_NAME_MAP -> *_LIBRARY_NAME_MAP_*). * Renamed build/HaikuBuildCompatibility.h to BeOSBuildCompatibility.h (auto-included when compiling something that uses the Be API for platform "host" on anon-BeOS platform), and introduced build/HaikuBuildCompatibility.h, which can be included when compiling something that can be built for both, Haiku and BeOS compatible platforms. * Introduced libhaikucompat.a, a library that adds a few functions existing under Haiku, but not under BeOS. * New rule AddSubDirSupportedPlatforms. * Renamed libopenbeos.so to libbe_haiku.so. * Introduced new target platform "libbe_test", which is basically equivalent to a BeOS compatible host platform target, with the exception, that instead of the host platform's libbe.so a special build of Haiku's libbe.so (libbe_haiku.so (formerly known as libopenbeos.so)) is used. Furthermore Haiku's public app, interface, storage, and support kit headers are used when compiling. This replaces the less nice way in which the test app server and applications for this test environment were built. When building for platform "libbe_test", the library name "be" is autotranslated to "libbe_haiku.so". Thus most applications don't need special fiddling when them building them for the app server test environment; usually an "AddSubDirSupportedPlatforms libbe_test ;" will suffice. * Reduced the dependencies of <syscalls.h> and fixed problems caused by this (e.g. source files not including the needed headers directly). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-07 19:07:25 +03:00
# directories
TARGET_OBJECT_BASE_DIR
= [ FDirName $(HAIKU_OBJECT_DIR) $(TARGET_PLATFORM) ] ;
TARGET_COMMON_ARCH_OBJECT_DIR
= [ FDirName $(TARGET_OBJECT_BASE_DIR) common ] ;
TARGET_ARCH_OBJECT_DIR
= [ FDirName $(TARGET_OBJECT_BASE_DIR) $(TARGET_ARCH) ] ;
TARGET_COMMON_DEBUG_OBJECT_DIR
= [ FDirName $(TARGET_ARCH_OBJECT_DIR) common ] ;
TARGET_DEBUG_0_OBJECT_DIR
= [ FDirName $(TARGET_ARCH_OBJECT_DIR) release ] ;
local level ;
for level in $(HAIKU_DEBUG_LEVELS[2-]) {
TARGET_DEBUG_$(level)_OBJECT_DIR
= [ FDirName $(TARGET_ARCH_OBJECT_DIR) debug_$(level) ] ;
}
# library name map
TARGET_LIBRARY_NAME_MAP = LIBBE_LIBRARY_NAME_MAP ;
LIBBE_LIBRARY_NAME_MAP_be = libbe_haiku.so ;
}
#pragma mark -
# common stuff
# start with a clean state
CCFLAGS = ;
C++FLAGS = ;
DEFINES = ;
# Set CC, C++, LINK to invalid values, so that we realize early, that we use
# the wrong compiler.
CC = bad-cc ;
C++ = bad-c++ ;
LINK = bad-link ;
# Allow compiling unit tests on Zeta. Instead of fixing the PostMessage()
# issues, they deprecated that nice function. This will enable it again:
C++FLAGS += -D_ZETA_USING_DEPRECATED_API_=1 ;
# Same for buggy find_directory threadsafety fixes
C++FLAGS += -D_ZETA_TS_FIND_DIR_=1 ;
# TODO: Doesn't really belong here.
# Defaults for warnings, optimization, and debugging.
#
WARNINGS ?= 1 ;
OPTIM ?= -O2 ;
DEBUG ?= 0 ;
# Set the defaults for PLATFORM and SUPPORTED_PLATFORMS. PLATFORM is only
# overridden for targets to be built for the host platform. SUPPORTED_PLATFORMS
# can be overridden by the author of a component.
PLATFORM = $(TARGET_PLATFORM) ;
SUPPORTED_PLATFORMS = haiku ;
# Instructs the Library rule to not make its object files temporary.
# This is needed as some objects are used in a static library and for an
# executable.
KEEPOBJS = true ;
# Set permissions to how they should be on the image.
EXEMODE = 755 ;
FILEMODE = 644 ;
SHELLMODE = 755 ;
# output directories
# TODO: Review this.
HAIKU_DOCUMENTATION_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) documentation ] ;
HAIKU_DOCUMENTATION_OBJECT_DIR ?= [ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR)
documentation ] ;
# TODO: Rethink test stuff.
HAIKU_TEST_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tests
$(TARGET_PLATFORM) $(HAIKU_ARCH) ] ;
HAIKU_APP_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR) apps ] ;
HAIKU_APP_TEST_LIB_DIR ?= [ FDirName $(HAIKU_APP_TEST_DIR) lib ] ;
HAIKU_TMP_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tmp ] ;
HAIKU_PACKAGE_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) packages ] ;
HAIKU_PACKAGE_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) packages ] ;
TARGET_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR)
$(TARGET_PLATFORM) ] ;
TARGET_UNIT_TEST_DIR ?= [ FDirName $(TARGET_TEST_DIR) unittests ] ;
TARGET_UNIT_TEST_LIB_DIR ?= [ FDirName $(TARGET_UNIT_TEST_DIR) lib ] ;
# automatically setup the objects directory per subdirectory
SUBDIRRULES += SetupObjectsDir ;
# Add the standard (userland) warning flags variables to the ones restored in
# every subdirectory. Thus we can easily meddle with them in subdirectories
# with imported sources.
AUTO_SET_UP_CONFIG_VARIABLES +=
HOST_WARNING_CCFLAGS HOST_WARNING_C++FLAGS
TARGET_WARNING_CCFLAGS TARGET_WARNING_C++FLAGS
# also add PLATFORM and SUPPORTED_PLATFORMS
PLATFORM SUPPORTED_PLATFORMS
;
# enable -Werror for certain parts of the source tree
if $(HAIKU_GCC_VERSION[1]) = 2 {
rule EnableWerror dirTokens : scope {
AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) : -Werror
: $(scope) ;
AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) : -Werror
: $(scope) ;
}
} else {
# -Wuninitialized gives too many false positives.
rule EnableWerror dirTokens : scope {
AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens)
: -Werror -Wno-error=uninitialized : $(scope) ;
AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens)
: -Werror -Wno-error=uninitialized : $(scope) ;
}
}
# Work-around for GCC 2 problem -- despite -Wno-multichar it reports
# multichar warnings in headers/private/kernel/debugger_keymaps.h included by
# src/system/kernel/arch/x86/arch_debug_console.c.
if $(HAIKU_GCC_VERSION[1]) = 2 {
local file = <src!system!kernel!arch!x86>arch_debug_console.o ;
CCFLAGS on $(file) = [ on $(file) return $(CCFLAGS) ] ;
}
EnableWerror src kits app ;
EnableWerror src kits interface ;
EnableWerror src kits storage ;
EnableWerror src kits support ;
EnableWerror src system kernel ;
EnableWerror src add-ons kernel file_systems bfs ;
EnableWerror src add-ons kernel file_systems userlandfs ;