julun+mauricek:

* add cygwin specific options.
   * Cygwin cannot handle -fPIC option and throws warnings, thus we only use it on non windows platforms for the host tools.
   * Windows uses PATH instead of LD_LIBRARY_PATH, so before calling a host tool this environment variable needs to be expanded... Brilliant...
   * Using jam on Windows is kind of complicated, as the cygwin included gcc creates executables with a .exe extension. When jam parses dependencies for being up to date it ignores this extension again and tries to rebuild the executables again and again. This hack removes the extension after successful linking. Though jam has a SUFEXE variable for cygwin builds, we cannot use this one directly as crosscompiled targets do not have an extension, it is complicated to use the same jam for both platforms. A more clean attempt would be to check for the extension on each host target depending on the platform. This should be fixed later on.
   * Btw. Say hello to Haiku compiling successfully on Windows :) with one patch to be discussed for jam...

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26590 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Maurice Kalinowski
2008-07-23 22:20:37 +00:00
parent 39fd631a39
commit ba97f78287
2 changed files with 39 additions and 6 deletions
+19 -6
View File
@@ -465,16 +465,20 @@ HOST_UNARFLAGS ?= x ;
# check the host platform compatibility
SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host
: linux freebsd darwin sunos ;
: linux freebsd darwin sunos cygwin ;
if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd
|| $(HOST_PLATFORM) = darwin {
|| $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = cygwin {
# 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) ;
@@ -506,8 +510,10 @@ HOST_ASFLAGS = ;
HOST_CCFLAGS += -Wno-multichar ;
HOST_C++FLAGS += -Wno-multichar ;
HOST_PIC_CCFLAGS += -fPIC ;
HOST_PIC_C++FLAGS += -fPIC ;
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 ;
@@ -613,8 +619,13 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) {
HOST_LIBROOT = libroot_build.so ;
HOST_STATIC_LIBROOT = libroot_build.a ;
HOST_LIBBE = libbe_build.so ;
HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR
= "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ;
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 {
@@ -829,6 +840,7 @@ switch $(TARGET_PLATFORM) {
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 libbe_test : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_LIBBE_TEST ;
}
@@ -841,6 +853,7 @@ switch $(HOST_PLATFORM) {
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 ;
}
+20
View File
@@ -535,6 +535,14 @@ rule BuildPlatformObjects
Objects $(sources) ;
}
actions CygwinExtensionFix
{
if test -f $(1).exe ; then
rm -f $(1)
mv $(1).exe $(1)
fi
}
rule BuildPlatformMain
{
# Usage BuildPlatformMain <target> : <sources> : <libraries> ;
@@ -566,6 +574,15 @@ rule BuildPlatformMain
Main $(target) : $(sources) ;
LinkAgainst $(target) : $(libs) ;
if $(HOST_PLATFORM) = cygwin {
# Cygwin gcc adds the ".exe" extension. We cannot force
# jam to use SUFEXE as haiku target executables are not
# supposed to have this extension, thus finding
# dependencies will fail for these.
# The hack is to remove the extension after a successful
# build of the Target.
CygwinExtensionFix $(target) ;
}
}
rule BuildPlatformSharedLibrary
@@ -584,6 +601,9 @@ rule BuildPlatformSharedLibrary
if $(HOST_PLATFORM) = darwin {
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
-dynamic -dynamiclib -Xlinker -flat_namespace ;
} else if $(HOST_PLATFORM) = cygwin {
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
-shared -Xlinker --allow-multiple-definition ;
} else {
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
-shared -Xlinker -soname=\"$(target:G=)\" ;