X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FDriverPhases.hs;h=e85bbe7ad659d4e7540ca9db5c29960b2d6b3f68;hb=19108ede05d6528d0b66edb2bcf031e8da9522e2;hp=cab7b60d2f5196733769784e43f107887e953b75;hpb=2829e3a6aa04df7da74c04e7784e5412a0d960b7;p=ghc-hetmet.git diff --git a/ghc/compiler/main/DriverPhases.hs b/ghc/compiler/main/DriverPhases.hs index cab7b60..e85bbe7 100644 --- a/ghc/compiler/main/DriverPhases.hs +++ b/ghc/compiler/main/DriverPhases.hs @@ -1,21 +1,26 @@ ----------------------------------------------------------------------------- --- $Id: DriverPhases.hs,v 1.3 2000/11/16 16:23:04 sewardj Exp $ +-- $Id: DriverPhases.hs,v 1.23 2003/02/24 12:39:27 simonpj Exp $ -- -- GHC Driver -- --- (c) Simon Marlow 2000 +-- (c) The University of Glasgow 2002 -- ----------------------------------------------------------------------------- +#include "../includes/config.h" + module DriverPhases ( Phase(..), startPhase, -- :: String -> Phase phaseInputExt, -- :: Phase -> String - haskellish_file, - haskellish_suffix, - cish_file, - cish_suffix + haskellish_file, haskellish_suffix, + haskellish_src_file, haskellish_src_suffix, + hsbootish_file, hsbootish_suffix, + objish_file, objish_suffix, + cish_file, cish_suffix, + isExtCore_file, extcoreish_suffix, + isSourceFile -- :: FilePath -> Bool ) where import DriverUtil @@ -39,23 +44,36 @@ data Phase = MkDependHS -- haskell dependency generation | Unlit | Cpp + | HsPp | Hsc + | HsBoot | Cc | HCc -- Haskellised C (as opposed to vanilla C) compilation | Mangle -- assembly mangling, now done by a separate script. | SplitMangle -- after mangler if splitting | SplitAs | As - | Ln + | Ln +#ifdef ILX + | Ilx2Il + | Ilasm +#endif 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 "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 @@ -66,7 +84,8 @@ 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 HsPp = "hscpp" +phaseInputExt Hsc = "hspp" phaseInputExt HCc = "hc" phaseInputExt Cc = "c" phaseInputExt Mangle = "raw_s" @@ -75,10 +94,35 @@ 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", "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 +objish_suffix = (`elem` [ "o" ]) +#endif -haskellish_suffix = (`elem` [ "hs", "lhs", "hc" ]) -cish_suffix = (`elem` [ "c", "s", "S" ]) -- maybe .cc et al.?? +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 -haskellish_file f = haskellish_suffix suf where (_,suf) = splitFilename f -cish_file f = cish_suffix suf where (_,suf) = splitFilename f +isExtCore_file = extcoreish_suffix . getFileSuffix +isSourceFile :: FilePath -> Bool +isSourceFile f = + haskellish_file f || + cish_file f