Rules.hs 971 Bytes
Newer Older
1
module Rules (
2
    oracleRules, cabalRules, configRules, packageRules, generateTargets
3
4
    ) where

5
import Base
6
import Util
7
import Stage
Andrey Mokhov's avatar
Andrey Mokhov committed
8
import Expression
9
import Rules.Cabal
10
import Rules.Config
11
import Rules.Package
12
import Rules.Oracles
13
import Settings.Packages
14
import Settings.TargetDirectory
15

16
-- generateTargets needs package-data.mk files of all target packages
17
-- TODO: make interpretDiff total
18
generateTargets :: Rules ()
19
20
generateTargets = action $ do
    targets <- fmap concat . forM [Stage0 ..] $ \stage -> do
21
        pkgs <- interpret (stageTarget stage) packages
22
23
24
25
        fmap concat . forM pkgs $ \pkg -> return
            [ targetPath stage pkg -/- "build/haskell.deps"
            , targetPath stage pkg -/- "build/c.deps" ]
    need targets
26

27
-- TODO: add Stage2 (compiler only?)
28
packageRules :: Rules ()
Andrey Mokhov's avatar
Andrey Mokhov committed
29
packageRules =
30
    forM_ [Stage0, Stage1] $ \stage -> do
31
        forM_ knownPackages $ \pkg -> do
32
            buildPackage (stagePackageTarget stage pkg)