blob: 1955b583b39e633de8a8ba2f3198c3416e1a84b3 [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 Cox5a8f2ba2010-12-08 14:36:45 -050022for i in lib9 libbio libmach cmd pkg \
Russ Cox11d38052009-10-03 10:38:03 -070023 ../misc/cgo/gmp ../misc/cgo/stdio \
Russ Coxf9ca3b52011-03-07 10:37:42 -050024 ../misc/cgo/life ../misc/cgo/test \
Russ Coxd3be2e32010-02-09 13:33:00 -080025 ../test/bench ../test/garbage
Dave Cheney49a4d7d2011-03-02 14:57:47 -050026do
Gustavo Niemeyerb889a9f2011-03-21 00:27:50 -030027 # Do not use gomake here. It may not be available.
28 $MAKE -C "$GOROOT/src/$i" clean
Dave Cheney49a4d7d2011-03-02 14:57:47 -050029done