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 | 5a8f2ba | 2010-12-08 14:36:45 -0500 | [diff] [blame] | 22 | for i in lib9 libbio libmach cmd pkg \ |
Russ Cox | 11d3805 | 2009-10-03 10:38:03 -0700 | [diff] [blame] | 23 | ../misc/cgo/gmp ../misc/cgo/stdio \ |
Russ Cox | f9ca3b5 | 2011-03-07 10:37:42 -0500 | [diff] [blame] | 24 | ../misc/cgo/life ../misc/cgo/test \ |
Russ Cox | d3be2e3 | 2010-02-09 13:33:00 -0800 | [diff] [blame] | 25 | ../test/bench ../test/garbage |
Dave Cheney | 49a4d7d | 2011-03-02 14:57:47 -0500 | [diff] [blame] | 26 | do |
Gustavo Niemeyer | b889a9f | 2011-03-21 00:27:50 -0300 | [diff] [blame] | 27 | # Do not use gomake here. It may not be available. |
| 28 | $MAKE -C "$GOROOT/src/$i" clean |
Dave Cheney | 49a4d7d | 2011-03-02 14:57:47 -0500 | [diff] [blame] | 29 | done |