Drop the redundant build rule for literate Perl scripts
[hadrian.git] / src / Main.hs
1 module Main (main) where
2
3 import Development.Shake
4 import Hadrian.Expression
5 import Hadrian.Utilities
6
7 import qualified Base
8 import qualified CommandLine
9 import qualified Environment
10 import qualified Rules
11 import qualified Rules.Clean
12 import qualified Rules.Documentation
13 import qualified Rules.Install
14 import qualified Rules.SourceDist
15 import qualified Rules.Selftest
16 import qualified Rules.Test
17 import qualified UserSettings
18
19 main :: IO ()
20 main = do
21 -- Provide access to command line arguments and some user settings through
22 -- Shake's type-indexed map 'shakeExtra'.
23 argsMap <- CommandLine.cmdLineArgsMap
24 let extra = insertExtra UserSettings.buildProgressColour
25 $ insertExtra UserSettings.successColour
26 $ insertExtra UserSettings.userBuildRoot
27 $ insertExtra (VerboseCommand UserSettings.verboseCommand) argsMap
28
29 BuildRoot buildRoot = UserSettings.userBuildRoot
30
31 options :: ShakeOptions
32 options = shakeOptions
33 { shakeChange = ChangeModtimeAndDigest
34 , shakeFiles = buildRoot -/- Base.shakeFilesDir
35 , shakeProgress = progressSimple
36 , shakeTimings = True
37 , shakeExtra = extra }
38
39 rules :: Rules ()
40 rules = do
41 Rules.buildRules
42 Rules.Documentation.documentationRules
43 Rules.Clean.cleanRules
44 Rules.Install.installRules
45 Rules.oracleRules
46 Rules.Selftest.selftestRules
47 Rules.SourceDist.sourceDistRules
48 Rules.Test.testRules
49 Rules.topLevelTargets
50
51 shakeArgsWith options CommandLine.optDescrs $ \_ targets -> do
52 Environment.setupEnvironment
53 return . Just $ if null targets
54 then rules
55 else want targets >> withoutActions rules