Expression: Don't re-export Base
[hadrian.git] / src / Settings / Ways.hs
1 module Settings.Ways (getWays, getLibWays, getRtsWays) where
2
3 import Data.Monoid
4 import Expression
5 import Predicates
6 import Settings.User
7
8 -- TODO: use a single expression Ways parameterised by package instead of
9 -- expressions libWays and rtsWays
10
11 -- Combining default ways with user modifications
12 getLibWays :: Expr [Way]
13 getLibWays = fromDiffExpr $ defaultLibWays <> userLibWays
14
15 -- In Stage0 we only build vanilla
16 getWays :: Expr [Way]
17 getWays = mconcat [ stage0 ? return [vanilla], notStage0 ? getLibWays ]
18
19 getRtsWays :: Expr [Way]
20 getRtsWays = fromDiffExpr $ defaultRtsWays <> userRtsWays
21
22 -- These are default ways
23 defaultLibWays :: Ways
24 defaultLibWays = mconcat
25 [ append [vanilla, profiling]
26 , platformSupportsSharedLibs ? append [dynamic] ]
27
28 defaultRtsWays :: Ways
29 defaultRtsWays = do
30 ways <- getLibWays
31 mconcat
32 [ append [ logging, debug, threaded, threadedDebug, threadedLogging ]
33 , (profiling `elem` ways) ? append [threadedProfiling]
34 , (dynamic `elem` ways) ?
35 append [ dynamic, debugDynamic, threadedDynamic, threadedDebugDynamic
36 , loggingDynamic, threadedLoggingDynamic ] ]