[project @ 2001-02-27 15:25:18 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / DriverPhases.hs
index 6bf8ad2..bd1b176 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.6 2001/02/27 15:25:18 simonmar Exp $
 --
 -- GHC Driver
 --
@@ -12,10 +12,9 @@ module DriverPhases (
    startPhase,         -- :: String -> Phase
    phaseInputExt,      -- :: Phase -> String
 
-   haskellish_file,
-   haskellish_suffix,
-   cish_file,
-   cish_suffix
+   haskellish_file, haskellish_suffix,
+   objish_file, objish_suffix,
+   cish_file, cish_suffix
  ) where
 
 import DriverUtil
@@ -42,32 +41,39 @@ data Phase
        | Hsc
        | 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 
-  deriving (Eq)
+  deriving (Eq, Show)
 
 -- the first compilation phase for a given file is determined
 -- by its suffix.
 startPhase "lhs"   = Unlit
 startPhase "hs"    = Cpp
+startPhase "hspp"  = Hsc
 startPhase "hc"    = HCc
 startPhase "c"     = 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 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"
@@ -75,9 +81,15 @@ phaseInputExt SplitAs     = "split_s"   -- not really generated
 phaseInputExt Ln          = "o"
 phaseInputExt MkDependHS  = "dep"
 
-haskellish_suffix = (`elem` [ "hs", "lhs", "hc" ])
+haskellish_suffix = (`elem` [ "hs", "hspp", "lhs", "hc" ])
 cish_suffix       = (`elem` [ "c", "s", "S" ])  -- maybe .cc et al.??
 
-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 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