summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorDavid Eichmann <EichmannD@gmail.com>2019-04-16 15:10:35 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-06-09 18:46:46 -0400
commit69c58f8abbb0b51eca1f0004a8d8c1cee0c8f766 (patch)
tree8f13ff31dcb8be6d53e7adcbd78bfb2c361157ae /hadrian
parent8a48a8a4e2f14f7f01aa1d4cf249420c908edb73 (diff)
downloadhaskell-69c58f8abbb0b51eca1f0004a8d8c1cee0c8f766.tar.gz
Hadrian: need CPP preprocessor dependencies #16660
Use the new -include-cpp-deps ghc option (#16521) when generating .dependencies files in hadrian. This is version gated as -include-cpp-deps is a relatively new option.
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/src/Settings/Builders/Ghc.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs
index db368f9b91..99165fba06 100644
--- a/hadrian/src/Settings/Builders/Ghc.hs
+++ b/hadrian/src/Settings/Builders/Ghc.hs
@@ -1,5 +1,9 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+
module Settings.Builders.Ghc (ghcBuilderArgs, haddockGhcArgs) where
+import Data.List.Extra (splitOn)
+
import Hadrian.Haskell.Cabal
import Hadrian.Haskell.Cabal.Type
@@ -131,7 +135,16 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
findHsDependencies :: Args
findHsDependencies = builder (Ghc FindHsDependencies) ? do
ways <- getLibraryWays
+ stage <- getStage
+ ghcVersion :: [Int] <- fmap read . splitOn "." <$> expr (ghcVersionStage stage)
mconcat [ arg "-M"
+
+ -- "-include-cpp-deps" is a new ish feature so is version gated.
+ -- Without this feature some dependencies will be missing in stage0.
+ -- TODO Remove version gate when minimum supported Stage0 compiler
+ -- is >= 8.9.0.
+ , ghcVersion > [8,9,0] ? arg "-include-cpp-deps"
+
, commonGhcArgs
, arg "-include-pkg-deps"
, arg "-dep-makefile", arg =<< getOutput