1 -----------------------------------------------------------------------------
2 -- $Id: DriverPhases.hs,v 1.16 2002/03/04 17:01:30 simonmar 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
26 -----------------------------------------------------------------------------
30 Phase of the | Suffix saying | Flag saying | (suffix of)
31 compilation system | ``start here''| ``stop after''| output file
33 literate pre-processor | .lhs | - | -
34 C pre-processor (opt.) | - | -E | -
35 Haskell compiler | .hs | -C, -S | .hc, .s
36 C compiler (opt.) | .hc or .c | -S | .s
37 assembler | .s or .S | -c | .o
38 linker | other | - | a.out
42 = MkDependHS -- haskell dependency generation
49 | HCc -- Haskellised C (as opposed to vanilla C) compilation
50 | Mangle -- assembly mangling, now done by a separate script.
51 | SplitMangle -- after mangler if splitting
61 -- the first compilation phase for a given file is determined
63 startPhase "lhs" = Unlit
65 startPhase "hscpp" = HsPp
66 startPhase "hspp" = Hsc
67 startPhase "hs-boot" = HsBoot
74 startPhase "raw_s" = Mangle
78 startPhase _ = Ln -- all unknown file types
80 -- the output suffix for a given phase is uniquely determined by
81 -- the input requirements of the next phase.
82 phaseInputExt Unlit = "lhs"
83 phaseInputExt Cpp = "lpp" -- intermediate only
84 phaseInputExt HsPp = "hscpp"
85 phaseInputExt Hsc = "hspp"
86 phaseInputExt HCc = "hc"
87 phaseInputExt Cc = "c"
88 phaseInputExt Mangle = "raw_s"
89 phaseInputExt SplitMangle = "split_s" -- not really generated
90 phaseInputExt As = "s"
91 phaseInputExt SplitAs = "split_s" -- not really generated
92 phaseInputExt Ln = "o"
93 phaseInputExt MkDependHS = "dep"
94 phaseInputExt HsBoot = "hs-boot"
96 phaseInputExt Ilx2Il = "ilx"
97 phaseInputExt Ilasm = "il"
100 haskellish_suffix = (`elem` [ "hs", "hspp", "hscpp", "lhs", "hc", "raw_s" ])
101 haskellish_src_suffix = (`elem` [ "hs", "hspp", "hscpp", "lhs" ])
102 cish_suffix = (`elem` [ "c", "cpp", "C", "cc", "cxx", "s", "S" ])
103 hsbootish_suffix = (`elem` [ "hs-boot" ])
105 #if mingw32_TARGET_OS || cygwin32_TARGET_OS
106 objish_suffix = (`elem` [ "o", "O", "obj", "OBJ" ])
108 objish_suffix = (`elem` [ "o" ])
111 haskellish_file = haskellish_suffix . getFileSuffix
112 haskellish_src_file = haskellish_src_suffix . getFileSuffix
113 cish_file = cish_suffix . getFileSuffix
114 objish_file = objish_suffix . getFileSuffix
115 hsbootish_file = hsbootish_suffix . getFileSuffix