Commit a66a6a16 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

Add a way to find out if a given Compiler supports parallel --make.

parent 203421c5
......@@ -69,7 +69,8 @@ module Distribution.Simple.Compiler (
languageToFlags,
unsupportedLanguages,
extensionsToFlags,
unsupportedExtensions
unsupportedExtensions,
parmakeSupported
) where
import Distribution.Compiler
......@@ -79,7 +80,7 @@ import Language.Haskell.Extension (Language(Haskell98), Extension)
import Control.Monad (liftM)
import Data.List (nub)
import qualified Data.Map as M (Map)
import qualified Data.Map as M (Map, lookup)
import Data.Maybe (catMaybes, isNothing)
import System.Directory (canonicalizePath)
......@@ -214,3 +215,12 @@ extensionsToFlags comp = nub . filter (not . null)
extensionToFlag :: Compiler -> Extension -> Maybe Flag
extensionToFlag comp ext = lookup ext (compilerExtensions comp)
-- | Does this compiler support parallel --make mode?
parmakeSupported :: Compiler -> Bool
parmakeSupported comp =
case compilerFlavor comp of
GHC -> case M.lookup "Support parallel --make" (compilerProperties comp) of
Just "YES" -> True
_ -> False
_ -> False
......@@ -25,7 +25,6 @@ import Distribution.Version
import Language.Haskell.Extension ( Language(..), Extension(..) )
import Data.Monoid
import qualified Data.Map as M ( lookup )
-- | A structured set of GHC options/flags
--
......@@ -265,11 +264,11 @@ renderGhcOptions comp opts
, [ "-split-objs" | flagBool ghcOptSplitObjs ]
, let numJobs = fromFlagOrDefault 1 (ghcOptNumJobs opts) in
case M.lookup "Support parallel --make" (compilerProperties comp) of
Just "YES" ->
if numJobs > 1 then ["-j" ++ show numJobs] else []
_ -> []
, if parmakeSupported comp
then
let numJobs = fromFlagOrDefault 1 (ghcOptNumJobs opts)
in if numJobs > 1 then ["-j" ++ show numJobs] else []
else []
--------------------
-- Dynamic linking
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment