fix for compiling the base package with --make
[ghc-hetmet.git] / ghc / compiler / main / DriverPhases.hs
index a16ad32..d1b24b3 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverPhases.hs,v 1.33 2005/01/28 12:55:33 simonmar Exp $
+--  $Id: DriverPhases.hs,v 1.38 2005/05/17 11:01:59 simonmar Exp $
 --
 -- GHC Driver
 --
@@ -9,11 +9,20 @@
 
 module DriverPhases (
    HscSource(..), isHsBoot, hscSourceString,
-   HscTarget(..), Phase(..),
-   happensBefore, eqPhase, anyHsc, isStopPhase,
+   Phase(..),
+   happensBefore, eqPhase, anyHsc, isStopLn,
    startPhase,         -- :: String -> Phase
    phaseInputExt,      -- :: Phase -> String
 
+   isHaskellishSuffix, 
+   isHaskellSrcSuffix,
+   isObjectSuffix,
+   isCishSuffix,
+   isExtCoreSuffix,
+   isDynLibSuffix,
+   isHaskellUserSrcSuffix,
+   isSourceSuffix,
+
    isHaskellishFilename, 
    isHaskellSrcFilename,
    isObjectFilename,
@@ -24,7 +33,7 @@ module DriverPhases (
    isSourceFilename         -- :: FilePath -> Bool
  ) where
 
-import DriverUtil
+import Util            ( suffixOf )
 import Panic           ( panic )
 
 -----------------------------------------------------------------------------
@@ -57,15 +66,6 @@ isHsBoot :: HscSource -> Bool
 isHsBoot HsBootFile = True
 isHsBoot other      = False
 
-data HscTarget
-  = HscC
-  | HscAsm
-  | HscJava
-  | HscILX
-  | HscInterpreted
-  | HscNothing
-  deriving (Eq, Show)
-
 data Phase 
        = Unlit HscSource
        | Cpp   HscSource
@@ -79,26 +79,22 @@ data Phase
        | As
        | CmmCpp        -- pre-process Cmm source
        | Cmm           -- parse & compile Cmm code
-#ifdef ILX
-        | Ilx2Il
-       | Ilasm
-#endif
 
        -- The final phase is a pseudo-phase that tells the pipeline to stop.
        -- There is no runPhase case for it.
        | StopLn        -- Stop, but linking will follow, so generate .o file
-
-  deriving (Show)
+  deriving (Eq, Show)
 
 anyHsc :: Phase
 anyHsc = Hsc (panic "anyHsc")
 
-isStopPhase :: Phase -> Bool
-isStopPhase StopLn = True
-isStopPhase other  = False
+isStopLn :: Phase -> Bool
+isStopLn StopLn = True
+isStopLn other  = False
 
 eqPhase :: Phase -> Phase -> Bool
 -- Equality of constructors, ignoring the HscSource field
+-- NB: the HscSource field can be 'bot'; see anyHsc above
 eqPhase (Unlit _)   (Unlit _)  = True
 eqPhase (Cpp   _)   (Cpp   _)  = True
 eqPhase (HsPp  _)   (HsPp  _)  = True
@@ -210,15 +206,23 @@ dynlib_suffixes = ["dylib"]
 dynlib_suffixes = ["so"]
 #endif
 
-isHaskellishFilename     f = getFileSuffix f `elem` haskellish_suffixes
-isHaskellSrcFilename     f = getFileSuffix f `elem` haskellish_src_suffixes
-isCishFilename           f = getFileSuffix f `elem` cish_suffixes
-isExtCoreFilename        f = getFileSuffix f `elem` extcoreish_suffixes
-isObjectFilename         f = getFileSuffix f `elem` objish_suffixes
-isHaskellUserSrcFilename f = getFileSuffix f `elem` haskellish_user_src_suffixes
-isDynLibFilename        f = getFileSuffix f `elem` dynlib_suffixes
-
-isSourceFilename :: FilePath -> Bool
-isSourceFilename f  =
-   isHaskellishFilename f ||
-   isCishFilename f
+isHaskellishSuffix     s = s `elem` haskellish_suffixes
+isHaskellSrcSuffix     s = s `elem` haskellish_src_suffixes
+isCishSuffix           s = s `elem` cish_suffixes
+isExtCoreSuffix        s = s `elem` extcoreish_suffixes
+isObjectSuffix         s = s `elem` objish_suffixes
+isHaskellUserSrcSuffix s = s `elem` haskellish_user_src_suffixes
+isDynLibSuffix        s = s `elem` dynlib_suffixes
+
+isSourceSuffix suff  = isHaskellishSuffix suff || isCishSuffix suff
+
+isHaskellishFilename     f = isHaskellishSuffix     (suffixOf f)
+isHaskellSrcFilename     f = isHaskellSrcSuffix     (suffixOf f)
+isCishFilename           f = isCishSuffix           (suffixOf f)
+isExtCoreFilename        f = isExtCoreSuffix        (suffixOf f)
+isObjectFilename         f = isObjectSuffix         (suffixOf f)
+isHaskellUserSrcFilename f = isHaskellUserSrcSuffix (suffixOf f)
+isDynLibFilename        f = isDynLibSuffix         (suffixOf f)
+isSourceFilename        f = isSourceSuffix         (suffixOf f)
+
+