summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings/Builders/Ghc.hs
diff options
context:
space:
mode:
authorJames Foster <ratherforky@gmail.com>2019-10-13 02:21:37 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-10-25 09:01:08 -0400
commit87175e7870949438401213b8e28ee2722b3de6fd (patch)
tree3ca0522dc80536548a70b2a89b379f287859e439 /hadrian/src/Settings/Builders/Ghc.hs
parent243c72eb60fc3481fe6db3fc0ea9cd836a9e7561 (diff)
downloadhaskell-87175e7870949438401213b8e28ee2722b3de6fd.tar.gz
Make Hadrian use -dynamic-too in the basic case
This commit makes Hadrian use the `-dynamic-too` flag when the current Flavour's libraryWays contains both vanilla and dynamic, cutting down the amount of repeated work caused by separate compilation of dynamic and static files. It does this for the basic case where '.o' and '.dyn_o' files are built with one command, but does not generalise to cases like '.prof_o' and '.prof_dyn_o'.
Diffstat (limited to 'hadrian/src/Settings/Builders/Ghc.hs')
-rw-r--r--hadrian/src/Settings/Builders/Ghc.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs
index 54315484c1..60fd8fa726 100644
--- a/hadrian/src/Settings/Builders/Ghc.hs
+++ b/hadrian/src/Settings/Builders/Ghc.hs
@@ -30,7 +30,13 @@ toolArgs = do
compileAndLinkHs :: Args
compileAndLinkHs = (builder (Ghc CompileHs) ||^ builder (Ghc LinkHs)) ? do
+ ways <- getLibraryWays
+ let hasVanilla = elem vanilla ways
+ hasDynamic = elem dynamic ways
mconcat [ arg "-Wall"
+ , (hasVanilla && hasDynamic) ? builder (Ghc CompileHs) ?
+ platformSupportsSharedLibs ? way vanilla ?
+ arg "-dynamic-too"
, commonGhcArgs
, ghcLinkArgs
, defaultGhcWarningsArgs