Re-export Expression from Predicates
[ghc.git] / src / Settings / Ways.hs
1 module Settings.Ways (getLibraryWays, getRtsWays) where
2
3 import Base
4 import CmdLineFlag
5 import Oracles.Config.Flag
6 import Predicates
7 import Settings.Flavours.Quick
8 import Settings.User
9
10 -- | Combine default library ways with user modifications.
11 getLibraryWays :: Expr [Way]
12 getLibraryWays = fromDiffExpr $ mconcat [ defaultLibraryWays
13 , userLibraryWays
14 , flavourLibraryWays ]
15
16 -- | Combine default RTS ways with user modifications.
17 getRtsWays :: Expr [Way]
18 getRtsWays = fromDiffExpr $ defaultRtsWays <> userRtsWays
19
20 -- TODO: what about profilingDynamic way? Do we need platformSupportsSharedLibs?
21 -- These are default ways for library packages:
22 -- * We always build 'vanilla' way.
23 -- * We build 'profiling' way when stage > Stage0.
24 -- * We build 'dynamic' way when stage > Stage0 and the platform supports it.
25 defaultLibraryWays :: Ways
26 defaultLibraryWays = mconcat
27 [ append [vanilla]
28 , notStage0 ? append [profiling]
29 , notStage0 ? platformSupportsSharedLibs ? append [dynamic] ]
30
31 flavourLibraryWays :: Ways
32 flavourLibraryWays = mconcat
33 [ cmdFlavour == Quick ? quickFlavourWays ]
34
35 defaultRtsWays :: Ways
36 defaultRtsWays = do
37 ways <- getLibraryWays
38 mconcat
39 [ append [ logging, debug, threaded, threadedDebug, threadedLogging ]
40 , (profiling `elem` ways) ? append [threadedProfiling]
41 , (dynamic `elem` ways) ?
42 append [ dynamic, debugDynamic, threadedDynamic, threadedDebugDynamic
43 , loggingDynamic, threadedLoggingDynamic ] ]