aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock.hs
diff options
context:
space:
mode:
Diffstat (limited to 'haddock-api/src/Haddock.hs')
-rw-r--r--haddock-api/src/Haddock.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs
index 3543d8e2..8bf932df 100644
--- a/haddock-api/src/Haddock.hs
+++ b/haddock-api/src/Haddock.hs
@@ -151,12 +151,17 @@ haddockWithGhc ghc args = handleTopExceptions $ do
sinceQual <- rightOrThrowE (sinceQualification flags)
-- inject dynamic-too into flags before we proceed
- flags' <- ghc flags $ do
+ flags'' <- ghc flags $ do
df <- getDynFlags
case lookup "GHC Dynamic" (compilerInfo df) of
Just "YES" -> return $ Flag_OptGhc "-dynamic-too" : flags
_ -> return flags
+ flags' <- pure $ case optParCount flags'' of
+ Nothing -> flags''
+ Just Nothing -> Flag_OptGhc "-j" : flags''
+ Just (Just n) -> Flag_OptGhc ("-j" ++ show n) : flags''
+
-- bypass the interface version check
let noChecks = Flag_BypassInterfaceVersonCheck `elem` flags