[project @ 2001-10-29 11:31:51 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / DriverPhases.hs
index bd1b176..4b6687c 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverPhases.hs,v 1.6 2001/02/27 15:25:18 simonmar Exp $
+-- $Id: DriverPhases.hs,v 1.14 2001/10/29 11:31:51 simonmar Exp $
 --
 -- GHC Driver
 --
@@ -7,12 +7,15 @@
 --
 -----------------------------------------------------------------------------
 
+#include "../includes/config.h"
+
 module DriverPhases (
    Phase(..),
    startPhase,         -- :: String -> Phase
    phaseInputExt,      -- :: Phase -> String
 
    haskellish_file, haskellish_suffix,
+   haskellish_src_file, haskellish_src_suffix,
    objish_file, objish_suffix,
    cish_file, cish_suffix
  ) where
@@ -38,26 +41,33 @@ data Phase
        = MkDependHS    -- haskell dependency generation
        | Unlit
        | Cpp
-       | Hsc
+       | HsPp
+       | Hsc -- ToDo: HscTargetLang
        | Cc
        | HCc           -- Haskellised C (as opposed to vanilla C) compilation
-#ifdef ILX
-       | Ilx           -- .NET extended IL
-#endif
        | Mangle        -- assembly mangling, now done by a separate script.
        | SplitMangle   -- after mangler if splitting
        | SplitAs
        | As
-       | Ln 
+       | 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
@@ -68,21 +78,24 @@ startPhase _       = Ln        -- all unknown file types
 -- the input requirements of the next phase.
 phaseInputExt Unlit       = "lhs"
 phaseInputExt Cpp         = "lpp"      -- intermediate only
+phaseInputExt HsPp        = "hscpp"
 phaseInputExt Hsc         = "hspp"
 phaseInputExt HCc         = "hc"
 phaseInputExt Cc          = "c"
-#ifdef ILX
-phaseInputExt Ilx         = "ilx"
-#endif
 phaseInputExt Mangle      = "raw_s"
 phaseInputExt SplitMangle = "split_s"  -- not really generated
 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", "hspp", "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" ])
 
 #if mingw32_TARGET_OS || cygwin32_TARGET_OS
 objish_suffix     = (`elem` [ "o", "O", "obj", "OBJ" ])
@@ -90,6 +103,7 @@ objish_suffix     = (`elem` [ "o", "O", "obj", "OBJ" ])
 objish_suffix     = (`elem` [ "o" ])
 #endif
 
-haskellish_file f = haskellish_suffix suf where (_,suf) = splitFilename f
-cish_file       f = cish_suffix       suf where (_,suf) = splitFilename f
-objish_file     f = objish_suffix     suf where (_,suf) = splitFilename f
+haskellish_file     = haskellish_suffix     . getFileSuffix
+haskellish_src_file = haskellish_src_suffix . getFileSuffix
+cish_file           = cish_suffix           . getFileSuffix
+objish_file         = objish_suffix         . getFileSuffix