Patch by Samuel Rodriguez Perez, slightly modified by myself: New
configure flag "--use-32bit" enabling 32 bit builds with a 64 bit host compiler. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22046 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+20
-8
@@ -346,6 +346,12 @@ HAIKU_BUILD_DESCRIPTION ?= "Unknown Build" ;
|
||||
|
||||
# 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) ;
|
||||
@@ -355,13 +361,14 @@ HOST_LD ?= ld ; # TODO: Fix this!
|
||||
HOST_OBJCOPY ?= objcopy ; #
|
||||
HOST_RANLIB ?= $(RANLIB) ;
|
||||
HOST_CPPFLAGS ?= $(CPPFLAGS) ;
|
||||
HOST_CCFLAGS ?= $(CCFLAGS) ;
|
||||
HOST_C++FLAGS ?= $(C++FLAGS) ;
|
||||
HOST_LDFLAGS ?= $(LDFLAGS) ;
|
||||
HOST_LINKFLAGS ?= $(LINKFLAGS) ;
|
||||
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-]) ;
|
||||
@@ -415,10 +422,10 @@ HOST_C++FLAGS += -Wno-multichar ;
|
||||
HOST_PIC_CCFLAGS += -fPIC ;
|
||||
HOST_PIC_C++FLAGS += -fPIC ;
|
||||
|
||||
HOST_KERNEL_CCFLAGS += -finline -fno-builtin
|
||||
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
|
||||
HOST_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions
|
||||
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 ;
|
||||
|
||||
HOST_KERNEL_PIC_CCFLAGS = -fno-pic ;
|
||||
HOST_KERNEL_PIC_LINKFLAGS = ;
|
||||
@@ -465,6 +472,11 @@ for level in $(HAIKU_DEBUG_LEVELS[2-]) {
|
||||
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 = ;
|
||||
|
||||
@@ -517,7 +529,7 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
|
||||
} else if $(HOST_PLATFORM) = darwin {
|
||||
HOST_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.
|
||||
|
||||
+19
-17
@@ -2,7 +2,7 @@
|
||||
rule AddSharedObjectGlueCode
|
||||
{
|
||||
# AddSharedObjectGlueCode <target> : <isExecutable> ;
|
||||
|
||||
|
||||
# we link with -nostdlib and add the required libs manually, when building
|
||||
# for Haiku
|
||||
local platform ;
|
||||
@@ -94,7 +94,7 @@ rule Preference
|
||||
rule Server
|
||||
{
|
||||
# Server <name> : <sources> : <libraries> : <res> ;
|
||||
|
||||
|
||||
Executable $(1) : $(2) : $(3) : $(4) ;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ rule StaticLibrary
|
||||
# <lib>: The static library to be built.
|
||||
# <sources>: List of source files.
|
||||
# <otherObjects>: List of additional object files.
|
||||
#
|
||||
#
|
||||
local lib = $(1) ;
|
||||
local sources = [ FGristFiles $(2) ] ;
|
||||
local otherObjects = $(3) ;
|
||||
@@ -192,12 +192,12 @@ rule Ld
|
||||
NEEDLIBS on $(target) = $(NEEDLIBS) ;
|
||||
LINKLIBS on $(target) = $(LINKLIBS) ;
|
||||
}
|
||||
|
||||
|
||||
LocalClean clean : $(target) ;
|
||||
LocalDepends all : $(target) ;
|
||||
Depends $(target) : $(objects) ;
|
||||
|
||||
MakeLocateDebug $(target) ;
|
||||
MakeLocateDebug $(target) ;
|
||||
}
|
||||
|
||||
actions Ld
|
||||
@@ -224,8 +224,10 @@ rule MergeObjectFromObjects
|
||||
|
||||
if $(PLATFORM) = host {
|
||||
LINK on $(1) = $(HOST_LD) ;
|
||||
LINKFLAGS on $(target) = $(HOST_LDFLAGS) ;
|
||||
} else {
|
||||
LINK on $(1) = $(TARGET_LD) ;
|
||||
LINKFLAGS on $(target) = $(TARGET_LDFLAGS) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +240,7 @@ rule MergeObjectFromObjects
|
||||
|
||||
actions MergeObjectFromObjects1
|
||||
{
|
||||
$(LINK) -r $(2) -o $(1) ;
|
||||
$(LINK) $(LINKFLAGS) -r $(2) -o $(1) ;
|
||||
}
|
||||
|
||||
rule MergeObject
|
||||
@@ -362,7 +364,7 @@ rule LinkAgainst
|
||||
linkLibs += $(i) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NEEDLIBS on $(1) = $(NEEDLIBS) $(needLibs) ;
|
||||
LINKLIBS on $(1) = $(LINKLIBS) -l$(linkLibs) ;
|
||||
|
||||
@@ -403,10 +405,10 @@ rule BuildPlatformObjects
|
||||
{
|
||||
# Usage BuildPlatformObjects <sources> ;
|
||||
# <sources> The sources.
|
||||
#
|
||||
#
|
||||
local sources = [ FGristFiles $(1) ] ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
|
||||
PLATFORM on $(objects) = host ;
|
||||
SUPPORTED_PLATFORMS on $(objects) = host ;
|
||||
|
||||
@@ -419,7 +421,7 @@ rule BuildPlatformMain
|
||||
# <target> The executable/library.
|
||||
# <sources> The sources.
|
||||
# <libraries> Libraries to link against.
|
||||
#
|
||||
#
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local libs = $(3) ;
|
||||
@@ -440,7 +442,7 @@ rule BuildPlatformMain
|
||||
NEEDLIBS on $(target) += $(HOST_LIBROOT) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Main $(target) : $(sources) ;
|
||||
LinkAgainst $(target) : $(libs) ;
|
||||
}
|
||||
@@ -455,7 +457,7 @@ rule BuildPlatformSharedLibrary
|
||||
local target = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local libs = $(3) ;
|
||||
|
||||
|
||||
BuildPlatformMain $(target) : $(sources) : $(libs) ;
|
||||
|
||||
if $(HOST_PLATFORM) = darwin {
|
||||
@@ -467,8 +469,8 @@ rule BuildPlatformSharedLibrary
|
||||
}
|
||||
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
CCFLAGS on $(objects) += $(HOST_PIC_CCFLAGS) ;
|
||||
C++FLAGS on $(objects) += $(HOST_PIC_C++FLAGS) ;
|
||||
CCFLAGS on $(objects) += $(HOST_PIC_CCFLAGS) ;
|
||||
C++FLAGS on $(objects) += $(HOST_PIC_C++FLAGS) ;
|
||||
}
|
||||
|
||||
rule BuildPlatformMergeObject
|
||||
@@ -484,7 +486,7 @@ rule BuildPlatformMergeObject
|
||||
local sources = $(2) ;
|
||||
local otherObjects = $(3) ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
|
||||
PLATFORM on $(target) = host ;
|
||||
SUPPORTED_PLATFORMS on $(target) = host ;
|
||||
|
||||
@@ -520,11 +522,11 @@ rule BuildPlatformStaticLibrary
|
||||
# Creates a static library from sources.
|
||||
# <lib>: The library.
|
||||
# <sources>: List of source files.
|
||||
|
||||
|
||||
local lib = $(1) ;
|
||||
local sources = $(2) ;
|
||||
local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ;
|
||||
|
||||
|
||||
PLATFORM on $(lib) = host ;
|
||||
SUPPORTED_PLATFORMS on $(lib) = host ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user