[commit: ghc] wip/nfs-locking: Add Make builder. (f31a7de)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:29:56 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/f31a7de2d4a6886edc64ff5bfb3301bbdee7cc2c/ghc

>---------------------------------------------------------------

commit f31a7de2d4a6886edc64ff5bfb3301bbdee7cc2c
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Tue May 10 00:32:04 2016 +0100

    Add Make builder.


>---------------------------------------------------------------

f31a7de2d4a6886edc64ff5bfb3301bbdee7cc2c
 hadrian.cabal        |  1 +
 src/Builder.hs       |  4 ++--
 src/Rules/Actions.hs | 19 +++++++------------
 src/Rules/Gmp.hs     |  2 +-
 src/Rules/Libffi.hs  |  2 +-
 src/Rules/Test.hs    |  5 +++--
 src/Settings/Args.hs |  2 ++
 7 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/hadrian.cabal b/hadrian.cabal
index 160a5d0..2dfd9e9 100644
--- a/hadrian.cabal
+++ b/hadrian.cabal
@@ -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
diff --git a/src/Builder.hs b/src/Builder.hs
index a205067..76f0988 100644
--- a/src/Builder.hs
+++ b/src/Builder.hs
@@ -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"
diff --git a/src/Rules/Actions.hs b/src/Rules/Actions.hs
index 4928e00..4a0844b 100644
--- a/src/Rules/Actions.hs
+++ b/src/Rules/Actions.hs
@@ -1,8 +1,7 @@
 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 at 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
diff --git a/src/Rules/Gmp.hs b/src/Rules/Gmp.hs
index 1121d5d..fe5b684 100644
--- a/src/Rules/Gmp.hs
+++ b/src/Rules/Gmp.hs
@@ -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
diff --git a/src/Rules/Libffi.hs b/src/Rules/Libffi.hs
index 20d5acf..3269a31 100644
--- a/src/Rules/Libffi.hs
+++ b/src/Rules/Libffi.hs
@@ -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
diff --git a/src/Rules/Test.hs b/src/Rules/Test.hs
index 544b5d9..7ec5e04 100644
--- a/src/Rules/Test.hs
+++ b/src/Rules/Test.hs
@@ -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"
diff --git a/src/Settings/Args.hs b/src/Settings/Args.hs
index b7c369f..d8c3649 100644
--- a/src/Settings/Args.hs
+++ b/src/Settings/Args.hs
@@ -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



More information about the ghc-commits mailing list