From 015a21b8990a7fcf0d9d31a951af3ae8b06076c4 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 7 Apr 2019 10:24:03 -0400 Subject: hadrian: Make settings stage specific --- hadrian/src/Rules/Generate.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs index b2a3c16587..0787978938 100644 --- a/hadrian/src/Rules/Generate.hs +++ b/hadrian/src/Rules/Generate.hs @@ -162,7 +162,6 @@ copyRules = do prefix -/- "llvm-targets" <~ return "." prefix -/- "llvm-passes" <~ return "." prefix -/- "platformConstants" <~ (buildRoot <&> (-/- generatedDir)) - prefix -/- "settings" <~ (buildRoot <&> (-/- generatedDir)) prefix -/- "template-hsc.h" <~ return (pkgPath hsc2hs) prefix -/- "html//*" <~ return "utils/haddock/haddock-api/resources" @@ -178,7 +177,10 @@ generateRules = do priority 2.0 $ (root -/- generatedDir -/- "ghcautoconf.h") <~ generateGhcAutoconfH priority 2.0 $ (root -/- generatedDir -/- "ghcplatform.h") <~ generateGhcPlatformH priority 2.0 $ (root -/- generatedDir -/- "ghcversion.h") <~ generateGhcVersionH - priority 2.0 $ (root -/- generatedDir -/- "settings") <~ generateSettings + forM_ [Stage0 ..] $ \stage -> do + let prefix = root -/- stageString stage -/- "lib" + go gen file = generate file (semiEmptyTarget stage) gen + priority 2.0 $ (prefix -/- "settings") %> go generateSettings -- TODO: simplify, get rid of fake rts context root -/- generatedDir ++ "//*" %> \file -> do @@ -190,6 +192,10 @@ generateRules = do -- TODO: Use the Types, Luke! (drop partial function) -- We sometimes need to evaluate expressions that do not require knowing all -- information about the context. In this case, we don't want to know anything. +semiEmptyTarget :: Stage -> Context +semiEmptyTarget stage = vanillaContext stage + (error "Rules.Generate.emptyTarget: unknown package") + emptyTarget :: Context emptyTarget = vanillaContext (error "Rules.Generate.emptyTarget: unknown stage") (error "Rules.Generate.emptyTarget: unknown package") -- cgit v1.2.1