summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings/Builders/DeriveConstants.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hadrian/src/Settings/Builders/DeriveConstants.hs')
-rw-r--r--hadrian/src/Settings/Builders/DeriveConstants.hs25
1 files changed, 17 insertions, 8 deletions
diff --git a/hadrian/src/Settings/Builders/DeriveConstants.hs b/hadrian/src/Settings/Builders/DeriveConstants.hs
index 90068b3c4a..0747162f43 100644
--- a/hadrian/src/Settings/Builders/DeriveConstants.hs
+++ b/hadrian/src/Settings/Builders/DeriveConstants.hs
@@ -1,8 +1,19 @@
-module Settings.Builders.DeriveConstants (deriveConstantsBuilderArgs) where
+module Settings.Builders.DeriveConstants (
+ deriveConstantsBuilderArgs, deriveConstantsPairs
+ ) where
import Builder
import Settings.Builders.Common
+deriveConstantsPairs :: [(String, String)]
+deriveConstantsPairs =
+ [ ("DerivedConstants.h", "--gen-header")
+ , ("GHCConstantsHaskellType.hs", "--gen-haskell-type")
+ , ("platformConstants", "--gen-haskell-value")
+ , ("GHCConstantsHaskellWrappers.hs", "--gen-haskell-wrappers")
+ , ("GHCConstantsHaskellExports.hs", "--gen-haskell-exports")
+ ]
+
-- TODO: do we need to support `includes_CC_OPTS += -DDYNAMIC_BY_DEFAULT`?
deriveConstantsBuilderArgs :: Args
deriveConstantsBuilderArgs = builder DeriveConstants ? do
@@ -12,11 +23,8 @@ deriveConstantsBuilderArgs = builder DeriveConstants ? do
[a, b] -> (a, b)
_ -> error $ "DeriveConstants: expected two outputs, got " ++ show outs
mconcat
- [ output "**/DerivedConstants.h" ? arg "--gen-header"
- , output "**/GHCConstantsHaskellType.hs" ? arg "--gen-haskell-type"
- , output "**/platformConstants" ? arg "--gen-haskell-value"
- , output "**/GHCConstantsHaskellWrappers.hs" ? arg "--gen-haskell-wrappers"
- , output "**/GHCConstantsHaskellExports.hs" ? arg "--gen-haskell-exports"
+ [ mconcat $ flip fmap deriveConstantsPairs $ \(fileName, flag) ->
+ output ("**/" ++ fileName) ? arg flag
, arg "-o", arg outputFile
, arg "--tmpdir", arg tempDir
, arg "--gcc-program", arg =<< getBuilderPath (Cc CompileC Stage1)
@@ -28,13 +36,14 @@ deriveConstantsBuilderArgs = builder DeriveConstants ? do
includeCcArgs :: Args
includeCcArgs = do
- root <- getBuildRoot
+ stage <- getStage
+ libPath <- expr $ stageLibPath stage
mconcat [ cArgs
, cWarnings
, getSettingList $ ConfCcArgs Stage1
, flag GhcUnregisterised ? arg "-DUSE_MINIINTERPRETER"
, arg "-Irts"
, arg "-Iincludes"
- , arg $ "-I" ++ root -/- generatedDir
+ , arg $ "-I" ++ libPath
, notM ghcWithSMP ? arg "-DNOSMP"
, arg "-fcommon" ]