Skip to content

Commit 293a102

Browse files
committed
add cleaning script
1 parent 2d99859 commit 293a102

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

plinth-clean.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Clean all build directories created by plinth-build.sh
5+
#
6+
# Usage:
7+
# ./plinth-clean.sh # clean everything
8+
# ./plinth-clean.sh plinth # clean only the plinth (cabal) build
9+
# ./plinth-clean.sh ghc # clean only the GHC (hadrian) build
10+
# ./plinth-clean.sh tools # clean only locally built tools (happy, alex)
11+
12+
what="${1:-all}"
13+
14+
case "$what" in
15+
plinth)
16+
echo "Cleaning plinth build..."
17+
rm -rf _build/stage-plinth
18+
(cd plinth && rm -rf dist-newstyle)
19+
;;
20+
ghc)
21+
echo "Cleaning GHC build..."
22+
rm -rf _build/stage0 _build/stage1 _build/bindist
23+
# clean configure artifacts
24+
rm -f mk/config.h mk/config.mk config.log config.status
25+
;;
26+
tools)
27+
echo "Cleaning locally built tools..."
28+
rm -rf _build/tools
29+
;;
30+
all)
31+
echo "Cleaning all build directories..."
32+
rm -rf _build
33+
(cd plinth && rm -rf dist-newstyle)
34+
# clean configure artifacts
35+
rm -f mk/config.h mk/config.mk config.log config.status
36+
;;
37+
*)
38+
echo "Usage: $0 [all|ghc|plinth|tools]"
39+
exit 1
40+
;;
41+
esac
42+
43+
echo "Done."

0 commit comments

Comments
 (0)