6f8768de1f0c51c4ce95f0980cc869bf81c4e314
[hadrian.git] / src / Settings / Builders / Make.hs
1 module Settings.Builders.Make (makeBuilderArgs, validateBuilderArgs) where
2
3 import GHC
4 import Oracles.Setting
5 import Rules.Gmp
6 import Rules.Libffi
7 import Settings.Builders.Common
8
9 makeBuilderArgs :: Args
10 makeBuilderArgs = do
11 threads <- shakeThreads <$> expr getShakeOptions
12 gmpPath <- expr gmpBuildPath
13 libffiPath <- expr libffiBuildPath
14 let t = show $ max 4 (threads - 2) -- Don't use all Shake's threads
15 mconcat
16 [ builder (Make gmpPath ) ? pure ["MAKEFLAGS=-j" ++ t]
17 , builder (Make libffiPath ) ? pure ["MAKEFLAGS=-j" ++ t, "install"]
18 ]
19
20 validateBuilderArgs :: Args
21 validateBuilderArgs = builder (Make "testsuite/tests") ? do
22 threads <- shakeThreads <$> expr getShakeOptions
23 top <- expr topDirectory
24 compiler <- expr $ fullpath ghc
25 checkPpr <- expr $ fullpath checkPpr
26 checkApiAnnotations <- expr $ fullpath checkApiAnnotations
27 return [ "fast"
28 , "THREADS=" ++ show threads
29 , "TEST_HC=" ++ (top -/- compiler)
30 , "CHECK_PPR=" ++ (top -/- checkPpr)
31 , "CHECK_API_ANNOTATIONS=" ++ (top -/- checkApiAnnotations)
32 ]
33 where
34 fullpath :: Package -> Action FilePath
35 fullpath pkg = programPath =<< programContext Stage1 pkg
36