1 -----------------------------------------------------------------------------
2 -- $Id: DriverPhases.hs,v 1.18 2002/04/05 15:18:26 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,
27 -----------------------------------------------------------------------------
31 Phase of the | Suffix saying | Flag saying | (suffix of)
32 compilation system | ``start here''| ``stop after''| output file
34 literate pre-processor | .lhs | - | -
35 C pre-processor (opt.) | - | -E | -
36 Haskell compiler | .hs | -C, -S | .hc, .s
37 C compiler (opt.) | .hc or .c | -S | .s
38 assembler | .s or .S | -c | .o
39 linker | other | - | a.out
43 = MkDependHS -- haskell dependency generation
50 | HCc -- Haskellised C (as opposed to vanilla C) compilation
51 | Mangle -- assembly mangling, now done by a separate script.
52 | SplitMangle -- after mangler if splitting
62 -- the first compilation phase for a given file is determined
64 startPhase "lhs" = Unlit
66 startPhase "hscpp" = HsPp
67 startPhase "hspp" = Hsc
68 startPhase "hcr" = Hsc
69 startPhase "hs-boot" = HsBoot
76 startPhase "raw_s" = Mangle
80 startPhase _ = Ln -- all unknown file types
82 -- the output suffix for a given phase is uniquely determined by
83 -- the input requirements of the next phase.
84 phaseInputExt Unlit = "lhs"
85 phaseInputExt Cpp = "lpp" -- intermediate only
86 phaseInputExt HsPp = "hscpp"
87 phaseInputExt Hsc = "hspp"
88 phaseInputExt HCc = "hc"
89 phaseInputExt Cc = "c"
90 phaseInputExt Mangle = "raw_s"
91 phaseInputExt SplitMangle = "split_s" -- not really generated
92 phaseInputExt As = "s"
93 phaseInputExt SplitAs = "split_s" -- not really generated
94 phaseInputExt Ln = "o"
95 phaseInputExt MkDependHS = "dep"
96 phaseInputExt HsBoot = "hs-boot"
98 phaseInputExt Ilx2Il = "ilx"
99 phaseInputExt Ilasm = "il"
102 haskellish_suffix = (`elem` [ "hs", "lhs", "hspp", "hscpp", "hcr", "hc", "raw_s" ])
103 haskellish_src_suffix = (`elem` [ "hs", "lhs", "hspp", "hscpp", "hcr"])
104 cish_suffix = (`elem` [ "c", "cpp", "C", "cc", "cxx", "s", "S" ])
105 hsbootish_suffix = (`elem` [ "hs-boot" ])
106 extcoreish_suffix = (`elem` [ "hcr" ])
108 #if mingw32_TARGET_OS || cygwin32_TARGET_OS
109 objish_suffix = (`elem` [ "o", "O", "obj", "OBJ" ])
111 objish_suffix = (`elem` [ "o" ])
114 haskellish_file = haskellish_suffix . getFileSuffix
115 haskellish_src_file = haskellish_src_suffix . getFileSuffix
116 cish_file = cish_suffix . getFileSuffix
117 objish_file = objish_suffix . getFileSuffix
118 hsbootish_file = hsbootish_suffix . getFileSuffix
120 isExtCore_file = extcoreish_suffix . getFileSuffix