[project @ 2002-07-06 10:14:31 by chak]
[ghc-hetmet.git] / ghc / compiler / main / DriverPhases.hs
index cfe1b3e..0871562 100644 (file)
@@ -1,9 +1,9 @@
 -----------------------------------------------------------------------------
--- $Id: DriverPhases.hs,v 1.13 2001/10/26 00:53:27 sof Exp $
+-- $Id: DriverPhases.hs,v 1.21 2002/07/05 20:30:38 sof Exp $
 --
 -- GHC Driver
 --
--- (c) Simon Marlow 2000
+-- (c) The University of Glasgow 2002
 --
 -----------------------------------------------------------------------------
 
@@ -16,8 +16,11 @@ module DriverPhases (
 
    haskellish_file, haskellish_suffix,
    haskellish_src_file, haskellish_src_suffix,
+   hsbootish_file, hsbootish_suffix,
    objish_file, objish_suffix,
-   cish_file, cish_suffix
+   cish_file, cish_suffix,
+   isExtCore_file, extcoreish_suffix,
+   isSourceFile         -- :: FilePath -> Bool
  ) where
 
 import DriverUtil
@@ -42,7 +45,8 @@ data Phase
        | Unlit
        | Cpp
        | HsPp
-       | Hsc -- ToDo: HscTargetLang
+       | Hsc
+       | HsBoot
        | Cc
        | HCc           -- Haskellised C (as opposed to vanilla C) compilation
        | Mangle        -- assembly mangling, now done by a separate script.
@@ -62,8 +66,14 @@ startPhase "lhs"   = Unlit
 startPhase "hs"    = Cpp
 startPhase "hscpp" = HsPp
 startPhase "hspp"  = Hsc
+startPhase "hcr"   = Hsc
+startPhase "hs-boot" = HsBoot
 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
@@ -84,14 +94,17 @@ phaseInputExt As          = "s"
 phaseInputExt SplitAs     = "split_s"   -- not really generated
 phaseInputExt Ln          = "o"
 phaseInputExt MkDependHS  = "dep"
+phaseInputExt HsBoot      = "hs-boot"
 #ifdef ILX
 phaseInputExt Ilx2Il      = "ilx"
 phaseInputExt Ilasm       = "il"
 #endif
 
-haskellish_suffix     = (`elem` [ "hs", "hspp", "hscpp", "lhs", "hc", "raw_s" ])
-haskellish_src_suffix = (`elem` [ "hs", "hspp", "hscpp", "lhs" ])
-cish_suffix           = (`elem` [ "c", "s", "S" ])  -- maybe .cc et al.??
+haskellish_suffix     = (`elem` [ "hs", "lhs", "hspp", "hscpp", "hcr", "hc", "raw_s" ])
+haskellish_src_suffix = (`elem` [ "hs", "lhs", "hspp", "hscpp", "hcr"])
+cish_suffix           = (`elem` [ "c", "cpp", "C", "cc", "cxx", "s", "S" ])
+hsbootish_suffix      = (`elem` [ "hs-boot" ])
+extcoreish_suffix     = (`elem` [ "hcr" ])
 
 #if mingw32_TARGET_OS || cygwin32_TARGET_OS
 objish_suffix     = (`elem` [ "o", "O", "obj", "OBJ" ])
@@ -103,3 +116,11 @@ haskellish_file     = haskellish_suffix     . getFileSuffix
 haskellish_src_file = haskellish_src_suffix . getFileSuffix
 cish_file           = cish_suffix           . getFileSuffix
 objish_file         = objish_suffix         . getFileSuffix
+hsbootish_file      = hsbootish_suffix      . getFileSuffix
+
+isExtCore_file      = extcoreish_suffix     . getFileSuffix
+
+isSourceFile :: FilePath -> Bool
+isSourceFile   f    =
+   haskellish_file f ||
+   cish_file   f