summaryrefslogtreecommitdiff
path: root/hadrian/src/Rules/Clean.hs
blob: d11cbf5e53bfac9f19f73c0890145ac120dd2fcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Rules.Clean (clean, cleanSourceTree, cleanRules) where

import Base

clean :: Action ()
clean = do
    cleanSourceTree
    putBuild "| Remove Hadrian files..."
    path <- buildRoot
    removeDirectory $ path -/- generatedDir
    removeFilesAfter path ["//*"]
    putSuccess "| Done. "

cleanSourceTree :: Action ()
cleanSourceTree = do
    path <- buildRoot
    forM_ [Stage0 ..] $ removeDirectory . (path -/-) . stageString
    removeDirectory inplaceBinPath
    removeDirectory inplaceLibPath
    removeDirectory "sdistprep"

cleanRules :: Rules ()
cleanRules = "clean" ~> clean