1 -----------------------------------------------------------------------------
2 -- $Id: DriverPhases.hs,v 1.6 2001/02/27 15:25:18 simonmar Exp $
6 -- (c) Simon Marlow 2000
8 -----------------------------------------------------------------------------
12 startPhase, -- :: String -> Phase
13 phaseInputExt, -- :: Phase -> String
15 haskellish_file, haskellish_suffix,
16 objish_file, objish_suffix,
17 cish_file, cish_suffix
22 -----------------------------------------------------------------------------
26 Phase of the | Suffix saying | Flag saying | (suffix of)
27 compilation system | ``start here''| ``stop after''| output file
29 literate pre-processor | .lhs | - | -
30 C pre-processor (opt.) | - | -E | -
31 Haskell compiler | .hs | -C, -S | .hc, .s
32 C compiler (opt.) | .hc or .c | -S | .s
33 assembler | .s or .S | -c | .o
34 linker | other | - | a.out
38 = MkDependHS -- haskell dependency generation
43 | HCc -- Haskellised C (as opposed to vanilla C) compilation
45 | Ilx -- .NET extended IL
47 | Mangle -- assembly mangling, now done by a separate script.
48 | SplitMangle -- after mangler if splitting
54 -- the first compilation phase for a given file is determined
56 startPhase "lhs" = Unlit
58 startPhase "hspp" = Hsc
61 startPhase "raw_s" = Mangle
65 startPhase _ = Ln -- all unknown file types
67 -- the output suffix for a given phase is uniquely determined by
68 -- the input requirements of the next phase.
69 phaseInputExt Unlit = "lhs"
70 phaseInputExt Cpp = "lpp" -- intermediate only
71 phaseInputExt Hsc = "hspp"
72 phaseInputExt HCc = "hc"
73 phaseInputExt Cc = "c"
75 phaseInputExt Ilx = "ilx"
77 phaseInputExt Mangle = "raw_s"
78 phaseInputExt SplitMangle = "split_s" -- not really generated
79 phaseInputExt As = "s"
80 phaseInputExt SplitAs = "split_s" -- not really generated
81 phaseInputExt Ln = "o"
82 phaseInputExt MkDependHS = "dep"
84 haskellish_suffix = (`elem` [ "hs", "hspp", "lhs", "hc" ])
85 cish_suffix = (`elem` [ "c", "s", "S" ]) -- maybe .cc et al.??
87 #if mingw32_TARGET_OS || cygwin32_TARGET_OS
88 objish_suffix = (`elem` [ "o", "O", "obj", "OBJ" ])
90 objish_suffix = (`elem` [ "o" ])
93 haskellish_file f = haskellish_suffix suf where (_,suf) = splitFilename f
94 cish_file f = cish_suffix suf where (_,suf) = splitFilename f
95 objish_file f = objish_suffix suf where (_,suf) = splitFilename f