Add test compiler option to test (#621)
[hadrian.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
10 compilerPackageArgs :: Args
11 compilerPackageArgs = package compiler ? do
12 stage <- getStage
13 rtsWays <- getRtsWays
14 path <- getBuildPath
15 mconcat [ builder Alex ? arg "--latin1"
16
17 , builder (Ghc CompileHs) ? mconcat
18 [ inputs ["//GHC.hs", "//GhcMake.hs"] ? arg "-fprof-auto"
19 , input "//Parser.hs" ?
20 pure ["-O0", "-fno-ignore-interface-pragmas", "-fcmm-sink" ] ]
21
22 , builder GhcCabal ? mconcat
23 [ arg $ "--ghc-option=-DSTAGE=" ++ show (fromEnum stage + 1)
24 , arg "--disable-library-for-ghci"
25 , anyTargetOs ["openbsd"] ? arg "--ld-options=-E"
26 , flag GhcUnregisterised ? arg "--ghc-option=-DNO_REGS"
27 , notM ghcWithSMP ? arg "--ghc-option=-DNOSMP"
28 , notM ghcWithSMP ? arg "--ghc-option=-optc-DNOSMP"
29 , (threaded `elem` rtsWays) ?
30 notStage0 ? arg "--ghc-option=-optc-DTHREADED_RTS"
31 , ghcWithNativeCodeGen ? arg "--flags=ncg"
32 , ghcWithInterpreter ?
33 notStage0 ? arg "--flags=ghci"
34 , flag CrossCompiling ? arg "-f-terminfo"
35 , ghcWithInterpreter ?
36 ghcEnableTablesNextToCode ?
37 notM (flag GhcUnregisterised) ?
38 notStage0 ? arg "--ghc-option=-DGHCI_TABLES_NEXT_TO_CODE"
39 , ghcWithInterpreter ?
40 ghciWithDebugger <$> flavour ?
41 notStage0 ? arg "--ghc-option=-DDEBUGGER"
42 , ghcProfiled <$> flavour ?
43 notStage0 ? arg "--ghc-pkg-option=--force" ]
44
45 , builder (Haddock BuildPackage) ? arg ("--optghc=-I" ++ path) ]