[project @ 2001-03-27 10:33:24 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / DriverPhases.hs
index b6c213c..639668a 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverPhases.hs,v 1.2 2000/11/13 14:34:37 sewardj Exp $
+-- $Id: DriverPhases.hs,v 1.7 2001/03/13 12:50:31 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
@@ -39,7 +38,7 @@ data Phase
        = MkDependHS    -- haskell dependency generation
        | Unlit
        | Cpp
-       | Hsc
+       | Hsc -- ToDo: HscTargetLang
        | Cc
        | HCc           -- Haskellised C (as opposed to vanilla C) compilation
        | Mangle        -- assembly mangling, now done by a separate script.
@@ -47,13 +46,13 @@ data Phase
        | 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       -- not sure this will work ...
+startPhase "hspp"  = Hsc
 startPhase "hc"    = HCc
 startPhase "c"     = Cc
 startPhase "raw_s" = Mangle
@@ -66,7 +65,7 @@ startPhase _       = Ln          -- all unknown file types
 -- the input requirements of the next phase.
 phaseInputExt Unlit       = "lhs"
 phaseInputExt Cpp         = "lpp"      -- intermediate only
-phaseInputExt Hsc         = "hspp"     -- intermediate only
+phaseInputExt Hsc         = "hspp"
 phaseInputExt HCc         = "hc"
 phaseInputExt Cc          = "c"
 phaseInputExt Mangle      = "raw_s"
@@ -76,9 +75,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