Expression: Don't re-export Base
[hadrian.git] / src / Rules.hs
1 module Rules (generateTargets, packageRules) where
2
3 import Base
4 import Expression
5 import Rules.Install
6 import Rules.Package
7 import Rules.Resources
8 import Settings
9
10 -- TODO: not all program targets should be needed explicitly
11 -- | generateTargets needs top-level build targets
12 generateTargets :: Rules ()
13 generateTargets = action $ do
14 targets <- fmap concat . forM [Stage0 ..] $ \stage -> do
15 pkgs <- interpretWithStage stage getPackages
16 let libPkgs = filter isLibrary pkgs
17 libTargets <- fmap concat . forM libPkgs $ \pkg -> do
18 let target = PartialTarget stage pkg
19 needHaddock <- interpretPartial target buildHaddock
20 return [ pkgHaddockFile pkg | needHaddock && stage == Stage1 ]
21 let programTargets = [ prog | Just prog <- programPath stage <$> pkgs ]
22 return $ libTargets ++ programTargets
23
24 need $ targets ++ installTargets
25
26 packageRules :: Rules ()
27 packageRules = do
28 resources <- resourceRules
29 forM_ [Stage0 ..] $ \stage ->
30 forM_ knownPackages $ \pkg ->
31 buildPackage resources $ PartialTarget stage pkg