1 -----------------------------------------------------------------------------
2 -- $Id: DriverPhases.hs,v 1.21 2002/07/05 20:30:38 sof Exp $
6 -- (c) The University of Glasgow 2002
8 -----------------------------------------------------------------------------
10 #include "../includes/config.h"
14 startPhase, -- :: String -> Phase
15 phaseInputExt, -- :: Phase -> String
17 haskellish_file, haskellish_suffix,
18 haskellish_src_file, haskellish_src_suffix,
19 hsbootish_file, hsbootish_suffix,
20 objish_file, objish_suffix,
21 cish_file, cish_suffix,
22 isExtCore_file, extcoreish_suffix,
23 isSourceFile -- :: FilePath -> Bool
28 -----------------------------------------------------------------------------
32 Phase of the | Suffix saying | Flag saying | (suffix of)
33 compilation system | ``start here''| ``stop after''| output file
35 literate pre-processor | .lhs | - | -
36 C pre-processor (opt.) | - | -E | -
37 Haskell compiler | .hs | -C, -S | .hc, .s
38 C compiler (opt.) | .hc or .c | -S | .s
39 assembler | .s or .S | -c | .o
40 linker | other | - | a.out
44 = MkDependHS -- haskell dependency generation
51 | HCc -- Haskellised C (as opposed to vanilla C) compilation
52 | Mangle -- assembly mangling, now done by a separate script.
53 | SplitMangle -- after mangler if splitting
63 -- the first compilation phase for a given file is determined
65 startPhase "lhs" = Unlit
67 startPhase "hscpp" = HsPp
68 startPhase "hspp" = Hsc
69 startPhase "hcr" = Hsc
70 startPhase "hs-boot" = HsBoot
77 startPhase "raw_s" = Mangle
81 startPhase _ = Ln -- all unknown file types
83 -- the output suffix for a given phase is uniquely determined by
84 -- the input requirements of the next phase.
85 phaseInputExt Unlit = "lhs"
86 phaseInputExt Cpp = "lpp" -- intermediate only
87 phaseInputExt HsPp = "hscpp"
88 phaseInputExt Hsc = "hspp"
89 phaseInputExt HCc = "hc"
90 phaseInputExt Cc = "c"
91 phaseInputExt Mangle = "raw_s"
92 phaseInputExt SplitMangle = "split_s" -- not really generated
93 phaseInputExt As = "s"
94 phaseInputExt SplitAs = "split_s" -- not really generated
95 phaseInputExt Ln = "o"
96 phaseInputExt MkDependHS = "dep"
97 phaseInputExt HsBoot = "hs-boot"
99 phaseInputExt Ilx2Il = "ilx"
100 phaseInputExt Ilasm = "il"
103 haskellish_suffix = (`elem` [ "hs", "lhs", "hspp", "hscpp", "hcr", "hc", "raw_s" ])
104 haskellish_src_suffix = (`elem` [ "hs", "lhs", "hspp", "hscpp", "hcr"])
105 cish_suffix = (`elem` [ "c", "cpp", "C", "cc", "cxx", "s", "S" ])
106 hsbootish_suffix = (`elem` [ "hs-boot" ])
107 extcoreish_suffix = (`elem` [ "hcr" ])
109 #if mingw32_TARGET_OS || cygwin32_TARGET_OS
110 objish_suffix = (`elem` [ "o", "O", "obj", "OBJ" ])
112 objish_suffix = (`elem` [ "o" ])
115 haskellish_file = haskellish_suffix . getFileSuffix
116 haskellish_src_file = haskellish_src_suffix . getFileSuffix
117 cish_file = cish_suffix . getFileSuffix
118 objish_file = objish_suffix . getFileSuffix
119 hsbootish_file = hsbootish_suffix . getFileSuffix
121 isExtCore_file = extcoreish_suffix . getFileSuffix
123 isSourceFile :: FilePath -> Bool