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

Implement clean target.

Fix #131.
parent 1b08589b
......@@ -39,6 +39,7 @@ executable ghc-shake
, Rules
, Rules.Actions
, Rules.Cabal
, Rules.Clean
, Rules.Compile
, Rules.Config
, Rules.Data
......
......@@ -6,6 +6,7 @@ import qualified Base
import CmdLineFlag
import qualified Rules
import qualified Rules.Cabal
import qualified Rules.Clean
import qualified Rules.Config
import qualified Rules.Generate
import qualified Rules.Gmp
......@@ -24,6 +25,7 @@ main = shakeArgsWith options flags $ \cmdLineFlags targets -> do
rules :: Rules ()
rules = mconcat
[ Rules.Cabal.cabalRules
, Rules.Clean.cleanRules
, Rules.Config.configRules
, Rules.Generate.copyRules
, Rules.Generate.generateRules
......
module Rules.Clean (cleanRules) where
import Base
import Package
import Rules.Generate
import Settings.Packages
import Settings.Paths
import Settings.User
import Stage
cleanRules :: Rules ()
cleanRules = do
"clean" ~> do
putBuild $ "| Remove files in " ++ buildRootPath ++ "..."
removeFilesAfter buildRootPath ["//*"]
putBuild $ "| Remove files in " ++ programInplacePath ++ "..."
removeFilesAfter programInplacePath ["//*"]
putBuild $ "| Remove files in inplace/lib..."
removeFilesAfter "inplace/lib" ["//*"]
putBuild $ "| Remove files in " ++ derivedConstantsPath ++ "..."
removeFilesAfter derivedConstantsPath ["//*"]
forM_ includesDependencies $ \file -> do
putBuild $ "| Remove " ++ file
removeFileIfExists file
putBuild $ "| Remove files generated by ghc-cabal..."
forM_ knownPackages $ \pkg ->
forM_ [Stage0 ..] $ \stage -> do
let dir = pkgPath pkg -/- targetDirectory stage pkg
removeDirectoryIfExists dir
putSuccess $ "| Done. "
module Rules.Generate (
generatePackageCode, generateRules, installTargets, copyRules,
derivedConstantsPath, generatedDependencies
includesDependencies, derivedConstantsPath, generatedDependencies
) where
import Base
......
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