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 ( ...@@ -69,7 +69,8 @@ module Distribution.Simple.Compiler (
languageToFlags, languageToFlags,
unsupportedLanguages, unsupportedLanguages,
extensionsToFlags, extensionsToFlags,
unsupportedExtensions unsupportedExtensions,
parmakeSupported
) where ) where
import Distribution.Compiler import Distribution.Compiler
...@@ -79,7 +80,7 @@ import Language.Haskell.Extension (Language(Haskell98), Extension) ...@@ -79,7 +80,7 @@ import Language.Haskell.Extension (Language(Haskell98), Extension)
import Control.Monad (liftM) import Control.Monad (liftM)
import Data.List (nub) 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 Data.Maybe (catMaybes, isNothing)
import System.Directory (canonicalizePath) import System.Directory (canonicalizePath)
...@@ -214,3 +215,12 @@ extensionsToFlags comp = nub . filter (not . null) ...@@ -214,3 +215,12 @@ extensionsToFlags comp = nub . filter (not . null)
extensionToFlag :: Compiler -> Extension -> Maybe Flag extensionToFlag :: Compiler -> Extension -> Maybe Flag
extensionToFlag comp ext = lookup ext (compilerExtensions comp) 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 ...@@ -25,7 +25,6 @@ import Distribution.Version
import Language.Haskell.Extension ( Language(..), Extension(..) ) import Language.Haskell.Extension ( Language(..), Extension(..) )
import Data.Monoid import Data.Monoid
import qualified Data.Map as M ( lookup )
-- | A structured set of GHC options/flags -- | A structured set of GHC options/flags
-- --
...@@ -265,11 +264,11 @@ renderGhcOptions comp opts ...@@ -265,11 +264,11 @@ renderGhcOptions comp opts
, [ "-split-objs" | flagBool ghcOptSplitObjs ] , [ "-split-objs" | flagBool ghcOptSplitObjs ]
, let numJobs = fromFlagOrDefault 1 (ghcOptNumJobs opts) in , if parmakeSupported comp
case M.lookup "Support parallel --make" (compilerProperties comp) of then
Just "YES" -> let numJobs = fromFlagOrDefault 1 (ghcOptNumJobs opts)
if numJobs > 1 then ["-j" ++ show numJobs] else [] in if numJobs > 1 then ["-j" ++ show numJobs] else []
_ -> [] else []
-------------------- --------------------
-- Dynamic linking -- 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