1 -----------------------------------------------------------------------------
2 -- $Id: DriverPhases.hs,v 1.9 2001/05/08 10:58:48 simonmar Exp $
6 -- (c) Simon Marlow 2000
8 -----------------------------------------------------------------------------
12 startPhase, -- :: String -> Phase
13 phaseInputExt, -- :: Phase -> String
15 haskellish_file, haskellish_suffix,
16 haskellish_src_file, haskellish_src_suffix,
17 objish_file, objish_suffix,
18 cish_file, cish_suffix
23 -----------------------------------------------------------------------------
27 Phase of the | Suffix saying | Flag saying | (suffix of)
28 compilation system | ``start here''| ``stop after''| output file
30 literate pre-processor | .lhs | - | -
31 C pre-processor (opt.) | - | -E | -
32 Haskell compiler | .hs | -C, -S | .hc, .s
33 C compiler (opt.) | .hc or .c | -S | .s
34 assembler | .s or .S | -c | .o
35 linker | other | - | a.out
39 = MkDependHS -- haskell dependency generation
42 | Hsc -- ToDo: HscTargetLang
44 | HCc -- Haskellised C (as opposed to vanilla C) compilation
45 | Mangle -- assembly mangling, now done by a separate script.
46 | SplitMangle -- after mangler if splitting
52 -- the first compilation phase for a given file is determined
54 startPhase "lhs" = Unlit
56 startPhase "hspp" = Hsc
59 startPhase "raw_s" = Mangle
63 startPhase _ = Ln -- all unknown file types
65 -- the output suffix for a given phase is uniquely determined by
66 -- the input requirements of the next phase.
67 phaseInputExt Unlit = "lhs"
68 phaseInputExt Cpp = "lpp" -- intermediate only
69 phaseInputExt Hsc = "hspp"
70 phaseInputExt HCc = "hc"
71 phaseInputExt Cc = "c"
72 phaseInputExt Mangle = "raw_s"
73 phaseInputExt SplitMangle = "split_s" -- not really generated
74 phaseInputExt As = "s"
75 phaseInputExt SplitAs = "split_s" -- not really generated
76 phaseInputExt Ln = "o"
77 phaseInputExt MkDependHS = "dep"
79 haskellish_suffix = (`elem` [ "hs", "hspp", "lhs", "hc", "raw_s" ])
80 haskellish_src_suffix = (`elem` [ "hs", "hspp", "lhs" ])
81 cish_suffix = (`elem` [ "c", "s", "S" ]) -- maybe .cc et al.??
83 #if mingw32_TARGET_OS || cygwin32_TARGET_OS
84 objish_suffix = (`elem` [ "o", "O", "obj", "OBJ" ])
86 objish_suffix = (`elem` [ "o" ])
89 haskellish_file = haskellish_suffix . getFileSuffix
90 haskellish_src_file = haskellish_src_suffix . getFileSuffix
91 cish_file = cish_suffix . getFileSuffix
92 objish_file = objish_suffix . getFileSuffix