OILS / build / clean.sh View on Github | oilshell.org

65 lines, 30 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# build/clean.sh <function name>
5
6set -o nounset
7set -o pipefail
8
9# Ignore errors caused by not being root
10# set -o errexit
11
12# To test building stdlib.
13clean-pyc() {
14 # skip _chroot, _tmp, etc. But delete __init__.pyc
15 find . \( -type d -a -name '_*' -a -prune \) -o -name '*.pyc' -a -print |
16 xargs --no-run-if-empty -- rm --verbose
17}
18
19py() {
20 rm -f --verbose *.so
21 rm -r -f --verbose _devbuild _cache
22
23 # These can be stale after renaming things
24 clean-pyc
25}
26
27cpp() {
28 ### e.g. to time ninja build
29 rm -r -f --verbose _bin _build _gen _release _test build.ninja
30
31 clean-pyc
32
33 # _release is for docs
34}
35
36all() {
37 rm -r -f --verbose _tmp
38 # TODO: the _deps dir should be obsolete, after removing devtools/release.sh
39 # dep-benchmarks
40
41 py
42 cpp
43}
44
45# This is 'make clean' for the oil.ovm build.
46#
47# - Take care not to remove _build/oil/bytecode-opy.zip, etc.
48# - There are no object files written now.
49# - We're not cleaning _build/detect-config.* ?
50
51source-tarball-build() {
52 rm -f -v _bin/oil.{ovm,ovm-dbg}
53 # NOTE: delete ovm-opt, ovm-opt.{stripped,symbols}
54 rm -f -v \
55 _build/oil/{ovm-opt,ovm-dbg} \
56 _build/oil/ovm-opt.{stripped,symbols}
57}
58
59
60if test $# -eq 0; then
61 # clean all if no args
62 all
63else
64 "$@"
65fi