Clean up code, add comments.
[hadrian.git] / src / Settings / Ways.hs
1 module Settings.Ways (getWays, getRtsWays) where
2
3 import Expression
4 import Predicates
5 import Settings.User
6
7 -- Combining default ways with user modifications
8 getWays :: Expr [Way]
9 getWays = fromDiffExpr $ defaultWays <> userWays
10
11 getRtsWays :: Expr [Way]
12 getRtsWays = fromDiffExpr $ defaultRtsWays <> userRtsWays
13
14 -- These are default ways
15 defaultWays :: Ways
16 defaultWays = mconcat
17 [ append [vanilla] -- always build vanilla
18 , notStage0 ? append [profiling]
19 , platformSupportsSharedLibs ? append [dynamic] ]
20
21 defaultRtsWays :: Ways
22 defaultRtsWays = do
23 ways <- getWays
24 mconcat
25 [ append [ logging, debug, threaded, threadedDebug, threadedLogging ]
26 , (profiling `elem` ways) ? append [threadedProfiling]
27 , (dynamic `elem` ways) ?
28 append [ dynamic, debugDynamic, threadedDynamic, threadedDebugDynamic
29 , loggingDynamic, threadedLoggingDynamic ] ]