1 -----------------------------------------------------------------------------
2 -- $Id: DriverPhases.hs,v 1.1 2000/10/16 15:16:59 simonmar Exp $
6 -- (c) Simon Marlow 2000
8 -----------------------------------------------------------------------------
12 startPhase, -- :: String -> Phase
13 phaseInputExt, -- :: Phase -> String
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
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
58 startPhase "raw_s" = Mangle
62 startPhase _ = Ln -- all unknown file types
64 -- the output suffix for a given phase is uniquely determined by
65 -- the input requirements of the next phase.
66 phaseInputExt Unlit = "lhs"
67 phaseInputExt Cpp = "lpp" -- intermediate only
68 phaseInputExt Hsc = "cpp" -- intermediate only
69 phaseInputExt HCc = "hc"
70 phaseInputExt Cc = "c"
71 phaseInputExt Mangle = "raw_s"
72 phaseInputExt SplitMangle = "split_s" -- not really generated
73 phaseInputExt As = "s"
74 phaseInputExt SplitAs = "split_s" -- not really generated
75 phaseInputExt Ln = "o"
76 phaseInputExt MkDependHS = "dep"
78 haskellish_suffix = (`elem` [ "hs", "lhs", "hc" ])
79 cish_suffix = (`elem` [ "c", "s", "S" ]) -- maybe .cc et al.??
81 haskellish_file f = haskellish_suffix suf where (_,suf) = splitFilename f
82 cish_file f = cish_suffix suf where (_,suf) = splitFilename f