Merge initial Hadrian snapshot
[ghc.git] / hadrian / src / Rules / Clean.hs
1 module Rules.Clean (clean, cleanSourceTree, cleanRules) where
2
3 import Base
4
5 clean :: Action ()
6 clean = do
7 cleanSourceTree
8 putBuild "| Remove Hadrian files..."
9 path <- buildRoot
10 removeDirectory $ path -/- generatedDir
11 removeFilesAfter path ["//*"]
12 putSuccess "| Done. "
13
14 cleanSourceTree :: Action ()
15 cleanSourceTree = do
16 path <- buildRoot
17 forM_ [Stage0 ..] $ removeDirectory . (path -/-) . stageString
18 removeDirectory inplaceBinPath
19 removeDirectory inplaceLibPath
20 removeDirectory "sdistprep"
21
22 cleanRules :: Rules ()
23 cleanRules = "clean" ~> clean