[commit: ghc] wip/nfs-locking: Use multiple output rules for *.o and *.hi files. (6ce7cd3)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:52:01 UTC 2017


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

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

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

commit 6ce7cd3ac8b3ba4ef0228dec9c8d4741f746a873
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Wed Jan 14 03:58:59 2015 +0000

    Use multiple output rules for *.o and *.hi files.


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

6ce7cd3ac8b3ba4ef0228dec9c8d4741f746a873
 src/Package/Compile.hs | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/src/Package/Compile.hs b/src/Package/Compile.hs
index d701af6..cd91c8e 100644
--- a/src/Package/Compile.hs
+++ b/src/Package/Compile.hs
@@ -29,13 +29,13 @@ suffixArgs way = arg ["-hisuf", hisuf way]
               <> arg [ "-osuf",  osuf way]
               <> arg ["-hcsuf", hcsuf way]
 
-oRule :: Package -> TodoItem -> Rules ()
-oRule (Package name path _) (stage, dist, settings) =
+buildPackageCompile :: Package -> TodoItem -> Rules ()
+buildPackageCompile (Package name path _) (stage, dist, settings) =
     let buildDir = toStandard $ path </> dist </> "build"
         pkgData  = path </> dist </> "package-data.mk"
-        depFile  = buildDir </> name <.> "m"
+        depFile  = buildDir </> takeBaseName name <.> "m"
     in
-    (buildDir <//> "*o") %> \out -> do
+    [buildDir <//> "*o", buildDir <//> "*hi"] &%> \[out, _] -> do
         let way  = detectWay $ tail $ takeExtension out
         need ["shake/src/Package/Compile.hs"]
         need [depFile]
@@ -49,23 +49,11 @@ oRule (Package name path _) (stage, dist, settings) =
             <> packageArgs stage pkgData
             <> includeArgs path dist
             <> concatArgs ["-optP"] (CppOpts pkgData)
-            -- TODO: use HC_OPTS from pkgData
+            <> arg (HsOpts pkgData)
             -- TODO: now we have both -O and -O2
-            <> arg ["-Wall", "-XHaskell2010", "-O2"]
+            -- <> arg ["-O2"]
             <> productArgs ["-odir", "-hidir", "-stubdir"] buildDir
             <> when (splitObjects stage) (arg "-split-objs")
             <> arg ("-c":srcs)
             <> arg ["-o", toStandard out]
 
--- TODO: This rule looks hacky... combine it with the above?
-hiRule :: Package -> TodoItem -> Rules ()
-hiRule (Package name path _) (stage, dist, settings) =
-    let buildDir = path </> dist </> "build"
-    in
-    (buildDir <//> "*hi") %> \out -> do
-        let way   = detectWay $ tail $ takeExtension out
-            oFile = out -<.> osuf way
-        need [oFile]
-
-buildPackageCompile :: Package -> TodoItem -> Rules ()
-buildPackageCompile = oRule <> hiRule



More information about the ghc-commits mailing list