From 4a9059fb38fc8568f94b6eb2635ded2fee19ee45 Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Sat, 16 Jun 2007 19:43:53 +0000 Subject: [PATCH] some make system work to get x86-64 linux compiles working: -The biggest problem with linking host libraries (libbe_build and libroot_build) was not having the source files compiled with the -fPIC flag. As far as I can tell, we want to do this on all of the other host platforms as well, so hacked the jam files a bit to add it. Forgive me if I've committed more Jamfile sins. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21423 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/BuildSetup | 3 +++ build/jam/MainBuildRules | 28 +++++++++++++++++++++++++++- src/build/libbe/app/Jamfile | 2 +- src/build/libbe/interface/Jamfile | 2 +- src/build/libbe/storage/Jamfile | 2 +- src/build/libbe/support/Jamfile | 2 +- 6 files changed, 34 insertions(+), 5 deletions(-) diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index 6c797b74c5..28af1eadeb 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -387,6 +387,9 @@ HOST_ASFLAGS = ; HOST_CCFLAGS += -Wno-multichar ; 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 diff --git a/build/jam/MainBuildRules b/build/jam/MainBuildRules index 25cfe2cba6..6a16ae79d4 100644 --- a/build/jam/MainBuildRules +++ b/build/jam/MainBuildRules @@ -465,6 +465,10 @@ rule BuildPlatformSharedLibrary LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ] -shared -Xlinker -soname=\"$(target:G=)\" ; } + + local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ; + CCFLAGS on $(objects) += $(HOST_PIC_CCFLAGS) ; + C++FLAGS on $(objects) += $(HOST_PIC_C++FLAGS) ; } rule BuildPlatformMergeObject @@ -489,10 +493,32 @@ rule BuildPlatformMergeObject # propagate the flag to the objects USES_BE_API on $(objects) = $(usesBeAPI) ; } - + MergeObject $(target) : $(sources) : $(otherObjects) ; } +rule BuildPlatformMergeObjectPIC +{ + # BuildPlatformMergeObjectPIC : : ; + # Compiles source files and merges the object files to an object file. + # Same as BuildPlatformMergeObject rule but adds position-independent + # flags to the compiler (if any). + # : Name of the object file to create. No grist will be added. + # : Sources to be compiled. Grist will be added. + # : Object files or static libraries to be merged. No grist + # will be added. + # + local target = $(1) ; + local sources = $(2) ; + local otherObjects = $(3) ; + + local objects = [ FGristFiles $(sources:S=$(SUFOBJ)) ] ; + CCFLAGS on $(objects) += $(HOST_PIC_CCFLAGS) ; + C++FLAGS on $(objects) += $(HOST_PIC_C++FLAGS) ; + + BuildPlatformMergeObject $(target) : $(sources) : $(otherObjects) ; +} + rule BuildPlatformStaticLibrary { # BuildPlatformStaticLibrary : ; diff --git a/src/build/libbe/app/Jamfile b/src/build/libbe/app/Jamfile index 9b73a57603..0e2b22eb2a 100644 --- a/src/build/libbe/app/Jamfile +++ b/src/build/libbe/app/Jamfile @@ -5,7 +5,7 @@ UseHeaders [ FDirName $(HAIKU_TOP) headers build private shared ] : true ; USES_BE_API on app_kit.o = true ; -BuildPlatformMergeObject app_kit.o : +BuildPlatformMergeObjectPIC app_kit.o : Application.cpp AppMisc.cpp Message.cpp diff --git a/src/build/libbe/interface/Jamfile b/src/build/libbe/interface/Jamfile index 839678fedb..4151349619 100644 --- a/src/build/libbe/interface/Jamfile +++ b/src/build/libbe/interface/Jamfile @@ -6,7 +6,7 @@ UseHeaders [ FDirName $(HAIKU_TOP) headers build private shared ] : true ; USES_BE_API on interface_kit.o = true ; -BuildPlatformMergeObject interface_kit.o : +BuildPlatformMergeObjectPIC interface_kit.o : Bitmap.cpp GraphicsDefs.cpp Point.cpp diff --git a/src/build/libbe/storage/Jamfile b/src/build/libbe/storage/Jamfile index 6f4133aa7a..b0e4855ceb 100644 --- a/src/build/libbe/storage/Jamfile +++ b/src/build/libbe/storage/Jamfile @@ -9,7 +9,7 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) mime ] ; USES_BE_API on storage_kit.o = true ; -BuildPlatformMergeObject storage_kit.o : +BuildPlatformMergeObjectPIC storage_kit.o : AppFileInfo.cpp Directory.cpp Entry.cpp diff --git a/src/build/libbe/support/Jamfile b/src/build/libbe/support/Jamfile index c84960c9d9..41dd5e9bf3 100644 --- a/src/build/libbe/support/Jamfile +++ b/src/build/libbe/support/Jamfile @@ -5,7 +5,7 @@ UseHeaders [ FDirName $(HAIKU_TOP) headers build private app ] : true ; USES_BE_API on support_kit.o = true ; -BuildPlatformMergeObject support_kit.o : +BuildPlatformMergeObjectPIC support_kit.o : Archivable.cpp BlockCache.cpp ByteOrder.cpp