Expression: Don't re-export Base
[hadrian.git] / src / Settings / Builders / DeriveConstants.hs
1 module Settings.Builders.DeriveConstants (
2 derivedConstantsPath, deriveConstantsArgs
3 ) where
4
5 import Base
6 import Expression
7 import Oracles.Config.Flag
8 import Oracles.Config.Setting
9 import Predicates (builder, file)
10 import Settings.Builders.GhcCabal
11
12 derivedConstantsPath :: FilePath
13 derivedConstantsPath = "includes/dist-derivedconstants/header"
14
15 -- TODO: do we need to support `includes_CC_OPTS += -DDYNAMIC_BY_DEFAULT`?
16 deriveConstantsArgs :: Args
17 deriveConstantsArgs = builder DeriveConstants ? do
18 cFlags <- fromDiffExpr includeCcArgs
19 mconcat
20 [ file "//DerivedConstants.h" ? arg "--gen-header"
21 , file "//GHCConstantsHaskellType.hs" ? arg "--gen-haskell-type"
22 , file "//platformConstants" ? arg "--gen-haskell-value"
23 , file "//GHCConstantsHaskellWrappers.hs" ? arg "--gen-haskell-wrappers"
24 , file "//GHCConstantsHaskellExports.hs" ? arg "--gen-haskell-exports"
25 , arg "-o", arg =<< getOutput
26 , arg "--tmpdir", arg derivedConstantsPath
27 , arg "--gcc-program", arg =<< getBuilderPath (Gcc Stage1)
28 , append . concat $ map (\a -> ["--gcc-flag", a]) cFlags
29 , arg "--nm-program", arg =<< getBuilderPath Nm
30 , specified Objdump ? mconcat [ arg "--objdump-program"
31 , arg =<< getBuilderPath Objdump ]
32 , arg "--target-os", arg =<< getSetting TargetOs ]
33
34 includeCcArgs :: Args
35 includeCcArgs = do
36 confCcArgs <- lift . settingList $ ConfCcArgs Stage1
37 mconcat
38 [ ccArgs
39 , ccWarnings
40 , append confCcArgs
41 , flag GhcUnregisterised ? arg "-DUSE_MINIINTERPRETER"
42 , append $ map ("-I" ++) ghcIncludeDirs -- TODO: fix code duplication
43 , arg "-Irts"
44 , notM ghcWithSMP ? arg "-DNOSMP"
45 , arg "-fcommon" ]