X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FPlatform.hs;h=7b2502d96e104662a3bbe04662a90f51f9f40168;hb=ac51be0997c4d0cf65cb3635b936ddf011e372bd;hp=8b01f5cbb3acc8a8f9642731852829d79101200c;hpb=b04a210e26ca57242fd052f2aa91011a80b76299;p=ghc-hetmet.git diff --git a/compiler/nativeGen/Platform.hs b/compiler/nativeGen/Platform.hs index 8b01f5c..7b2502d 100644 --- a/compiler/nativeGen/Platform.hs +++ b/compiler/nativeGen/Platform.hs @@ -9,7 +9,8 @@ module Platform ( Arch(..), OS(..), - defaultTargetPlatform + defaultTargetPlatform, + osElfTarget ) where @@ -30,8 +31,7 @@ data Platform -- about what instruction set extensions an architecture might support. -- data Arch - = ArchAlpha - | ArchX86 + = ArchX86 | ArchX86_64 | ArchPPC | ArchPPC_64 @@ -45,11 +45,21 @@ data OS = OSUnknown | OSLinux | OSDarwin - | OSSolaris + | OSSolaris2 | OSMinGW32 + | OSFreeBSD + | OSOpenBSD deriving (Show, Eq) +-- | This predicates tells us whether the OS supports ELF-like shared libraries. +osElfTarget :: OS -> Bool +osElfTarget OSLinux = True +osElfTarget OSFreeBSD = True +osElfTarget OSOpenBSD = True +osElfTarget OSSolaris2 = True +osElfTarget _ = False + -- | This is the target platform as far as the #ifdefs are concerned. -- These are set in includes/ghcplatform.h by the autoconf scripts defaultTargetPlatform :: Platform @@ -59,9 +69,7 @@ defaultTargetPlatform -- | Move the evil TARGET_ARCH #ifdefs into Haskell land. defaultTargetArch :: Arch -#if alpha_TARGET_ARCH -defaultTargetArch = ArchAlpha -#elif i386_TARGET_ARCH +#if i386_TARGET_ARCH defaultTargetArch = ArchX86 #elif x86_64_TARGET_ARCH defaultTargetArch = ArchX86_64 @@ -82,10 +90,14 @@ defaultTargetOS :: OS defaultTargetOS = OSLinux #elif darwin_TARGET_OS defaultTargetOS = OSDarwin -#elif solaris_TARGET_OS -defaultTargetOS = OSSolaris +#elif solaris2_TARGET_OS +defaultTargetOS = OSSolaris2 #elif mingw32_TARGET_OS defaultTargetOS = OSMinGW32 +#elif freebsd_TARGET_OS +defaultTargetOS = OSFreeBSD +#elif openbsd_TARGET_OS +defaultTargetOS = OSOpenBSD #else defaultTargetOS = OSUnknown #endif