blob: 8f34310545c08e9f98ab025cb027c9b790868eb9 [file] [log] [blame]
Devon H. O'Dell553be842009-11-14 15:29:09 -08001#!/usr/bin/env bash
Rob Pike69b74c32008-06-12 13:26:16 -07002# Copyright 2009 The Go Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style
4# license that can be found in the LICENSE file.
5
Christopher Wedgwood2ef330e2009-12-13 12:27:19 -08006set -e
7
Christopher Wedgwoodbdeebf42010-08-19 00:09:11 -04008if [ ! -f env.bash ]; then
9 echo 'clean.bash must be run from $GOROOT/src' 1>&2
Christopher Wedgwood2ef330e2009-12-13 12:27:19 -080010 exit 1
11fi
Christopher Wedgwoodbdeebf42010-08-19 00:09:11 -040012. ./env.bash
13if [ ! -f Make.inc ] ; then
14 GOROOT_FINAL=${GOROOT_FINAL:-$GOROOT}
15 sed 's!@@GOROOT@@!'"$GOROOT_FINAL"'!' Make.inc.in >Make.inc
Andrew Gerrandd34174c2010-07-22 10:15:36 +100016fi
Devon H. O'Dell857d4cf2009-12-11 15:14:09 -080017
Andrew Gerrand3402c5e2010-07-30 14:00:59 +100018if [ "$1" != "--nopkg" ]; then
19 rm -rf "$GOROOT"/pkg/${GOOS}_$GOARCH
20fi
Sergio Luis O. B. Correia6fc82072009-11-23 17:32:51 -080021rm -f "$GOROOT"/lib/*.a
Russ Cox219fb022009-10-22 10:59:27 -070022for i in lib9 libbio libcgo libmach cmd pkg \
Russ Cox11d38052009-10-03 10:38:03 -070023 ../misc/cgo/gmp ../misc/cgo/stdio \
Russ Coxd3be2e32010-02-09 13:33:00 -080024 ../test/bench ../test/garbage
Russ Cox11d38052009-10-03 10:38:03 -070025do(
Devon H. O'Dell857d4cf2009-12-11 15:14:09 -080026 cd "$GOROOT"/src/$i || exit 1
Russ Cox11d38052009-10-03 10:38:03 -070027 if test -f clean.bash; then
Russ Cox72e3b202008-09-19 11:55:46 -070028 bash clean.bash
Russ Cox11d38052009-10-03 10:38:03 -070029 else
Christian Himpel5c603db2010-08-30 15:40:56 -040030 gomake clean
Russ Cox11d38052009-10-03 10:38:03 -070031 fi
32)done