Bump Cabal upper bound (#651)
[hadrian.git] / src / Way.hs
1 module Way (
2 WayUnit (..), Way, wayUnit, addWayUnit, removeWayUnit, wayFromUnits, allWays,
3
4 vanilla, profiling, dynamic, profilingDynamic, threaded, debug, logging,
5 threadedDebug, threadedProfiling, threadedLogging, threadedDynamic,
6 threadedDebugProfiling, threadedDebugDynamic, threadedProfilingDynamic,
7 threadedLoggingDynamic, debugProfiling, debugDynamic, loggingDynamic,
8
9 wayPrefix, waySuffix, hisuf, osuf, hcsuf, obootsuf, hibootsuf, ssuf
10 ) where
11
12 import Way.Type
13
14 -- | Build default _vanilla_ way.
15 vanilla :: Way
16 vanilla = wayFromUnits []
17
18 -- | Build with profiling.
19 profiling :: Way
20 profiling = wayFromUnits [Profiling]
21
22 -- | Build with dynamic linking.
23 dynamic :: Way
24 dynamic = wayFromUnits [Dynamic]
25
26 -- | Build with profiling and dynamic linking.
27 profilingDynamic :: Way
28 profilingDynamic = wayFromUnits [Profiling, Dynamic]
29
30 -- RTS only ways below. See compiler/main/DynFlags.hs.
31 -- | Build RTS with event logging.
32 logging :: Way
33 logging = wayFromUnits [Logging]
34
35 -- | Build multithreaded RTS.
36 threaded :: Way
37 threaded = wayFromUnits [Threaded]
38
39 -- | Build RTS with debug information.
40 debug :: Way
41 debug = wayFromUnits [Debug]
42
43 -- | Various combinations of RTS only ways.
44 threadedDebug, threadedProfiling, threadedLogging, threadedDynamic,
45 threadedDebugProfiling, threadedDebugDynamic, threadedProfilingDynamic,
46 threadedLoggingDynamic, debugProfiling, debugDynamic, loggingDynamic :: Way
47 threadedDebug = wayFromUnits [Threaded, Debug]
48 threadedProfiling = wayFromUnits [Threaded, Profiling]
49 threadedLogging = wayFromUnits [Threaded, Logging]
50 threadedDynamic = wayFromUnits [Threaded, Dynamic]
51 threadedDebugProfiling = wayFromUnits [Threaded, Debug, Profiling]
52 threadedDebugDynamic = wayFromUnits [Threaded, Debug, Dynamic]
53 threadedProfilingDynamic = wayFromUnits [Threaded, Profiling, Dynamic]
54 threadedLoggingDynamic = wayFromUnits [Threaded, Logging, Dynamic]
55 debugProfiling = wayFromUnits [Debug, Profiling]
56 debugDynamic = wayFromUnits [Debug, Dynamic]
57 loggingDynamic = wayFromUnits [Logging, Dynamic]
58
59 -- | All ways supported by the build system.
60 allWays :: [Way]
61 allWays =
62 [ vanilla, profiling, dynamic, profilingDynamic, threaded, debug, logging
63 , threadedDebug, threadedProfiling, threadedLogging, threadedDynamic
64 , threadedDebugProfiling, threadedDebugDynamic, threadedProfilingDynamic
65 , threadedLoggingDynamic, debugProfiling, debugDynamic, loggingDynamic ]
66
67 wayPrefix :: Way -> String
68 wayPrefix way | way == vanilla = ""
69 | otherwise = show way ++ "_"
70
71 waySuffix :: Way -> String
72 waySuffix way | way == vanilla = ""
73 | otherwise = "_" ++ show way
74
75 osuf, ssuf, hisuf, hcsuf, obootsuf, hibootsuf :: Way -> String
76 osuf = (++ "o" ) . wayPrefix
77 ssuf = (++ "s" ) . wayPrefix
78 hisuf = (++ "hi" ) . wayPrefix
79 hcsuf = (++ "hc" ) . wayPrefix
80 obootsuf = (++ "o-boot" ) . wayPrefix
81 hibootsuf = (++ "hi-boot") . wayPrefix