2 -- | A description of the platform we're compiling for.
3 -- Used by the native code generator.
4 -- In the future, this module should be the only one that references
5 -- the evil #defines for each TARGET_ARCH and TARGET_OS
17 #include "HsVersions.h"
20 -- | Contains enough information for the native code generator to emit
21 -- code for this platform.
24 { platformArch :: Arch
28 -- | Architectures that the native code generator knows about.
29 -- TODO: It might be nice to extend these constructors with information
30 -- about what instruction set extensions an architecture might support.
42 -- | Operating systems that the native code generator knows about.
43 -- Having OSUnknown should produce a sensible default, but no promises.
53 -- | This is the target platform as far as the #ifdefs are concerned.
54 -- These are set in includes/ghcplatform.h by the autoconf scripts
55 defaultTargetPlatform :: Platform
57 = Platform defaultTargetArch defaultTargetOS
60 -- | Move the evil TARGET_ARCH #ifdefs into Haskell land.
61 defaultTargetArch :: Arch
63 defaultTargetArch = ArchAlpha
64 #elif i386_TARGET_ARCH
65 defaultTargetArch = ArchX86
66 #elif x86_64_TARGET_ARCH
67 defaultTargetArch = ArchX86_64
68 #elif powerpc_TARGET_ARCH
69 defaultTargetArch = ArchPPC
70 #elif powerpc64_TARGET_ARCH
71 defaultTargetArch = ArchPPC_64
72 #elif sparc_TARGET_ARCH
73 defaultTargetArch = ArchSPARC
75 #error "Platform.buildArch: undefined"
79 -- | Move the evil TARGET_OS #ifdefs into Haskell land.
82 defaultTargetOS = OSLinux
83 #elif darwin_TARGET_OS
84 defaultTargetOS = OSDarwin
85 #elif solaris_TARGET_OS
86 defaultTargetOS = OSSolaris
87 #elif mingw32_TARGET_OS
88 defaultTargetOS = OSMinGW32
90 defaultTargetOS = OSUnknown