1e12dbeb68ff526e1ab33518fd281aae78e49e32
[ghc.git] / src / Settings / Packages / Compiler.hs
1 module Settings.Packages.Compiler (compilerPackageArgs) where
2
3 import Base
4 import Expression
5 import Flavour
6 import Oracles.Flag
7 import Oracles.Setting
8 import Settings
9 import Oracles.Flag (crossCompiling)
10
11 compilerPackageArgs :: Args
12 compilerPackageArgs = package compiler ? do
13 stage <- getStage
14 rtsWays <- getRtsWays
15 path <- getBuildPath
16 mconcat [ builder Alex ? arg "--latin1"
17
18 , builder (Ghc CompileHs) ? mconcat
19 [ inputs ["//GHC.hs", "//GhcMake.hs"] ? arg "-fprof-auto"
20 , input "//Parser.hs" ?
21 pure ["-O0", "-fno-ignore-interface-pragmas", "-fcmm-sink" ] ]
22
23 , builder GhcCabal ? mconcat
24 [ arg $ "--ghc-option=-DSTAGE=" ++ show (fromEnum stage + 1)
25 , arg "--disable-library-for-ghci"
26 , anyTargetOs ["openbsd"] ? arg "--ld-options=-E"
27 , flag GhcUnregisterised ? arg "--ghc-option=-DNO_REGS"
28 , notM ghcWithSMP ? arg "--ghc-option=-DNOSMP"
29 , notM ghcWithSMP ? arg "--ghc-option=-optc-DNOSMP"
30 , (threaded `elem` rtsWays) ?
31 notStage0 ? arg "--ghc-option=-optc-DTHREADED_RTS"
32 , ghcWithNativeCodeGen ? arg "--flags=ncg"
33 , ghcWithInterpreter ?
34 notStage0 ? arg "--flags=ghci"
35 , crossCompiling ? arg "-f-terminfo"
36 , ghcWithInterpreter ?
37 ghcEnableTablesNextToCode ?
38 notM (flag GhcUnregisterised) ?
39 notStage0 ? arg "--ghc-option=-DGHCI_TABLES_NEXT_TO_CODE"
40 , ghcWithInterpreter ?
41 ghciWithDebugger <$> flavour ?
42 notStage0 ? arg "--ghc-option=-DDEBUGGER"
43 , ghcProfiled <$> flavour ?
44 notStage0 ? arg "--ghc-pkg-option=--force" ]
45
46 , builder (Haddock BuildPackage) ? arg ("--optghc=-I" ++ path) ]