summaryrefslogtreecommitdiff
path: root/hadrian/src/Rules.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hadrian/src/Rules.hs')
-rw-r--r--hadrian/src/Rules.hs33
1 files changed, 1 insertions, 32 deletions
diff --git a/hadrian/src/Rules.hs b/hadrian/src/Rules.hs
index db3b16bddd..eee14161cd 100644
--- a/hadrian/src/Rules.hs
+++ b/hadrian/src/Rules.hs
@@ -24,43 +24,12 @@ import qualified Rules.Program
import qualified Rules.Register
import qualified Rules.Rts
import qualified Rules.SimpleTargets
+import Rules.ToolArgs
import Settings
import Settings.Program (programContext)
import Target
import UserSettings
--- | @tool-args@ is used by tooling in order to get the arguments necessary
--- to set up a GHC API session which can compile modules from GHC. When
--- run, the target prints out the arguments that would be passed to @ghc@
--- during normal compilation to @stdout@.
---
--- This target is called by the `ghci` script in order to load all of GHC's
--- modules into GHCi.
-toolArgsTarget :: Rules ()
-toolArgsTarget = do
- "tool-args" ~> do
- -- We can't build DLLs on Windows (yet). Actually we should only
- -- include the dynamic way when we have a dynamic host GHC, but just
- -- checking for Windows seems simpler for now.
- let fake_target = target (Context Stage0 compiler (if windowsHost then vanilla else dynamic))
- (Ghc ToolArgs Stage0) [] ["ignored"]
-
- -- need the autogenerated files so that they are precompiled
- includesDependencies Stage0 >>= need
- interpret fake_target Rules.Generate.compilerDependencies >>= need
-
- root <- buildRoot
- let dir = buildDir (vanillaContext Stage0 compiler)
- need [ root -/- dir -/- "Config.hs" ]
- need [ root -/- dir -/- "GHC" -/- "Parser.hs" ]
- need [ root -/- dir -/- "GHC" -/- "Parser" -/- "Lexer.hs" ]
- need [ root -/- dir -/- "GHC" -/- "Cmm" -/- "Parser.hs" ]
- need [ root -/- dir -/- "GHC" -/- "Cmm" -/- "Lexer.hs" ]
-
- -- Find out the arguments that are needed to load a module into the
- -- session
- arg_list <- interpret fake_target getArgs
- liftIO $ putStrLn (intercalate "\n" arg_list)
allStages :: [Stage]
allStages = [minBound .. maxBound]