Commit f31a7de2 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Add Make builder.

parent 6ef09f44
......@@ -84,6 +84,7 @@ executable hadrian
, Settings.Builders.Hsc2Hs
, Settings.Builders.HsCpp
, Settings.Builders.Ld
, Settings.Builders.Make
, Settings.Builders.Tar
, Settings.Default
, Settings.Packages
......
......@@ -49,7 +49,7 @@ data Builder = Alex
| HsCpp
| Hsc2Hs
| Ld
| Make
| Make FilePath
| Nm
| Objdump
| Patch
......@@ -111,7 +111,7 @@ builderPath builder = case builderProvenance builder of
HsColour -> fromKey "hscolour"
HsCpp -> fromKey "hs-cpp"
Ld -> fromKey "ld"
Make -> fromKey "make"
Make _ -> fromKey "make"
Nm -> fromKey "nm"
Objdump -> fromKey "objdump"
Patch -> fromKey "patch"
......
module Rules.Actions (
build, buildWithResources, buildWithCmdOptions, copyFile, moveFile,
removeFile, createDirectory, removeDirectory, copyDirectory, moveDirectory,
applyPatch, fixFile, runMake, renderLibrary, renderProgram, runBuilder,
makeExecutable
build, buildWithCmdOptions, buildWithResources, copyFile, fixFile, moveFile,
removeFile, copyDirectory, createDirectory, moveDirectory, removeDirectory,
applyPatch, renderLibrary, renderProgram, runBuilder, makeExecutable
) where
import qualified System.Directory as IO
......@@ -74,6 +73,10 @@ customBuild rs opts target@Target {..} = do
Stdout output <- cmd (Stdin input) [path] argList
writeFileChanged file output
Make dir -> do
need [dir -/- "Makefile"]
cmd Shell cmdEcho path ["-C", dir] argList
_ -> cmd [path] argList
cmdEcho :: CmdOption
......@@ -140,14 +143,6 @@ fixFile file f = do
return new
liftIO $ writeFile file contents
runMake :: FilePath -> [String] -> Action ()
runMake dir args = do
need [dir -/- "Makefile"]
path <- builderPath Make
let note = if null args then "" else " (" ++ intercalate ", " args ++ ")"
putBuild $ "| Run make" ++ note ++ " in " ++ dir ++ "..."
quietly $ cmd Shell cmdEcho path ["-C", dir] args
applyPatch :: FilePath -> FilePath -> Action ()
applyPatch dir patch = do
let file = dir -/- patch
......
......@@ -84,7 +84,7 @@ gmpRules = do
[gmpBuildPath -/- "Makefile.in"]
[gmpBuildPath -/- "Makefile"]
runMake gmpBuildPath ["MAKEFLAGS="]
build $ Target gmpContext (Make gmpBuildPath) [] []
createDirectory $ takeDirectory gmpLibraryH
copyFile (gmpBuildPath -/- "gmp.h") gmpLibraryH
......
......@@ -99,7 +99,7 @@ libffiRules = do
-- The old build system did runMake libffiBuildPath ["MAKEFLAGS="]
-- TODO: Find out why. It seems redundant, so I removed it.
runMake libffiBuildPath ["MAKEFLAGS=", "install"]
build $ Target libffiContext (Make libffiBuildPath) [] []
let ffiHDir = libffiBuildPath -/- "inst/lib" -/- libname -/- "include"
forM_ ["ffi.h", "ffitarget.h"] $ \file -> do
......
......@@ -3,13 +3,14 @@ module Rules.Test (testRules) where
import Base
import Builder
import Expression
import GHC (rts, libffi)
import GHC (compiler, rts, libffi)
import Oracles.Config.Flag
import Oracles.Config.Setting
import Oracles.WindowsPath
import Rules.Actions
import Settings.Packages
import Settings.User
import Target
-- TODO: clean up after testing
testRules :: Rules ()
......@@ -18,7 +19,7 @@ testRules = do
needBuilder $ Ghc Compile Stage2
needBuilder $ GhcPkg Stage1
needBuilder Hpc
runMake "testsuite/tests" ["fast"]
build $ Target (vanillaContext Stage2 compiler) (Make "testsuite/tests") [] []
"test" ~> do
let yesNo x = show $ if x then "YES" else "NO"
......
......@@ -17,6 +17,7 @@ import Settings.Builders.Happy
import Settings.Builders.Hsc2Hs
import Settings.Builders.HsCpp
import Settings.Builders.Ld
import Settings.Builders.Make
import Settings.Builders.Tar
import Settings.Flavours.Quick
import Settings.Packages.Base
......@@ -66,6 +67,7 @@ defaultBuilderArgs = mconcat
, hsc2hsBuilderArgs
, hsCppBuilderArgs
, ldBuilderArgs
, makeBuilderArgs
, tarBuilderArgs ]
defaultPackageArgs :: Args
......
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