Commit e7f8710c authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Factor out build rules into Rules.buildRules.

parent 9207f253
......@@ -6,14 +6,8 @@ import qualified Base
import qualified CmdLineFlag
import qualified Environment
import qualified Rules
import qualified Rules.Cabal
import qualified Rules.Clean
import qualified Rules.Generate
import qualified Rules.Gmp
import qualified Rules.Libffi
import qualified Rules.Oracles
import qualified Rules.Perl
import qualified Rules.Setup
import qualified Selftest
import qualified Test
......@@ -27,17 +21,10 @@ main = shakeArgsWith options CmdLineFlag.cmdFlags $ \cmdLineFlags targets -> do
where
rules :: Rules ()
rules = mconcat
[ Rules.Cabal.cabalRules
, Rules.Clean.cleanRules
, Rules.Generate.generateRules
, Rules.Generate.copyRules
, Rules.Gmp.gmpRules
, Rules.Libffi.libffiRules
[ Rules.Clean.cleanRules
, Rules.Oracles.oracleRules
, Rules.Perl.perlScriptRules
, Rules.Setup.setupRules
, Rules.buildRules
, Rules.topLevelTargets
, Rules.packageRules
, Selftest.selftestRules
, Test.testRules ]
options = shakeOptions
......
module Rules (topLevelTargets, packageRules) where
module Rules (topLevelTargets, buildRules) where
import Base
import Data.Foldable
import Base
import Expression
import GHC hiding (haddock)
import GHC
import qualified Rules.Generate
import Rules.Package
import Rules.Resources
import qualified Rules.Package
import qualified Rules.Resources
import qualified Rules.Cabal
import qualified Rules.Gmp
import qualified Rules.Libffi
import qualified Rules.Perl
import qualified Rules.Setup
import Settings
allStages :: [Stage]
......@@ -32,16 +38,27 @@ topLevelTargets = do
when (pkg `elem` activePackages) $
if isLibrary pkg
then do -- build a library
ways <- interpretInContext context getLibraryWays
libs <- traverse (pkgLibraryFile stage pkg) ways
haddock <- interpretInContext context buildHaddock
need $ libs ++ [ pkgHaddockFile pkg | haddock && stage == Stage1 ]
ways <- interpretInContext context getLibraryWays
libs <- traverse (pkgLibraryFile stage pkg) ways
docs <- interpretInContext context buildHaddock
need $ libs ++ [ pkgHaddockFile pkg | docs && stage == Stage1 ]
else do -- otherwise build a program
need [ fromJust $ programPath stage pkg ] -- TODO: drop fromJust
packageRules :: Rules ()
packageRules = do
resources <- resourceRules
resources <- Rules.Resources.resourceRules
for_ allStages $ \stage ->
for_ knownPackages $ \pkg ->
buildPackage resources $ vanillaContext stage pkg
Rules.Package.buildPackage resources $ vanillaContext stage pkg
buildRules :: Rules ()
buildRules = mconcat
[ Rules.Cabal.cabalRules
, Rules.Generate.generateRules
, Rules.Generate.copyRules
, Rules.Gmp.gmpRules
, Rules.Libffi.libffiRules
, Rules.Perl.perlScriptRules
, Rules.Setup.setupRules
, Rules.packageRules ]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment