[project @ 2003-05-21 02:48:56 by igloo]
[ghc-hetmet.git] / ghc / compiler / main / DriverPhases.hs
index f212947..e85bbe7 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverPhases.hs,v 1.15 2002/01/04 16:02:04 simonmar Exp $
+-- $Id: DriverPhases.hs,v 1.23 2003/02/24 12:39:27 simonpj Exp $
 --
 -- GHC Driver
 --
@@ -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
@@ -43,6 +46,7 @@ data Phase
        | Cpp
        | HsPp
        | Hsc
+       | HsBoot
        | Cc
        | HCc           -- Haskellised C (as opposed to vanilla C) compilation
        | Mangle        -- assembly mangling, now done by a separate script.
@@ -62,6 +66,8 @@ 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
@@ -88,15 +94,20 @@ 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" ])
+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" ])
 
+-- Use the appropriate suffix for the system on which 
+-- the GHC-compiled code will run
 #if mingw32_TARGET_OS || cygwin32_TARGET_OS
 objish_suffix     = (`elem` [ "o", "O", "obj", "OBJ" ])
 #else
@@ -107,3 +118,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