1 -----------------------------------------------------------------------------
2 -- $Id: DriverPhases.hs,v 1.13 2001/10/26 00:53:27 sof Exp $
6 -- (c) Simon Marlow 2000
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 objish_file, objish_suffix,
20 cish_file, cish_suffix
25 -----------------------------------------------------------------------------
29 Phase of the | Suffix saying | Flag saying | (suffix of)
30 compilation system | ``start here''| ``stop after''| output file
32 literate pre-processor | .lhs | - | -
33 C pre-processor (opt.) | - | -E | -
34 Haskell compiler | .hs | -C, -S | .hc, .s
35 C compiler (opt.) | .hc or .c | -S | .s
36 assembler | .s or .S | -c | .o
37 linker | other | - | a.out
41 = MkDependHS -- haskell dependency generation
45 | Hsc -- ToDo: HscTargetLang
47 | HCc -- Haskellised C (as opposed to vanilla C) compilation
48 | Mangle -- assembly mangling, now done by a separate script.
49 | SplitMangle -- after mangler if splitting
59 -- the first compilation phase for a given file is determined
61 startPhase "lhs" = Unlit
63 startPhase "hscpp" = HsPp
64 startPhase "hspp" = Hsc
67 startPhase "raw_s" = Mangle
71 startPhase _ = Ln -- all unknown file types
73 -- the output suffix for a given phase is uniquely determined by
74 -- the input requirements of the next phase.
75 phaseInputExt Unlit = "lhs"
76 phaseInputExt Cpp = "lpp" -- intermediate only
77 phaseInputExt HsPp = "hscpp"
78 phaseInputExt Hsc = "hspp"
79 phaseInputExt HCc = "hc"
80 phaseInputExt Cc = "c"
81 phaseInputExt Mangle = "raw_s"
82 phaseInputExt SplitMangle = "split_s" -- not really generated
83 phaseInputExt As = "s"
84 phaseInputExt SplitAs = "split_s" -- not really generated
85 phaseInputExt Ln = "o"
86 phaseInputExt MkDependHS = "dep"
88 phaseInputExt Ilx2Il = "ilx"
89 phaseInputExt Ilasm = "il"
92 haskellish_suffix = (`elem` [ "hs", "hspp", "hscpp", "lhs", "hc", "raw_s" ])
93 haskellish_src_suffix = (`elem` [ "hs", "hspp", "hscpp", "lhs" ])
94 cish_suffix = (`elem` [ "c", "s", "S" ]) -- maybe .cc et al.??
96 #if mingw32_TARGET_OS || cygwin32_TARGET_OS
97 objish_suffix = (`elem` [ "o", "O", "obj", "OBJ" ])
99 objish_suffix = (`elem` [ "o" ])
102 haskellish_file = haskellish_suffix . getFileSuffix
103 haskellish_src_file = haskellish_src_suffix . getFileSuffix
104 cish_file = cish_suffix . getFileSuffix
105 objish_file = objish_suffix . getFileSuffix