[commit: ghc] wip/nfs-locking: Fix a loop in generated dependencies. (e651350)

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


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

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

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

commit e6513507c7e75050ba93724d8d7e79ecf6adf146
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Tue Jan 5 01:26:02 2016 +0000

    Fix a loop in generated dependencies.


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

e6513507c7e75050ba93724d8d7e79ecf6adf146
 src/Rules/Dependencies.hs                |  4 ++--
 src/Rules/Generate.hs                    | 31 ++++++++++++++++++-------------
 src/Settings/Builders/DeriveConstants.hs |  2 +-
 3 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/src/Rules/Dependencies.hs b/src/Rules/Dependencies.hs
index b0dd474..5b51c1d 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
+            orderOnly $ generatedDependencies stage pkg
             need [srcFile]
             build $ fullTarget target (GccM stage) [srcFile] [out]
 
         hDepFile %> \out -> do
             srcs <- interpretPartial target getPackageSources
-            orderOnly $ generatedDependencies stage
+            orderOnly $ generatedDependencies stage pkg
             need srcs
             if srcs == []
             then writeFileChanged out ""
diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs
index 140c978..13d5806 100644
--- a/src/Rules/Generate.hs
+++ b/src/Rules/Generate.hs
@@ -33,21 +33,20 @@ includesDependencies = ("includes" -/-) <$>
     , "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
+defaultDependencies = includesDependencies ++ libffiDependencies
+
+derivedConstantsDependencies :: [FilePath]
+derivedConstantsDependencies = (derivedConstantsPath -/-) <$>
+    [ "DerivedConstants.h"
+    , "GHCConstantsHaskellType.hs"
+    , "GHCConstantsHaskellWrappers.hs"
+    , "GHCConstantsHaskellExports.hs" ]
 
 compilerDependencies :: Stage -> [FilePath]
 compilerDependencies stage =
@@ -69,12 +68,18 @@ compilerDependencies stage =
     , "primop-vector-tys-exports.hs-incl"
     , "primop-vector-tycons.hs-incl"
     , "primop-vector-tys.hs-incl" ]
+    ++
+    if stage == Stage0
+    then defaultDependencies ++ derivedConstantsDependencies
+    else []
+
 
 -- TODO: can we drop COMPILER_INCLUDES_DEPS += $(includes_GHCCONSTANTS)?
--- TODO: improve
-generatedDependencies :: Stage -> [FilePath]
-generatedDependencies stage 
-    | stage == Stage1 = defaultDependencies ++ compilerDependencies stage
+generatedDependencies :: Stage -> Package -> [FilePath]
+generatedDependencies stage pkg
+    | pkg == compiler = compilerDependencies stage
+    | stage == Stage0 = defaultDependencies
+    | stage == Stage1 = derivedConstantsDependencies
     | otherwise = []
 
 -- The following generators and corresponding source extensions are supported:
diff --git a/src/Settings/Builders/DeriveConstants.hs b/src/Settings/Builders/DeriveConstants.hs
index 65c6c53..6f4828a 100644
--- a/src/Settings/Builders/DeriveConstants.hs
+++ b/src/Settings/Builders/DeriveConstants.hs
@@ -33,7 +33,7 @@ deriveConstantsBuilderArgs = builder DeriveConstants ? do
 
 includeCcArgs :: Args
 includeCcArgs = do
-    confCcArgs <- lift . settingList $ ConfCcArgs Stage1
+    confCcArgs <- getSettingList $ ConfCcArgs Stage1
     mconcat
         [ cArgs
         , cWarnings



More information about the ghc-commits mailing list