d1c7cf2bf504ad336930a2d6f3ae5a1575117aee
[ghc.git] / src / Rules / Configure.hs
1 module Rules.Configure (configureRules) where
2
3 import qualified System.Info
4
5 import Base
6 import Builder
7 import CmdLineFlag (cmdSkipConfigure)
8 import Context
9 import GHC (compiler)
10 import Rules.Actions
11 import Rules.Generators.GhcAutoconfH
12 import Stage
13 import Target
14
15 configureRules :: Rules ()
16 configureRules = do
17 [configFile, "settings", configH] &%> \outs -> do
18 if cmdSkipConfigure
19 then unlessM (doesFileExist configFile) $
20 putError $ "Configuration file " ++ configFile ++ " is missing."
21 ++ "\nRun the configure script manually or do not use the "
22 ++ "--skip-configure flag."
23 else do
24 -- We cannot use windowsHost here due to a cyclic dependency.
25 when (System.Info.os == "mingw32") $ do
26 putBuild "| Checking for Windows tarballs..."
27 quietly $ cmd [ "bash"
28 , "mk/get-win32-tarballs.sh"
29 , "download"
30 , System.Info.arch ]
31 let srcs = map (<.> "in") outs
32 context = vanillaContext Stage0 compiler
33 need srcs
34 build $ Target context (Configure ".") srcs outs
35
36 ["configure", configH <.> "in"] &%> \_ -> do
37 if cmdSkipConfigure
38 then unlessM (doesFileExist "configure") $
39 putError $ "The configure script is missing.\nRun the boot script"
40 ++ " manually or do not use the --skip-configure flag."
41 else do
42 need ["configure.ac"]
43 putBuild "| Running boot..."
44 quietly $ cmd (EchoStdout False) "perl boot"