[project @ 2001-11-03 01:30:42 by sof]
[ghc-hetmet.git] / ghc / compiler / main / DriverPhases.hs
index 6bf8ad2..4b6687c 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverPhases.hs,v 1.1 2000/10/16 15:16:59 simonmar Exp $
+-- $Id: DriverPhases.hs,v 1.14 2001/10/29 11:31:51 simonmar Exp $
 --
 -- GHC Driver
 --
@@ -7,15 +7,17 @@
 --
 -----------------------------------------------------------------------------
 
+#include "../includes/config.h"
+
 module DriverPhases (
    Phase(..),
    startPhase,         -- :: String -> Phase
    phaseInputExt,      -- :: Phase -> String
 
-   haskellish_file,
-   haskellish_suffix,
-   cish_file,
-   cish_suffix
+   haskellish_file, haskellish_suffix,
+   haskellish_src_file, haskellish_src_suffix,
+   objish_file, objish_suffix,
+   cish_file, cish_suffix
  ) where
 
 import DriverUtil
@@ -39,33 +41,45 @@ data Phase
        = MkDependHS    -- haskell dependency generation
        | Unlit
        | Cpp
-       | Hsc
+       | HsPp
+       | Hsc -- ToDo: HscTargetLang
        | Cc
        | HCc           -- Haskellised C (as opposed to vanilla C) compilation
        | Mangle        -- assembly mangling, now done by a separate script.
        | SplitMangle   -- after mangler if splitting
        | SplitAs
        | As
-       | Ln 
-  deriving (Eq)
+       | Ln
+#ifdef ILX
+        | Ilx2Il
+       | Ilasm
+#endif
+  deriving (Eq, Show)
 
 -- the first compilation phase for a given file is determined
 -- by its suffix.
 startPhase "lhs"   = Unlit
 startPhase "hs"    = Cpp
+startPhase "hscpp" = HsPp
+startPhase "hspp"  = Hsc
 startPhase "hc"    = HCc
 startPhase "c"     = Cc
+startPhase "cpp"   = Cc
+startPhase "C"     = Cc
+startPhase "cc"    = Cc
+startPhase "cxx"   = Cc
 startPhase "raw_s" = Mangle
 startPhase "s"     = As
 startPhase "S"     = As
-startPhase "o"     = Ln     
+startPhase "o"     = Ln
 startPhase _       = Ln           -- all unknown file types
 
 -- the output suffix for a given phase is uniquely determined by
 -- the input requirements of the next phase.
 phaseInputExt Unlit       = "lhs"
 phaseInputExt Cpp         = "lpp"      -- intermediate only
-phaseInputExt Hsc         = "cpp"      -- intermediate only
+phaseInputExt HsPp        = "hscpp"
+phaseInputExt Hsc         = "hspp"
 phaseInputExt HCc         = "hc"
 phaseInputExt Cc          = "c"
 phaseInputExt Mangle      = "raw_s"
@@ -74,10 +88,22 @@ phaseInputExt As          = "s"
 phaseInputExt SplitAs     = "split_s"   -- not really generated
 phaseInputExt Ln          = "o"
 phaseInputExt MkDependHS  = "dep"
+#ifdef ILX
+phaseInputExt Ilx2Il      = "ilx"
+phaseInputExt Ilasm       = "il"
+#endif
 
-haskellish_suffix = (`elem` [ "hs", "lhs", "hc" ])
-cish_suffix       = (`elem` [ "c", "s", "S" ])  -- maybe .cc et al.??
+haskellish_suffix     = (`elem` [ "hs", "hspp", "hscpp", "lhs", "hc", "raw_s" ])
+haskellish_src_suffix = (`elem` [ "hs", "hspp", "hscpp", "lhs" ])
+cish_suffix           = (`elem` [ "c", "cpp", "C", "cc", "cxx", "s", "S" ])
 
-haskellish_file f = haskellish_suffix suf where (_,suf) = splitFilename f
-cish_file f       = cish_suffix suf       where (_,suf) = splitFilename f
+#if mingw32_TARGET_OS || cygwin32_TARGET_OS
+objish_suffix     = (`elem` [ "o", "O", "obj", "OBJ" ])
+#else
+objish_suffix     = (`elem` [ "o" ])
+#endif
 
+haskellish_file     = haskellish_suffix     . getFileSuffix
+haskellish_src_file = haskellish_src_suffix . getFileSuffix
+cish_file           = cish_suffix           . getFileSuffix
+objish_file         = objish_suffix         . getFileSuffix