summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings/Builders/DeriveConstants.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-07-07 13:16:47 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-25 00:45:08 -0400
commit6333d7391068d8029eed3e8eff019b9e2c104c7b (patch)
treeed9c42bf6df586a976db83ff448b3efd16ef9764 /hadrian/src/Settings/Builders/DeriveConstants.hs
parent342a01af624840ba94f22256079ff4f3cee09ca2 (diff)
downloadhaskell-6333d7391068d8029eed3e8eff019b9e2c104c7b.tar.gz
Put PlatformConstants into Platform
Diffstat (limited to 'hadrian/src/Settings/Builders/DeriveConstants.hs')
-rw-r--r--hadrian/src/Settings/Builders/DeriveConstants.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/hadrian/src/Settings/Builders/DeriveConstants.hs b/hadrian/src/Settings/Builders/DeriveConstants.hs
index a8fcf37d0b..de548b41ff 100644
--- a/hadrian/src/Settings/Builders/DeriveConstants.hs
+++ b/hadrian/src/Settings/Builders/DeriveConstants.hs
@@ -19,12 +19,16 @@ deriveConstantsBuilderArgs :: Args
deriveConstantsBuilderArgs = builder DeriveConstants ? do
cFlags <- includeCcArgs
outs <- getOutputs
- let (outputFile, tempDir) = case outs of
- [a, b] -> (a, b)
- _ -> error $ "DeriveConstants: expected two outputs, got " ++ show outs
+ let (outputFile, mode, tempDir) = case outs of
+ [ofile, mode, tmpdir] -> (ofile,mode,tmpdir)
+ [ofile, tmpdir]
+ | Just mode <- lookup (takeFileName ofile) deriveConstantsPairs
+ -> (ofile, mode, tmpdir)
+ | otherwise
+ -> error $ "DeriveConstants: invalid output file, got " ++ show (takeFileName ofile)
+ _ -> error $ "DeriveConstants: unexpected outputs, got " ++ show outs
mconcat
- [ mconcat $ flip fmap deriveConstantsPairs $ \(fileName, flag) ->
- output ("//" ++ fileName) ? arg flag
+ [ arg mode
, arg "-o", arg outputFile
, arg "--tmpdir", arg tempDir
, arg "--gcc-program", arg =<< getBuilderPath (Cc CompileC Stage1)