diff options
Diffstat (limited to 'hadrian/src/Settings/Builders/DeriveConstants.hs')
-rw-r--r-- | hadrian/src/Settings/Builders/DeriveConstants.hs | 14 |
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) |