-- | A description of the platform we're compiling for.
--- Used by the native code generator.
-- In the future, this module should be the only one that references
-- the evil #defines for each TARGET_ARCH and TARGET_OS
--
OS(..),
defaultTargetPlatform,
+ target32Bit,
osElfTarget
)
where
+import Panic
+
#include "HsVersions.h"
deriving (Show, Eq)
+target32Bit :: Platform -> Bool
+target32Bit p = case platformArch p of
+ ArchUnknown -> panic "Don't know if ArchUnknown is 32bit"
+ ArchX86 -> True
+ ArchX86_64 -> False
+ ArchPPC -> True
+ ArchPPC_64 -> False
+ ArchSPARC -> True
+
+
-- | 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 OSLinux = True
+osElfTarget OSFreeBSD = True
+osElfTarget OSOpenBSD = True
osElfTarget OSSolaris2 = True
-osElfTarget _ = False
+osElfTarget OSDarwin = False
+osElfTarget OSMinGW32 = False
+osElfTarget OSUnknown = panic "Don't know if OSUnknown is elf"
+
-- | This is the target platform as far as the #ifdefs are concerned.
-- These are set in includes/ghcplatform.h by the autoconf scripts