Devon H. O'Dell | 553be84 | 2009-11-14 15:29:09 -0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Rob Pike | 69b74c3 | 2008-06-12 13:26:16 -0700 | [diff] [blame] | 2 | # 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 Wedgwood | 2ef330e | 2009-12-13 12:27:19 -0800 | [diff] [blame] | 6 | set -e |
| 7 | |
Christopher Wedgwood | bdeebf4 | 2010-08-19 00:09:11 -0400 | [diff] [blame] | 8 | if [ ! -f env.bash ]; then |
| 9 | echo 'clean.bash must be run from $GOROOT/src' 1>&2 |
Christopher Wedgwood | 2ef330e | 2009-12-13 12:27:19 -0800 | [diff] [blame] | 10 | exit 1 |
| 11 | fi |
Christopher Wedgwood | bdeebf4 | 2010-08-19 00:09:11 -0400 | [diff] [blame] | 12 | . ./env.bash |
| 13 | if [ ! -f Make.inc ] ; then |
| 14 | GOROOT_FINAL=${GOROOT_FINAL:-$GOROOT} |
| 15 | sed 's!@@GOROOT@@!'"$GOROOT_FINAL"'!' Make.inc.in >Make.inc |
Andrew Gerrand | d34174c | 2010-07-22 10:15:36 +1000 | [diff] [blame] | 16 | fi |
Devon H. O'Dell | 857d4cf | 2009-12-11 15:14:09 -0800 | [diff] [blame] | 17 | |
Andrew Gerrand | 3402c5e | 2010-07-30 14:00:59 +1000 | [diff] [blame] | 18 | if [ "$1" != "--nopkg" ]; then |
| 19 | rm -rf "$GOROOT"/pkg/${GOOS}_$GOARCH |
| 20 | fi |
Sergio Luis O. B. Correia | 6fc8207 | 2009-11-23 17:32:51 -0800 | [diff] [blame] | 21 | rm -f "$GOROOT"/lib/*.a |
Russ Cox | 219fb02 | 2009-10-22 10:59:27 -0700 | [diff] [blame] | 22 | for i in lib9 libbio libcgo libmach cmd pkg \ |
Russ Cox | 11d3805 | 2009-10-03 10:38:03 -0700 | [diff] [blame] | 23 | ../misc/cgo/gmp ../misc/cgo/stdio \ |
Russ Cox | d3be2e3 | 2010-02-09 13:33:00 -0800 | [diff] [blame] | 24 | ../test/bench ../test/garbage |
Russ Cox | 11d3805 | 2009-10-03 10:38:03 -0700 | [diff] [blame] | 25 | do( |
Devon H. O'Dell | 857d4cf | 2009-12-11 15:14:09 -0800 | [diff] [blame] | 26 | cd "$GOROOT"/src/$i || exit 1 |
Russ Cox | 11d3805 | 2009-10-03 10:38:03 -0700 | [diff] [blame] | 27 | if test -f clean.bash; then |
Russ Cox | 72e3b20 | 2008-09-19 11:55:46 -0700 | [diff] [blame] | 28 | bash clean.bash |
Russ Cox | 11d3805 | 2009-10-03 10:38:03 -0700 | [diff] [blame] | 29 | else |
Christian Himpel | 5c603db | 2010-08-30 15:40:56 -0400 | [diff] [blame] | 30 | gomake clean |
Russ Cox | 11d3805 | 2009-10-03 10:38:03 -0700 | [diff] [blame] | 31 | fi |
| 32 | )done |