blob: 095060519973acb533d939147bd3ad7309346d94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
module Rules.Nofib where
import Base
import Expression
import Oracles.Setting
import Packages
import System.Environment
import System.Exit
nofibLogFile :: FilePath
nofibLogFile = "nofib-log"
-- | Rules for running the @nofib@ benchmark suite.
nofibRules :: Rules ()
nofibRules = do
root <- buildRootRules
-- a phony "nofib" rule that just triggers
-- the rule below.
"nofib" ~> need [root -/- nofibLogFile]
-- a rule to produce <build root>/nofig-log
-- by running the nofib suite and capturing
-- the relevant output.
root -/- nofibLogFile %> \fp -> do
needNofibDeps
makePath <- builderPath (Make "nofib")
top <- topDirectory
ghcPath <- builderPath (Ghc CompileHs Stage2)
perlPath <- builderPath Perl
-- some makefiles in nofib rely on a $MAKE
-- env var being defined
liftIO (setEnv "MAKE" makePath)
-- this runs make commands in the nofib
-- subdirectory, passing the path to
-- the GHC to benchmark and perl to
-- nofib's makefiles.
let nofibArgs = ["WithNofibHc=" ++ (top -/- ghcPath), "PERL=" ++ perlPath]
unit $ cmd (Cwd "nofib") [makePath] ["clean"]
unit $ cmd (Cwd "nofib") [makePath] (nofibArgs ++ ["boot"])
(Exit e, Stdouterr log) <- cmd (Cwd "nofib") [makePath] nofibArgs
writeFile' fp log
if e == ExitSuccess
then putLoud $ "nofib log available at " ++ fp
else error $ "nofib failed, full log available at " ++ fp
-- | Build the dependencies required by @nofib@.
needNofibDeps :: Action ()
needNofibDeps = do
unlitPath <- programPath (vanillaContext Stage1 unlit)
mtlPath <- pkgConfFile (vanillaContext Stage1 mtl )
need [ unlitPath, mtlPath ]
needBuilder (Ghc CompileHs Stage2)
|