[commit: ghc] wip/nfs-locking: Continue refactoring of generated dependencies. (64f9350)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:53:35 UTC 2017


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

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

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

commit 64f93509197b23722bf14928ce50c5a3930b4d27
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Mon Jan 4 19:59:27 2016 +0000

    Continue refactoring of generated dependencies.


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

64f93509197b23722bf14928ce50c5a3930b4d27
 src/Rules/Dependencies.hs |  4 +--
 src/Rules/Generate.hs     | 87 ++++++++++++++++++++++++++---------------------
 2 files changed, 50 insertions(+), 41 deletions(-)

diff --git a/src/Rules/Dependencies.hs b/src/Rules/Dependencies.hs
index 5b51c1d..b0dd474 100644
--- a/src/Rules/Dependencies.hs
+++ b/src/Rules/Dependencies.hs
@@ -18,13 +18,13 @@ buildPackageDependencies _ target @ (PartialTarget stage pkg) =
     in do
         [ buildPath ++ "//*.c.deps", buildPath ++ "//*.cmm.deps" ] |%> \out -> do
             let srcFile = dropBuild . dropExtension $ out
-            orderOnly $ generatedDependencies stage pkg
+            orderOnly $ generatedDependencies stage
             need [srcFile]
             build $ fullTarget target (GccM stage) [srcFile] [out]
 
         hDepFile %> \out -> do
             srcs <- interpretPartial target getPackageSources
-            orderOnly $ generatedDependencies stage pkg
+            orderOnly $ generatedDependencies stage
             need srcs
             if srcs == []
             then writeFileChanged out ""
diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs
index 21c197b..140c978 100644
--- a/src/Rules/Generate.hs
+++ b/src/Rules/Generate.hs
@@ -16,6 +16,7 @@ import Oracles.ModuleFiles
 import Rules.Actions
 import Rules.Resources (Resources)
 import Settings
+import Settings.Builders.DeriveConstants
 
 primopsSource :: FilePath
 primopsSource = "compiler/prelude/primops.txt.pp"
@@ -26,47 +27,55 @@ primopsTxt stage = targetPath stage compiler -/- "build/primops.txt"
 platformH :: Stage -> FilePath
 platformH stage = targetPath stage compiler -/- "ghc_boot_platform.h"
 
-derivedConstantsPath :: FilePath
-derivedConstantsPath = "includes/dist-derivedconstants/header"
-
-defaultGeneratedDependencies :: [FilePath]
-defaultGeneratedDependencies = 
-    [ "includes/ghcautoconf.h"
-    , "includes/ghcplatform.h"
-    , derivedConstantsPath -/- "DerivedConstants.h"
-    , derivedConstantsPath -/- "GHCConstantsHaskellType.hs"
-    , derivedConstantsPath -/- "GHCConstantsHaskellWrappers.hs"
-    , derivedConstantsPath -/- "GHCConstantsHaskellExports.hs" 
-    , targetPath Stage1 rts -/- "build/ffi.h"
-    , targetPath Stage1 rts -/- "build/ffitarget.h" ]
+includesDependencies :: [FilePath]
+includesDependencies = ("includes" -/-) <$> 
+    [ "ghcautoconf.h"
+    , "ghcplatform.h"
+    , "ghcversion.h" ]
+
+derivedConstantsDependencies :: [FilePath]
+derivedConstantsDependencies = (derivedConstantsPath -/-) <$> []
+    -- [ "DerivedConstants.h"
+    -- , "GHCConstantsHaskellType.hs"
+    -- , "GHCConstantsHaskellWrappers.hs"
+    -- , "GHCConstantsHaskellExports.hs" ]
+
+libffiDependencies :: [FilePath]
+libffiDependencies = (targetPath Stage1 rts -/-) <$>
+    [ "build/ffi.h"
+    , "build/ffitarget.h" ]
+
+defaultDependencies :: [FilePath]
+defaultDependencies =
+    includesDependencies ++ derivedConstantsDependencies ++ libffiDependencies
+
+compilerDependencies :: Stage -> [FilePath]
+compilerDependencies stage =
+    [ platformH stage ]
+    ++
+    fmap ((targetPath stage compiler -/- "build") -/-)
+    [ "primop-vector-uniques.hs-incl"
+    , "primop-data-decl.hs-incl"
+    , "primop-tag.hs-incl"
+    , "primop-list.hs-incl"
+    , "primop-strictness.hs-incl"
+    , "primop-fixity.hs-incl"
+    , "primop-primop-info.hs-incl"
+    , "primop-out-of-line.hs-incl"
+    , "primop-has-side-effects.hs-incl"
+    , "primop-can-fail.hs-incl"
+    , "primop-code-size.hs-incl"
+    , "primop-commutable.hs-incl"
+    , "primop-vector-tys-exports.hs-incl"
+    , "primop-vector-tycons.hs-incl"
+    , "primop-vector-tys.hs-incl" ]
 
 -- TODO: can we drop COMPILER_INCLUDES_DEPS += $(includes_GHCCONSTANTS)?
-generatedDependencies :: Stage -> Package -> [FilePath]
-generatedDependencies stage pkg = 
-    defaultGeneratedDependencies ++ extraGeneratedDependencies
-  where
-    extraGeneratedDependencies
-        | pkg == compiler = let buildPath = targetPath stage compiler -/- "build"
-                            in
-                            [ platformH stage ]
-                            ++
-                            fmap (buildPath -/-)
-                            [ "primop-vector-uniques.hs-incl"
-                            , "primop-data-decl.hs-incl"
-                            , "primop-tag.hs-incl"
-                            , "primop-list.hs-incl"
-                            , "primop-strictness.hs-incl"
-                            , "primop-fixity.hs-incl"
-                            , "primop-primop-info.hs-incl"
-                            , "primop-out-of-line.hs-incl"
-                            , "primop-has-side-effects.hs-incl"
-                            , "primop-can-fail.hs-incl"
-                            , "primop-code-size.hs-incl"
-                            , "primop-commutable.hs-incl"
-                            , "primop-vector-tys-exports.hs-incl"
-                            , "primop-vector-tycons.hs-incl"
-                            , "primop-vector-tys.hs-incl" ]
-        | otherwise = []
+-- TODO: improve
+generatedDependencies :: Stage -> [FilePath]
+generatedDependencies stage 
+    | stage == Stage1 = defaultDependencies ++ compilerDependencies stage
+    | otherwise = []
 
 -- The following generators and corresponding source extensions are supported:
 knownGenerators :: [ (Builder, String) ]



More information about the ghc-commits mailing list