summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-08-18 10:08:49 -0400
committerRuss Cox <rsc@golang.org>2010-08-18 10:08:49 -0400
commitd5a213c027d18c2c8de4b869af2b6839badb3871 (patch)
treefce12a0753dcdb206ec0d64d571afcfc1711145c /src
parentae4b93f1aa082f2529247d0eddcc5a04ffa71564 (diff)
downloadgo-d5a213c027d18c2c8de4b869af2b6839badb3871.tar.gz
build: no required environment variables
R=adg, r, PeterGo CC=golang-dev http://codereview.appspot.com/1942044
Diffstat (limited to 'src')
-rw-r--r--src/Make.inc.in72
-rwxr-xr-xsrc/all.bash8
-rw-r--r--src/cmd/cgo/Makefile2
-rw-r--r--src/cmd/ebnflint/Makefile2
-rwxr-xr-xsrc/cmd/gc/mkbuiltin2
-rw-r--r--src/cmd/godoc/Makefile2
-rw-r--r--src/cmd/gofmt/Makefile2
-rwxr-xr-xsrc/cmd/gofmt/test.sh4
-rw-r--r--src/cmd/goinstall/Makefile2
-rw-r--r--src/cmd/goinstall/main.go3
-rw-r--r--src/cmd/goinstall/make.go2
-rw-r--r--src/cmd/gomake/doc.go36
-rw-r--r--src/cmd/gotest/Makefile5
-rwxr-xr-xsrc/cmd/gotest/gotest5
-rw-r--r--src/cmd/goyacc/Makefile2
-rw-r--r--src/cmd/hgpatch/Makefile2
-rwxr-xr-xsrc/cmd/make.bash2
-rw-r--r--src/env.bash39
-rw-r--r--src/lib9/Makefile4
-rwxr-xr-xsrc/make.bash45
-rw-r--r--src/pkg/archive/tar/Makefile2
-rw-r--r--src/pkg/asn1/Makefile2
-rw-r--r--src/pkg/big/Makefile2
-rw-r--r--src/pkg/bufio/Makefile2
-rw-r--r--src/pkg/bytes/Makefile2
-rw-r--r--src/pkg/cmath/Makefile2
-rw-r--r--src/pkg/compress/flate/Makefile2
-rw-r--r--src/pkg/compress/gzip/Makefile2
-rw-r--r--src/pkg/compress/zlib/Makefile2
-rw-r--r--src/pkg/container/heap/Makefile2
-rw-r--r--src/pkg/container/list/Makefile2
-rw-r--r--src/pkg/container/ring/Makefile2
-rw-r--r--src/pkg/container/vector/Makefile2
-rw-r--r--src/pkg/crypto/aes/Makefile2
-rw-r--r--src/pkg/crypto/block/Makefile2
-rw-r--r--src/pkg/crypto/blowfish/Makefile2
-rw-r--r--src/pkg/crypto/hmac/Makefile2
-rw-r--r--src/pkg/crypto/md4/Makefile2
-rw-r--r--src/pkg/crypto/md5/Makefile2
-rw-r--r--src/pkg/crypto/rand/Makefile2
-rw-r--r--src/pkg/crypto/rc4/Makefile2
-rw-r--r--src/pkg/crypto/ripemd160/Makefile2
-rw-r--r--src/pkg/crypto/rsa/Makefile2
-rw-r--r--src/pkg/crypto/sha1/Makefile2
-rw-r--r--src/pkg/crypto/sha256/Makefile2
-rw-r--r--src/pkg/crypto/sha512/Makefile2
-rw-r--r--src/pkg/crypto/subtle/Makefile2
-rw-r--r--src/pkg/crypto/tls/Makefile2
-rw-r--r--src/pkg/crypto/x509/Makefile2
-rw-r--r--src/pkg/crypto/xtea/Makefile2
-rw-r--r--src/pkg/debug/dwarf/Makefile2
-rw-r--r--src/pkg/debug/elf/Makefile2
-rw-r--r--src/pkg/debug/gosym/Makefile2
-rw-r--r--src/pkg/debug/macho/Makefile2
-rw-r--r--src/pkg/debug/proc/Makefile2
-rw-r--r--src/pkg/ebnf/Makefile2
-rw-r--r--src/pkg/encoding/ascii85/Makefile2
-rw-r--r--src/pkg/encoding/base64/Makefile2
-rw-r--r--src/pkg/encoding/binary/Makefile2
-rw-r--r--src/pkg/encoding/git85/Makefile2
-rw-r--r--src/pkg/encoding/hex/Makefile2
-rw-r--r--src/pkg/encoding/pem/Makefile2
-rw-r--r--src/pkg/exec/Makefile2
-rw-r--r--src/pkg/exp/datafmt/Makefile2
-rw-r--r--src/pkg/exp/draw/Makefile2
-rw-r--r--src/pkg/exp/draw/x11/Makefile2
-rw-r--r--src/pkg/exp/eval/Makefile2
-rw-r--r--src/pkg/exp/iterable/Makefile2
-rw-r--r--src/pkg/exp/nacl/av/Makefile2
-rw-r--r--src/pkg/exp/nacl/srpc/Makefile2
-rw-r--r--src/pkg/exp/ogle/Makefile2
-rw-r--r--src/pkg/expvar/Makefile2
-rw-r--r--src/pkg/flag/Makefile2
-rw-r--r--src/pkg/fmt/Makefile2
-rw-r--r--src/pkg/go/ast/Makefile2
-rw-r--r--src/pkg/go/doc/Makefile2
-rw-r--r--src/pkg/go/parser/Makefile2
-rw-r--r--src/pkg/go/printer/Makefile2
-rw-r--r--src/pkg/go/scanner/Makefile2
-rw-r--r--src/pkg/go/token/Makefile2
-rw-r--r--src/pkg/gob/Makefile2
-rw-r--r--src/pkg/hash/Makefile2
-rw-r--r--src/pkg/hash/adler32/Makefile2
-rw-r--r--src/pkg/hash/crc32/Makefile2
-rw-r--r--src/pkg/hash/crc64/Makefile2
-rw-r--r--src/pkg/html/Makefile2
-rw-r--r--src/pkg/http/Makefile2
-rw-r--r--src/pkg/http/pprof/Makefile2
-rw-r--r--src/pkg/image/Makefile2
-rw-r--r--src/pkg/image/jpeg/Makefile2
-rw-r--r--src/pkg/image/png/Makefile2
-rw-r--r--src/pkg/io/Makefile2
-rw-r--r--src/pkg/io/ioutil/Makefile2
-rw-r--r--src/pkg/json/Makefile2
-rw-r--r--src/pkg/log/Makefile2
-rw-r--r--src/pkg/math/Makefile2
-rw-r--r--src/pkg/mime/Makefile2
-rw-r--r--src/pkg/mime/multipart/Makefile2
-rw-r--r--src/pkg/net/Makefile2
-rw-r--r--src/pkg/net/dict/Makefile2
-rw-r--r--src/pkg/net/textproto/Makefile2
-rw-r--r--src/pkg/netchan/Makefile2
-rw-r--r--src/pkg/nntp/Makefile2
-rw-r--r--src/pkg/os/Makefile2
-rw-r--r--src/pkg/os/signal/Makefile2
-rw-r--r--src/pkg/patch/Makefile2
-rw-r--r--src/pkg/path/Makefile2
-rw-r--r--src/pkg/rand/Makefile2
-rw-r--r--src/pkg/reflect/Makefile2
-rw-r--r--src/pkg/regexp/Makefile2
-rw-r--r--src/pkg/rpc/Makefile2
-rw-r--r--src/pkg/rpc/jsonrpc/Makefile2
-rw-r--r--src/pkg/runtime/Makefile2
-rw-r--r--src/pkg/runtime/pprof/Makefile2
-rw-r--r--src/pkg/scanner/Makefile2
-rw-r--r--src/pkg/sort/Makefile2
-rw-r--r--src/pkg/strconv/Makefile2
-rw-r--r--src/pkg/strings/Makefile2
-rw-r--r--src/pkg/sync/Makefile2
-rw-r--r--src/pkg/syscall/Makefile2
-rw-r--r--src/pkg/syslog/Makefile2
-rw-r--r--src/pkg/tabwriter/Makefile2
-rw-r--r--src/pkg/template/Makefile2
-rw-r--r--src/pkg/testing/Makefile2
-rw-r--r--src/pkg/testing/iotest/Makefile2
-rw-r--r--src/pkg/testing/quick/Makefile2
-rw-r--r--src/pkg/testing/script/Makefile2
-rw-r--r--src/pkg/time/Makefile2
-rw-r--r--src/pkg/unicode/Makefile2
-rw-r--r--src/pkg/utf16/Makefile2
-rw-r--r--src/pkg/utf8/Makefile2
-rw-r--r--src/pkg/websocket/Makefile2
-rw-r--r--src/pkg/xml/Makefile2
-rwxr-xr-xsrc/sudo.bash3
134 files changed, 309 insertions, 161 deletions
diff --git a/src/Make.inc.in b/src/Make.inc.in
new file mode 100644
index 000000000..c3e4a45b4
--- /dev/null
+++ b/src/Make.inc.in
@@ -0,0 +1,72 @@
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+# Makefile included by all other makefiles.
+# The build converts Make.inc.in to Make.inc.
+# Only make changes in Make.inc.in.
+
+# Set up GOROOT, GOARCH, GOOS if needed.
+ifeq ($(GOROOT),)
+GOROOT:=@@GOROOT@@
+endif
+
+ifeq ($(GOOS),)
+GOOS:=${shell uname | tr A-Z a-z}
+endif
+
+ifeq ($(GOOS),darwin)
+else ifeq ($(GOOS),freebsd)
+else ifeq ($(GOOS),linux)
+else ifeq ($(GOOS),nacl)
+else ifeq ($(GOOS),windows)
+else
+$(error Invalid $$GOOS '$(GOOS)'; must be darwin, freebsd, linux, nacl, or windows)
+endif
+
+ifeq ($(GOARCH),)
+ifeq ($(GOOS),darwin)
+# Even on 64-bit platform, darwin uname -m prints i386.
+# Check for amd64 with sysctl instead.
+GOARCH:=${shell if sysctl machdep.cpu.extfeatures | grep EM64T >/dev/null; then echo amd64; else uname -m | sed 's/i386/386/'; fi}
+else
+# Ask uname -m for the processor.
+GOARCH:=${shell uname -m | sed 's/^..86$$/386/; s/^.86$$/386/; s/x86_64/amd64/'}
+endif
+endif
+
+ifeq ($(GOARCH),386)
+O:=8
+else ifeq ($(GOARCH),amd64)
+O:=6
+else ifeq ($(GOARCH),arm)
+O:=5
+else
+$(error Invalid $$GOARCH '$(GOARCH)'; must be 386, amd64, or arm)
+endif
+
+# Save for recursive make.
+export GOARCH GOOS
+
+AS=${O}a
+CC=${O}c
+GC=${O}g
+LD=${O}l
+OS=568vq
+CFLAGS=-FVw
+
+go-env:
+ @echo export GOARCH=$(GOARCH)
+ @echo export GOOS=$(GOOS)
+ @echo export O=$O
+ @echo export AS="$(AS)"
+ @echo export CC="$(CC)"
+ @echo export GC="$(GC)"
+ @echo export LD="$(LD)"
+ @echo export OS="$(OS)"
+ @echo export CFLAGS="$(CFLAGS)"
+ @echo MAKE_GO_ENV_WORKED=1
+
+# Don't let the targets in this file be used
+# as the default make target.
+.DEFAULT_GOAL:=
diff --git a/src/all.bash b/src/all.bash
index 00c1ca74d..4a98fe9f6 100755
--- a/src/all.bash
+++ b/src/all.bash
@@ -4,5 +4,11 @@
# license that can be found in the LICENSE file.
set -e
-bash make.bash
+if [ ! -f make.bash ]; then
+ echo 'all.bash must be run from $GOROOT/src' 1>&2
+ exit 1
+fi
+. ./make.bash
bash run.bash --no-rebuild
+installed # function defined by make.bash
+
diff --git a/src/cmd/cgo/Makefile b/src/cmd/cgo/Makefile
index 34ca3dd46..5458c3e4f 100644
--- a/src/cmd/cgo/Makefile
+++ b/src/cmd/cgo/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=cgo
GOFILES=\
diff --git a/src/cmd/ebnflint/Makefile b/src/cmd/ebnflint/Makefile
index 8cb9fd821..77279db24 100644
--- a/src/cmd/ebnflint/Makefile
+++ b/src/cmd/ebnflint/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=ebnflint
GOFILES=\
diff --git a/src/cmd/gc/mkbuiltin b/src/cmd/gc/mkbuiltin
index 13309ec32..e29487e4b 100755
--- a/src/cmd/gc/mkbuiltin
+++ b/src/cmd/gc/mkbuiltin
@@ -12,7 +12,7 @@ set -e
GOBIN="${GOBIN:-$HOME/bin}"
-. "$GOROOT"/src/Make.$GOARCH
+eval $("$GOBIN"/gomake -f ../../Make.inc go-env)
if [ -z "$GC" ]; then
echo 'missing $GC - maybe no Make.$GOARCH?' 1>&2
exit 1
diff --git a/src/cmd/godoc/Makefile b/src/cmd/godoc/Makefile
index d799219dd..106f46eff 100644
--- a/src/cmd/godoc/Makefile
+++ b/src/cmd/godoc/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=godoc
GOFILES=\
diff --git a/src/cmd/gofmt/Makefile b/src/cmd/gofmt/Makefile
index 2294fd1db..43434a565 100644
--- a/src/cmd/gofmt/Makefile
+++ b/src/cmd/gofmt/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=gofmt
GOFILES=\
diff --git a/src/cmd/gofmt/test.sh b/src/cmd/gofmt/test.sh
index 133cc8a64..36f7d6e48 100755
--- a/src/cmd/gofmt/test.sh
+++ b/src/cmd/gofmt/test.sh
@@ -3,7 +3,9 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-. "$GOROOT"/src/Make.$GOARCH
+GOBIN="${GOBIN:-$HOME/bin}"
+
+eval $("$GOBIN"/gomake --no-print-directory -f ../../Make.inc go-env)
if [ -z "$O" ]; then
echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
exit 1
diff --git a/src/cmd/goinstall/Makefile b/src/cmd/goinstall/Makefile
index cf4728401..6ddb32be7 100644
--- a/src/cmd/goinstall/Makefile
+++ b/src/cmd/goinstall/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=goinstall
GOFILES=\
diff --git a/src/cmd/goinstall/main.go b/src/cmd/goinstall/main.go
index 5d2af2e7c..ffa6eb7af 100644
--- a/src/cmd/goinstall/main.go
+++ b/src/cmd/goinstall/main.go
@@ -14,6 +14,7 @@ import (
"io"
"os"
"path"
+ "runtime"
"strings"
)
@@ -28,7 +29,7 @@ var (
errors = false
gobin = os.Getenv("GOBIN")
parents = make(map[string]string)
- root = os.Getenv("GOROOT")
+ root = runtime.GOROOT()
visit = make(map[string]status)
reportToDashboard = flag.Bool("dashboard", true, "report public packages at "+dashboardURL)
diff --git a/src/cmd/goinstall/make.go b/src/cmd/goinstall/make.go
index c15709b31..769c87415 100644
--- a/src/cmd/goinstall/make.go
+++ b/src/cmd/goinstall/make.go
@@ -53,7 +53,7 @@ type makedata struct {
}
var makefileTemplate = template.MustParse(`
-include $(GOROOT)/src/Make.$(GOARCH)
+include $(GOROOT)/src/Make.inc
TARG={pkg}
GOFILES=\
diff --git a/src/cmd/gomake/doc.go b/src/cmd/gomake/doc.go
new file mode 100644
index 000000000..2f35fd9dd
--- /dev/null
+++ b/src/cmd/gomake/doc.go
@@ -0,0 +1,36 @@
+// Copyright 2010 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+The gomake command runs GNU make with an appropriate environment
+for using the conventional Go makefiles. If $GOROOT is already
+set in the environment, running gomake is exactly the same
+as running make (or, on BSD systems, running gmake).
+
+Usage: gomake [ target ... ]
+
+Common targets are:
+
+ all (default)
+ build the package or command, but do not install it.
+
+ install
+ build and install the package or command
+
+ test
+ run the tests (packages only)
+
+ bench
+ run benchmarks (packages only)
+
+ clean
+ remove object files from the current directory
+
+ nuke
+ make clean and remove the installed package or command
+
+See http://golang.org/doc/code.html for information about
+writing makefiles.
+*/
+package documentation
diff --git a/src/cmd/gotest/Makefile b/src/cmd/gotest/Makefile
index b20b1daff..8360fd184 100644
--- a/src/cmd/gotest/Makefile
+++ b/src/cmd/gotest/Makefile
@@ -5,10 +5,13 @@
include ../../Make.conf
TARG=gotest
+GOROOT_FINAL?=$(GOROOT)
clean:
@true
install: $(TARG)
! test -f "$(GOBIN)"/$(TARG) || chmod u+w "$(GOBIN)"/$(TARG)
- cp $(TARG) "$(GOBIN)"/$(TARG)
+ sed 's`@@GOROOT@@`$(GOROOT_FINAL)`' gotest >"$(GOBIN)"/$(TARG)
+ chmod +x "$(GOBIN)"/$(TARG)
+
diff --git a/src/cmd/gotest/gotest b/src/cmd/gotest/gotest
index cea2ab905..9995496ad 100755
--- a/src/cmd/gotest/gotest
+++ b/src/cmd/gotest/gotest
@@ -16,14 +16,15 @@ export LC_CTYPE=C
GOBIN="${GOBIN:-$HOME/bin}"
-_GC=$GC # Make.$GOARCH will overwrite this
+_GC=$GC # Make.inc will overwrite this
if [ ! -f [Mm]akefile ]; then
echo 'please create a Makefile for gotest; see http://golang.org/doc/code.html for details' 1>&2
exit 2
fi
-. "$GOROOT"/src/Make.$GOARCH
+export GOROOT=${GOROOT:-"@@GOROOT@@"}
+eval $("$GOBIN"/gomake --no-print-directory -f "$GOROOT"/src/Make.inc go-env)
if [ -z "$O" ]; then
echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
exit 2
diff --git a/src/cmd/goyacc/Makefile b/src/cmd/goyacc/Makefile
index 77ac918bc..54b8f3360 100644
--- a/src/cmd/goyacc/Makefile
+++ b/src/cmd/goyacc/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=goyacc
GOFILES=\
diff --git a/src/cmd/hgpatch/Makefile b/src/cmd/hgpatch/Makefile
index f7d64bc12..1ef98d7f9 100644
--- a/src/cmd/hgpatch/Makefile
+++ b/src/cmd/hgpatch/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=hgpatch
GOFILES=\
diff --git a/src/cmd/make.bash b/src/cmd/make.bash
index d0fda7d18..4ee22776b 100755
--- a/src/cmd/make.bash
+++ b/src/cmd/make.bash
@@ -9,7 +9,7 @@ bash clean.bash
GOBIN="${GOBIN:-$HOME/bin}"
-. "$GOROOT"/src/Make.$GOARCH
+eval $("$GOBIN"/gomake --no-print-directory -f ../Make.inc go-env)
if [ -z "$O" ]; then
echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
exit 1
diff --git a/src/env.bash b/src/env.bash
index 2a63e6480..fc6f5bea6 100644
--- a/src/env.bash
+++ b/src/env.bash
@@ -16,11 +16,13 @@ elif ! test -d "$GOBIN"; then
echo 'create it or set $GOBIN differently' 1>&2
exit 1
fi
+export GOBIN
+
+export GOROOT=${GOROOT:-$(cd ..; pwd)}
-GOROOT=${GOROOT:-$(cd ..; pwd)}
if ! test -f "$GOROOT"/include/u.h
then
- echo '$GOROOT is not set correctly or not exported' 1>&2
+ echo '$GOROOT is not set correctly or not exported: '$GOROOT 1>&2
exit 1
fi
@@ -30,26 +32,23 @@ fi
DIR1=$(cd ..; pwd)
DIR2=$(cd $GOROOT; pwd)
if [ "$DIR1" != "$DIR2" ]; then
- echo 'Suspicious $GOROOT: does not match current directory.' 1>&2
+ echo 'Suspicious $GOROOT '$GOROOT': does not match current directory.' 1>&2
exit 1
fi
-GOARCH=${GOARCH:-$(uname -m | sed 's/^..86$/386/; s/^.86$/386/; s/x86_64/amd64/')}
-case "$GOARCH" in
-amd64 | 386 | arm)
- ;;
-*)
- echo '$GOARCH is set to <'$GOARCH'>, must be amd64, 386, or arm' 1>&2
- exit 1
-esac
+MAKE=make
+if ! make --version 2>/dev/null | grep 'GNU Make' >/dev/null; then
+ MAKE=gmake
+fi
-GOOS=${GOOS:-$(uname | tr A-Z a-z)}
-case "$GOOS" in
-darwin | freebsd | linux | windows | nacl)
- ;;
-*)
- echo '$GOOS is set to <'$GOOS'>, must be darwin, freebsd, linux, windows, or nacl' 1>&2
- exit 1
-esac
+# Tried to use . <($MAKE ...) here, but it cannot set environment
+# variables in the version of bash that ships with OS X. Amazing.
+eval $($MAKE --no-print-directory -f Make.inc.in go-env | egrep 'GOARCH|GOOS|GO_ENV')
-export GOBIN GOROOT GOARCH GOOS
+# Shell doesn't tell us whether make succeeded,
+# so Make.inc generates a fake variable name.
+if [ "$MAKE_GO_ENV_WORKED" != 1 ]; then
+ echo 'Did not find Go environment variables.' 1>&2
+ exit 1
+fi
+unset MAKE_GO_ENV_WORKED
diff --git a/src/lib9/Makefile b/src/lib9/Makefile
index 10c4b1640..de0900012 100644
--- a/src/lib9/Makefile
+++ b/src/lib9/Makefile
@@ -104,7 +104,7 @@ HFILES=\
"$(GOROOT)"/include/u.h\
"$(GOROOT)"/include/libc.h\
-BAKED_GOROOT?=$(GOROOT)
+GOROOT_FINAL?=$(GOROOT)
install: $(LIB)
cp $(LIB) "$(GOROOT)/lib"
@@ -119,7 +119,7 @@ $(LIB): $(OFILES)
$(CC) -c $(CFLAGS) $<
goos.$O: goos.c
- $(CC) -c $(CFLAGS) -DGOOS='"$(GOOS)"' -DGOARCH='"$(GOARCH)"' -DGOROOT='"$(BAKED_GOROOT)"' -DGOVERSION='"'"$$(../version.bash)"'"' $<
+ $(CC) -c $(CFLAGS) -DGOOS='"$(GOOS)"' -DGOARCH='"$(GOARCH)"' -DGOROOT='"$(GOROOT_FINAL)"' -DGOVERSION='"'"$$(../version.bash)"'"' $<
clean:
rm -f *.$O *.6 6.out $(LIB)
diff --git a/src/make.bash b/src/make.bash
index b95635b56..6124dbfb7 100755
--- a/src/make.bash
+++ b/src/make.bash
@@ -4,8 +4,16 @@
# license that can be found in the LICENSE file.
set -e
+if [ ! -f env.bash ]; then
+ echo 'make.bash must be run from $GOROOT/src' 1>&2
+ exit 1
+fi
. ./env.bash
+GOROOT_FINAL=${GOROOT_FINAL:-$GOROOT}
+rm -f Make.inc
+sed 's!@@GOROOT@@!'"$GOROOT_FINAL"'!' Make.inc.in >Make.inc
+
MAKEFLAGS=${MAKEFLAGS:-"-j4"}
export MAKEFLAGS
unset CDPATH # in case user has it set
@@ -17,11 +25,11 @@ sed -e "s|@CC@|$CC|" < "$GOROOT"/src/quietgcc.bash > "$GOBIN"/quietgcc
chmod +x "$GOBIN"/quietgcc
rm -f "$GOBIN"/gomake
-MAKE=make
-if ! make --version 2>/dev/null | grep 'GNU Make' >/dev/null; then
- MAKE=gmake
-fi
-(echo '#!/bin/sh'; echo 'exec '$MAKE' "$@"') >"$GOBIN"/gomake
+(
+ echo '#!/bin/sh'
+ echo 'export GOROOT=${GOROOT:-'$GOROOT_FINAL'}'
+ echo 'exec '$MAKE' "$@"'
+) >"$GOBIN"/gomake
chmod +x "$GOBIN"/gomake
if [ -d /selinux -a -f /selinux/booleans/allow_execstack ] ; then
@@ -73,9 +81,26 @@ do
esac
done
-case "`uname`" in
-Darwin)
- echo;
- echo %%% run sudo.bash to install debuggers
+# Print post-install messages.
+# Implemented as a function so that all.bash can repeat the output
+# after run.bash finishes running all the tests.
+installed() {
+ eval $("$GOBIN"/gomake -f Make.inc go-env)
echo
-esac
+ echo ---
+ echo Installed Go for $GOOS/$GOARCH in "$GOROOT".
+ echo Installed commands in "$GOBIN".
+ echo The compiler is $GC.
+ if [ "$(uname)" = "Darwin" ]; then
+ echo
+ echo On OS X the debuggers must be installed setgrp procmod.
+ echo Read and run ./sudo.bash to install the debuggers.
+ fi
+ if [ "$GOROOT_FINAL" != "$GOROOT" ]; then
+ echo
+ echo The binaries expect "$GOROOT" to be copied or moved to "$GOROOT_FINAL".
+ fi
+}
+
+(installed) # run in sub-shell to avoid polluting environment
+
diff --git a/src/pkg/archive/tar/Makefile b/src/pkg/archive/tar/Makefile
index 6a29de8f7..8897e883e 100644
--- a/src/pkg/archive/tar/Makefile
+++ b/src/pkg/archive/tar/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=archive/tar
GOFILES=\
diff --git a/src/pkg/asn1/Makefile b/src/pkg/asn1/Makefile
index 40b76b849..6b7770e82 100644
--- a/src/pkg/asn1/Makefile
+++ b/src/pkg/asn1/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=asn1
GOFILES=\
diff --git a/src/pkg/big/Makefile b/src/pkg/big/Makefile
index 7a4311dca..3d4b56d78 100644
--- a/src/pkg/big/Makefile
+++ b/src/pkg/big/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=big
GOFILES=\
diff --git a/src/pkg/bufio/Makefile b/src/pkg/bufio/Makefile
index 1f5fc349b..85430e8e8 100644
--- a/src/pkg/bufio/Makefile
+++ b/src/pkg/bufio/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=bufio
GOFILES=\
diff --git a/src/pkg/bytes/Makefile b/src/pkg/bytes/Makefile
index d50e624d6..03395c7a4 100644
--- a/src/pkg/bytes/Makefile
+++ b/src/pkg/bytes/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=bytes
GOFILES=\
diff --git a/src/pkg/cmath/Makefile b/src/pkg/cmath/Makefile
index 1936fbda1..486caace4 100644
--- a/src/pkg/cmath/Makefile
+++ b/src/pkg/cmath/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=cmath
diff --git a/src/pkg/compress/flate/Makefile b/src/pkg/compress/flate/Makefile
index 6f9ee74d4..197828a92 100644
--- a/src/pkg/compress/flate/Makefile
+++ b/src/pkg/compress/flate/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=compress/flate
GOFILES=\
diff --git a/src/pkg/compress/gzip/Makefile b/src/pkg/compress/gzip/Makefile
index bb4705a8f..b671fc72c 100644
--- a/src/pkg/compress/gzip/Makefile
+++ b/src/pkg/compress/gzip/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=compress/gzip
GOFILES=\
diff --git a/src/pkg/compress/zlib/Makefile b/src/pkg/compress/zlib/Makefile
index 4cfda4f1b..791072d34 100644
--- a/src/pkg/compress/zlib/Makefile
+++ b/src/pkg/compress/zlib/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=compress/zlib
GOFILES=\
diff --git a/src/pkg/container/heap/Makefile b/src/pkg/container/heap/Makefile
index 244ebae06..4291d1122 100644
--- a/src/pkg/container/heap/Makefile
+++ b/src/pkg/container/heap/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=container/heap
GOFILES=\
diff --git a/src/pkg/container/list/Makefile b/src/pkg/container/list/Makefile
index 2d5b35715..7fcd5f99a 100644
--- a/src/pkg/container/list/Makefile
+++ b/src/pkg/container/list/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=container/list
GOFILES=\
diff --git a/src/pkg/container/ring/Makefile b/src/pkg/container/ring/Makefile
index 4755bab07..fb0900774 100644
--- a/src/pkg/container/ring/Makefile
+++ b/src/pkg/container/ring/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=container/ring
GOFILES=\
diff --git a/src/pkg/container/vector/Makefile b/src/pkg/container/vector/Makefile
index 1eb310c6d..f6b50156f 100644
--- a/src/pkg/container/vector/Makefile
+++ b/src/pkg/container/vector/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=container/vector
GOFILES=\
diff --git a/src/pkg/crypto/aes/Makefile b/src/pkg/crypto/aes/Makefile
index 07d759b4b..9dc846ee3 100644
--- a/src/pkg/crypto/aes/Makefile
+++ b/src/pkg/crypto/aes/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/aes
GOFILES=\
diff --git a/src/pkg/crypto/block/Makefile b/src/pkg/crypto/block/Makefile
index 25c3483ae..71c7aff64 100644
--- a/src/pkg/crypto/block/Makefile
+++ b/src/pkg/crypto/block/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/block
GOFILES=\
diff --git a/src/pkg/crypto/blowfish/Makefile b/src/pkg/crypto/blowfish/Makefile
index c2999cc1d..f370ab28b 100644
--- a/src/pkg/crypto/blowfish/Makefile
+++ b/src/pkg/crypto/blowfish/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/blowfish
GOFILES=\
diff --git a/src/pkg/crypto/hmac/Makefile b/src/pkg/crypto/hmac/Makefile
index d1a6bfc2b..cc69abf60 100644
--- a/src/pkg/crypto/hmac/Makefile
+++ b/src/pkg/crypto/hmac/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/hmac
GOFILES=\
diff --git a/src/pkg/crypto/md4/Makefile b/src/pkg/crypto/md4/Makefile
index 5fff2dd8f..eef05ab70 100644
--- a/src/pkg/crypto/md4/Makefile
+++ b/src/pkg/crypto/md4/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/md4
GOFILES=\
diff --git a/src/pkg/crypto/md5/Makefile b/src/pkg/crypto/md5/Makefile
index 7f37f6a33..5cde3e6d6 100644
--- a/src/pkg/crypto/md5/Makefile
+++ b/src/pkg/crypto/md5/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/md5
GOFILES=\
diff --git a/src/pkg/crypto/rand/Makefile b/src/pkg/crypto/rand/Makefile
index 21812598c..c24429ad4 100644
--- a/src/pkg/crypto/rand/Makefile
+++ b/src/pkg/crypto/rand/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/rand
diff --git a/src/pkg/crypto/rc4/Makefile b/src/pkg/crypto/rc4/Makefile
index 7827b0817..50a3b7972 100644
--- a/src/pkg/crypto/rc4/Makefile
+++ b/src/pkg/crypto/rc4/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/rc4
GOFILES=\
diff --git a/src/pkg/crypto/ripemd160/Makefile b/src/pkg/crypto/ripemd160/Makefile
index 109e68eda..7e529457d 100644
--- a/src/pkg/crypto/ripemd160/Makefile
+++ b/src/pkg/crypto/ripemd160/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/ripemd160
GOFILES=\
diff --git a/src/pkg/crypto/rsa/Makefile b/src/pkg/crypto/rsa/Makefile
index e4d81bc52..ff26ca6f2 100644
--- a/src/pkg/crypto/rsa/Makefile
+++ b/src/pkg/crypto/rsa/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/rsa
GOFILES=\
diff --git a/src/pkg/crypto/sha1/Makefile b/src/pkg/crypto/sha1/Makefile
index f3422dd84..81ac38c0b 100644
--- a/src/pkg/crypto/sha1/Makefile
+++ b/src/pkg/crypto/sha1/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/sha1
GOFILES=\
diff --git a/src/pkg/crypto/sha256/Makefile b/src/pkg/crypto/sha256/Makefile
index 9efbc4792..97fe4d8e6 100644
--- a/src/pkg/crypto/sha256/Makefile
+++ b/src/pkg/crypto/sha256/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/sha256
GOFILES=\
diff --git a/src/pkg/crypto/sha512/Makefile b/src/pkg/crypto/sha512/Makefile
index cf52732a4..2f7633fa3 100644
--- a/src/pkg/crypto/sha512/Makefile
+++ b/src/pkg/crypto/sha512/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/sha512
GOFILES=\
diff --git a/src/pkg/crypto/subtle/Makefile b/src/pkg/crypto/subtle/Makefile
index fa5f7ef42..08d8bbfa0 100644
--- a/src/pkg/crypto/subtle/Makefile
+++ b/src/pkg/crypto/subtle/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/subtle
GOFILES=\
diff --git a/src/pkg/crypto/tls/Makefile b/src/pkg/crypto/tls/Makefile
index 5e25bd43a..86f9695c0 100644
--- a/src/pkg/crypto/tls/Makefile
+++ b/src/pkg/crypto/tls/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/tls
GOFILES=\
diff --git a/src/pkg/crypto/x509/Makefile b/src/pkg/crypto/x509/Makefile
index b2ecfdc01..329a61b7c 100644
--- a/src/pkg/crypto/x509/Makefile
+++ b/src/pkg/crypto/x509/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/x509
GOFILES=\
diff --git a/src/pkg/crypto/xtea/Makefile b/src/pkg/crypto/xtea/Makefile
index 74cc1b0dc..301621168 100644
--- a/src/pkg/crypto/xtea/Makefile
+++ b/src/pkg/crypto/xtea/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=crypto/xtea
GOFILES=\
diff --git a/src/pkg/debug/dwarf/Makefile b/src/pkg/debug/dwarf/Makefile
index a626513c7..c4203188e 100644
--- a/src/pkg/debug/dwarf/Makefile
+++ b/src/pkg/debug/dwarf/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=debug/dwarf
GOFILES=\
diff --git a/src/pkg/debug/elf/Makefile b/src/pkg/debug/elf/Makefile
index 931f9d24d..dd431f653 100644
--- a/src/pkg/debug/elf/Makefile
+++ b/src/pkg/debug/elf/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=debug/elf
GOFILES=\
diff --git a/src/pkg/debug/gosym/Makefile b/src/pkg/debug/gosym/Makefile
index ac16b4cee..3c0d8c440 100644
--- a/src/pkg/debug/gosym/Makefile
+++ b/src/pkg/debug/gosym/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=debug/gosym
GOFILES=\
diff --git a/src/pkg/debug/macho/Makefile b/src/pkg/debug/macho/Makefile
index d34aacf54..5fbbf1efe 100644
--- a/src/pkg/debug/macho/Makefile
+++ b/src/pkg/debug/macho/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=debug/macho
GOFILES=\
diff --git a/src/pkg/debug/proc/Makefile b/src/pkg/debug/proc/Makefile
index 5444ec0db..c6d879836 100644
--- a/src/pkg/debug/proc/Makefile
+++ b/src/pkg/debug/proc/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=debug/proc
GOFILES=\
diff --git a/src/pkg/ebnf/Makefile b/src/pkg/ebnf/Makefile
index 4a75c7432..f5555d272 100644
--- a/src/pkg/ebnf/Makefile
+++ b/src/pkg/ebnf/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=ebnf
GOFILES=\
diff --git a/src/pkg/encoding/ascii85/Makefile b/src/pkg/encoding/ascii85/Makefile
index 7ec14bd1a..412383efd 100644
--- a/src/pkg/encoding/ascii85/Makefile
+++ b/src/pkg/encoding/ascii85/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=encoding/ascii85
GOFILES=\
diff --git a/src/pkg/encoding/base64/Makefile b/src/pkg/encoding/base64/Makefile
index 8503b1663..2f54ed839 100644
--- a/src/pkg/encoding/base64/Makefile
+++ b/src/pkg/encoding/base64/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=encoding/base64
GOFILES=\
diff --git a/src/pkg/encoding/binary/Makefile b/src/pkg/encoding/binary/Makefile
index 23d4d6d43..dc46abe90 100644
--- a/src/pkg/encoding/binary/Makefile
+++ b/src/pkg/encoding/binary/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=encoding/binary
GOFILES=\
diff --git a/src/pkg/encoding/git85/Makefile b/src/pkg/encoding/git85/Makefile
index 09dd96f32..fbd003454 100644
--- a/src/pkg/encoding/git85/Makefile
+++ b/src/pkg/encoding/git85/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=encoding/git85
GOFILES=\
diff --git a/src/pkg/encoding/hex/Makefile b/src/pkg/encoding/hex/Makefile
index d6849d9a5..22049f43b 100644
--- a/src/pkg/encoding/hex/Makefile
+++ b/src/pkg/encoding/hex/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=encoding/hex
GOFILES=\
diff --git a/src/pkg/encoding/pem/Makefile b/src/pkg/encoding/pem/Makefile
index 79490a57d..527670380 100644
--- a/src/pkg/encoding/pem/Makefile
+++ b/src/pkg/encoding/pem/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=encoding/pem
GOFILES=\
diff --git a/src/pkg/exec/Makefile b/src/pkg/exec/Makefile
index 9d88b8d8a..bffc1bf36 100644
--- a/src/pkg/exec/Makefile
+++ b/src/pkg/exec/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=exec
GOFILES=\
diff --git a/src/pkg/exp/datafmt/Makefile b/src/pkg/exp/datafmt/Makefile
index 40543b195..aa9453897 100644
--- a/src/pkg/exp/datafmt/Makefile
+++ b/src/pkg/exp/datafmt/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=exp/datafmt
GOFILES=\
diff --git a/src/pkg/exp/draw/Makefile b/src/pkg/exp/draw/Makefile
index 4389a294c..6f0f0b2f5 100644
--- a/src/pkg/exp/draw/Makefile
+++ b/src/pkg/exp/draw/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=exp/draw
GOFILES=\
diff --git a/src/pkg/exp/draw/x11/Makefile b/src/pkg/exp/draw/x11/Makefile
index d4e65ca73..205b3a65b 100644
--- a/src/pkg/exp/draw/x11/Makefile
+++ b/src/pkg/exp/draw/x11/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../../Make.$(GOARCH)
+include ../../../../Make.inc
TARG=exp/draw/x11
GOFILES=\
diff --git a/src/pkg/exp/eval/Makefile b/src/pkg/exp/eval/Makefile
index 50d8a175e..a623d0fd4 100644
--- a/src/pkg/exp/eval/Makefile
+++ b/src/pkg/exp/eval/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=exp/eval
GOFILES=\
diff --git a/src/pkg/exp/iterable/Makefile b/src/pkg/exp/iterable/Makefile
index 9adf714da..cf95dc5ad 100644
--- a/src/pkg/exp/iterable/Makefile
+++ b/src/pkg/exp/iterable/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=exp/iterable
GOFILES=\
diff --git a/src/pkg/exp/nacl/av/Makefile b/src/pkg/exp/nacl/av/Makefile
index d966078ec..c75f351c3 100644
--- a/src/pkg/exp/nacl/av/Makefile
+++ b/src/pkg/exp/nacl/av/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../../Make.$(GOARCH)
+include ../../../../Make.inc
TARG=exp/nacl/av
GOFILES=\
diff --git a/src/pkg/exp/nacl/srpc/Makefile b/src/pkg/exp/nacl/srpc/Makefile
index 7dda292f5..c89997d4b 100644
--- a/src/pkg/exp/nacl/srpc/Makefile
+++ b/src/pkg/exp/nacl/srpc/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../../Make.$(GOARCH)
+include ../../../../Make.inc
TARG=exp/nacl/srpc
GOFILES=\
diff --git a/src/pkg/exp/ogle/Makefile b/src/pkg/exp/ogle/Makefile
index b701afd9e..1d1d78289 100644
--- a/src/pkg/exp/ogle/Makefile
+++ b/src/pkg/exp/ogle/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=exp/ogle
GOFILES=\
diff --git a/src/pkg/expvar/Makefile b/src/pkg/expvar/Makefile
index 544891739..5619630d1 100644
--- a/src/pkg/expvar/Makefile
+++ b/src/pkg/expvar/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=expvar
GOFILES=\
diff --git a/src/pkg/flag/Makefile b/src/pkg/flag/Makefile
index 3ffbea83c..3408ca474 100644
--- a/src/pkg/flag/Makefile
+++ b/src/pkg/flag/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=flag
GOFILES=\
diff --git a/src/pkg/fmt/Makefile b/src/pkg/fmt/Makefile
index 81a756d3c..44b48bc67 100644
--- a/src/pkg/fmt/Makefile
+++ b/src/pkg/fmt/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=fmt
GOFILES=\
diff --git a/src/pkg/go/ast/Makefile b/src/pkg/go/ast/Makefile
index 9b5c904c1..d95210b27 100644
--- a/src/pkg/go/ast/Makefile
+++ b/src/pkg/go/ast/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=go/ast
GOFILES=\
diff --git a/src/pkg/go/doc/Makefile b/src/pkg/go/doc/Makefile
index 1558ac30a..a5152c793 100644
--- a/src/pkg/go/doc/Makefile
+++ b/src/pkg/go/doc/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=go/doc
GOFILES=\
diff --git a/src/pkg/go/parser/Makefile b/src/pkg/go/parser/Makefile
index d9b52a7d9..d301f41eb 100644
--- a/src/pkg/go/parser/Makefile
+++ b/src/pkg/go/parser/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=go/parser
GOFILES=\
diff --git a/src/pkg/go/printer/Makefile b/src/pkg/go/printer/Makefile
index a0fe22e42..6a71efc93 100644
--- a/src/pkg/go/printer/Makefile
+++ b/src/pkg/go/printer/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=go/printer
GOFILES=\
diff --git a/src/pkg/go/scanner/Makefile b/src/pkg/go/scanner/Makefile
index 70d21a972..453faac00 100644
--- a/src/pkg/go/scanner/Makefile
+++ b/src/pkg/go/scanner/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=go/scanner
GOFILES=\
diff --git a/src/pkg/go/token/Makefile b/src/pkg/go/token/Makefile
index 629196c5d..7d3257b0a 100644
--- a/src/pkg/go/token/Makefile
+++ b/src/pkg/go/token/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=go/token
GOFILES=\
diff --git a/src/pkg/gob/Makefile b/src/pkg/gob/Makefile
index 1091adb01..ddbea3e68 100644
--- a/src/pkg/gob/Makefile
+++ b/src/pkg/gob/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=gob
GOFILES=\
diff --git a/src/pkg/hash/Makefile b/src/pkg/hash/Makefile
index aaa641f7c..56071cb33 100644
--- a/src/pkg/hash/Makefile
+++ b/src/pkg/hash/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=hash
GOFILES=\
diff --git a/src/pkg/hash/adler32/Makefile b/src/pkg/hash/adler32/Makefile
index 6f6d66fd0..38ce537ba 100644
--- a/src/pkg/hash/adler32/Makefile
+++ b/src/pkg/hash/adler32/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=hash/adler32
GOFILES=\
diff --git a/src/pkg/hash/crc32/Makefile b/src/pkg/hash/crc32/Makefile
index 071d89823..31b205185 100644
--- a/src/pkg/hash/crc32/Makefile
+++ b/src/pkg/hash/crc32/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=hash/crc32
GOFILES=\
diff --git a/src/pkg/hash/crc64/Makefile b/src/pkg/hash/crc64/Makefile
index 01b755b3e..5f6c3de69 100644
--- a/src/pkg/hash/crc64/Makefile
+++ b/src/pkg/hash/crc64/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=hash/crc64
GOFILES=\
diff --git a/src/pkg/html/Makefile b/src/pkg/html/Makefile
index 63000e01b..4bbd98a93 100644
--- a/src/pkg/html/Makefile
+++ b/src/pkg/html/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=html
GOFILES=\
diff --git a/src/pkg/http/Makefile b/src/pkg/http/Makefile
index 235ff0279..7e4f80c28 100644
--- a/src/pkg/http/Makefile
+++ b/src/pkg/http/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=http
GOFILES=\
diff --git a/src/pkg/http/pprof/Makefile b/src/pkg/http/pprof/Makefile
index e0315112f..5858a0efa 100644
--- a/src/pkg/http/pprof/Makefile
+++ b/src/pkg/http/pprof/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=http/pprof
GOFILES=\
diff --git a/src/pkg/image/Makefile b/src/pkg/image/Makefile
index 9015ed6eb..739ad804b 100644
--- a/src/pkg/image/Makefile
+++ b/src/pkg/image/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=image
GOFILES=\
diff --git a/src/pkg/image/jpeg/Makefile b/src/pkg/image/jpeg/Makefile
index c84811d6a..82d04c402 100644
--- a/src/pkg/image/jpeg/Makefile
+++ b/src/pkg/image/jpeg/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include $(GOROOT)/src/Make.$(GOARCH)
+include $(GOROOT)/src/Make.inc
TARG=image/jpeg
GOFILES=\
diff --git a/src/pkg/image/png/Makefile b/src/pkg/image/png/Makefile
index 3ba0f44d3..4101f77e1 100644
--- a/src/pkg/image/png/Makefile
+++ b/src/pkg/image/png/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=image/png
GOFILES=\
diff --git a/src/pkg/io/Makefile b/src/pkg/io/Makefile
index 837888d5c..9786002f0 100644
--- a/src/pkg/io/Makefile
+++ b/src/pkg/io/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=io
GOFILES=\
diff --git a/src/pkg/io/ioutil/Makefile b/src/pkg/io/ioutil/Makefile
index 77b75bcec..d406d4b7d 100644
--- a/src/pkg/io/ioutil/Makefile
+++ b/src/pkg/io/ioutil/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=io/ioutil
GOFILES=\
diff --git a/src/pkg/json/Makefile b/src/pkg/json/Makefile
index fa34bfd18..4e5a8a139 100644
--- a/src/pkg/json/Makefile
+++ b/src/pkg/json/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=json
GOFILES=\
diff --git a/src/pkg/log/Makefile b/src/pkg/log/Makefile
index 402be03bc..da72216af 100644
--- a/src/pkg/log/Makefile
+++ b/src/pkg/log/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=log
GOFILES=\
diff --git a/src/pkg/math/Makefile b/src/pkg/math/Makefile
index af1b535a8..c5af69eb7 100644
--- a/src/pkg/math/Makefile
+++ b/src/pkg/math/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=math
diff --git a/src/pkg/mime/Makefile b/src/pkg/mime/Makefile
index 1f1296b76..901ed6f8e 100644
--- a/src/pkg/mime/Makefile
+++ b/src/pkg/mime/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=mime
GOFILES=\
diff --git a/src/pkg/mime/multipart/Makefile b/src/pkg/mime/multipart/Makefile
index 0e6ee42dc..5a7b98d03 100644
--- a/src/pkg/mime/multipart/Makefile
+++ b/src/pkg/mime/multipart/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=mime/multipart
GOFILES=\
diff --git a/src/pkg/net/Makefile b/src/pkg/net/Makefile
index a69f3877e..658bc89c7 100644
--- a/src/pkg/net/Makefile
+++ b/src/pkg/net/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=net
GOFILES=\
diff --git a/src/pkg/net/dict/Makefile b/src/pkg/net/dict/Makefile
index 44c2d7a7c..eaa9e6531 100644
--- a/src/pkg/net/dict/Makefile
+++ b/src/pkg/net/dict/Makefile
@@ -1,4 +1,4 @@
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=net/dict
GOFILES=\
diff --git a/src/pkg/net/textproto/Makefile b/src/pkg/net/textproto/Makefile
index b5b51f66c..7897fa711 100644
--- a/src/pkg/net/textproto/Makefile
+++ b/src/pkg/net/textproto/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=net/textproto
GOFILES=\
diff --git a/src/pkg/netchan/Makefile b/src/pkg/netchan/Makefile
index a8a5c6a3c..9b9fdcf59 100644
--- a/src/pkg/netchan/Makefile
+++ b/src/pkg/netchan/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=netchan
GOFILES=\
diff --git a/src/pkg/nntp/Makefile b/src/pkg/nntp/Makefile
index 3cf3164ce..ce5e44755 100644
--- a/src/pkg/nntp/Makefile
+++ b/src/pkg/nntp/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=nntp
GOFILES=\
diff --git a/src/pkg/os/Makefile b/src/pkg/os/Makefile
index f1ad9af07..0b0881c0a 100644
--- a/src/pkg/os/Makefile
+++ b/src/pkg/os/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=os
GOFILES=\
diff --git a/src/pkg/os/signal/Makefile b/src/pkg/os/signal/Makefile
index 5a245464a..013b91a85 100644
--- a/src/pkg/os/signal/Makefile
+++ b/src/pkg/os/signal/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=os/signal
GOFILES=\
diff --git a/src/pkg/patch/Makefile b/src/pkg/patch/Makefile
index 1666345c6..32db7bdc8 100644
--- a/src/pkg/patch/Makefile
+++ b/src/pkg/patch/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=patch
GOFILES=\
diff --git a/src/pkg/path/Makefile b/src/pkg/path/Makefile
index 9372cdf37..a7e05714a 100644
--- a/src/pkg/path/Makefile
+++ b/src/pkg/path/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=path
GOFILES=\
diff --git a/src/pkg/rand/Makefile b/src/pkg/rand/Makefile
index bf3bd87d6..ec3b34180 100644
--- a/src/pkg/rand/Makefile
+++ b/src/pkg/rand/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=rand
GOFILES=\
diff --git a/src/pkg/reflect/Makefile b/src/pkg/reflect/Makefile
index b72d3873f..b946449a3 100644
--- a/src/pkg/reflect/Makefile
+++ b/src/pkg/reflect/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=reflect
GOFILES=\
diff --git a/src/pkg/regexp/Makefile b/src/pkg/regexp/Makefile
index 9f91c8e7a..9024e66da 100644
--- a/src/pkg/regexp/Makefile
+++ b/src/pkg/regexp/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=regexp
GOFILES=\
diff --git a/src/pkg/rpc/Makefile b/src/pkg/rpc/Makefile
index 4757b3aae..191b10d05 100644
--- a/src/pkg/rpc/Makefile
+++ b/src/pkg/rpc/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=rpc
GOFILES=\
diff --git a/src/pkg/rpc/jsonrpc/Makefile b/src/pkg/rpc/jsonrpc/Makefile
index 1a4fd2e92..b9a1ac2f7 100644
--- a/src/pkg/rpc/jsonrpc/Makefile
+++ b/src/pkg/rpc/jsonrpc/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=rpc/jsonrpc
GOFILES=\
diff --git a/src/pkg/runtime/Makefile b/src/pkg/runtime/Makefile
index a8e7bc750..cd08cfe98 100644
--- a/src/pkg/runtime/Makefile
+++ b/src/pkg/runtime/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=runtime
diff --git a/src/pkg/runtime/pprof/Makefile b/src/pkg/runtime/pprof/Makefile
index daffde79d..8bccc0cc0 100644
--- a/src/pkg/runtime/pprof/Makefile
+++ b/src/pkg/runtime/pprof/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=runtime/pprof
GOFILES=\
diff --git a/src/pkg/scanner/Makefile b/src/pkg/scanner/Makefile
index 8ac16d681..db4752513 100644
--- a/src/pkg/scanner/Makefile
+++ b/src/pkg/scanner/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=scanner
GOFILES=\
diff --git a/src/pkg/sort/Makefile b/src/pkg/sort/Makefile
index 57c9f8f47..3ea467240 100644
--- a/src/pkg/sort/Makefile
+++ b/src/pkg/sort/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=sort
GOFILES=\
diff --git a/src/pkg/strconv/Makefile b/src/pkg/strconv/Makefile
index 57849a821..823355d85 100644
--- a/src/pkg/strconv/Makefile
+++ b/src/pkg/strconv/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=strconv
GOFILES=\
diff --git a/src/pkg/strings/Makefile b/src/pkg/strings/Makefile
index 9bae470e9..c1be58243 100644
--- a/src/pkg/strings/Makefile
+++ b/src/pkg/strings/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=strings
GOFILES=\
diff --git a/src/pkg/sync/Makefile b/src/pkg/sync/Makefile
index dc3a4b442..f843795b0 100644
--- a/src/pkg/sync/Makefile
+++ b/src/pkg/sync/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=sync
GOFILES=\
diff --git a/src/pkg/syscall/Makefile b/src/pkg/syscall/Makefile
index 363eb601e..bf9ed1309 100644
--- a/src/pkg/syscall/Makefile
+++ b/src/pkg/syscall/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=syscall
GOFILES=\
diff --git a/src/pkg/syslog/Makefile b/src/pkg/syslog/Makefile
index f05d4aef4..cf6863c87 100644
--- a/src/pkg/syslog/Makefile
+++ b/src/pkg/syslog/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=syslog
GOFILES=\
diff --git a/src/pkg/tabwriter/Makefile b/src/pkg/tabwriter/Makefile
index 5beb88f0f..bdc888784 100644
--- a/src/pkg/tabwriter/Makefile
+++ b/src/pkg/tabwriter/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=tabwriter
GOFILES=\
diff --git a/src/pkg/template/Makefile b/src/pkg/template/Makefile
index c9c79f799..4915527b4 100644
--- a/src/pkg/template/Makefile
+++ b/src/pkg/template/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=template
GOFILES=\
diff --git a/src/pkg/testing/Makefile b/src/pkg/testing/Makefile
index 64485489e..19b791ae9 100644
--- a/src/pkg/testing/Makefile
+++ b/src/pkg/testing/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=testing
GOFILES=\
diff --git a/src/pkg/testing/iotest/Makefile b/src/pkg/testing/iotest/Makefile
index 2b9abd4b3..43a047cc9 100644
--- a/src/pkg/testing/iotest/Makefile
+++ b/src/pkg/testing/iotest/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=testing/iotest
GOFILES=\
diff --git a/src/pkg/testing/quick/Makefile b/src/pkg/testing/quick/Makefile
index 0e97f2af2..6d3b736b0 100644
--- a/src/pkg/testing/quick/Makefile
+++ b/src/pkg/testing/quick/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=testing/quick
GOFILES=\
diff --git a/src/pkg/testing/script/Makefile b/src/pkg/testing/script/Makefile
index 2e13aeb2f..9388d972b 100644
--- a/src/pkg/testing/script/Makefile
+++ b/src/pkg/testing/script/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../../Make.$(GOARCH)
+include ../../../Make.inc
TARG=testing/script
GOFILES=\
diff --git a/src/pkg/time/Makefile b/src/pkg/time/Makefile
index 6732d6a79..71318d738 100644
--- a/src/pkg/time/Makefile
+++ b/src/pkg/time/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=time
GOFILES=\
diff --git a/src/pkg/unicode/Makefile b/src/pkg/unicode/Makefile
index 0728ec881..df0b4a642 100644
--- a/src/pkg/unicode/Makefile
+++ b/src/pkg/unicode/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=unicode
GOFILES=\
diff --git a/src/pkg/utf16/Makefile b/src/pkg/utf16/Makefile
index 29e400503..8a564fb0f 100644
--- a/src/pkg/utf16/Makefile
+++ b/src/pkg/utf16/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=utf16
GOFILES=\
diff --git a/src/pkg/utf8/Makefile b/src/pkg/utf8/Makefile
index a013913c3..df69486dc 100644
--- a/src/pkg/utf8/Makefile
+++ b/src/pkg/utf8/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=utf8
GOFILES=\
diff --git a/src/pkg/websocket/Makefile b/src/pkg/websocket/Makefile
index 145d8f429..6d3c9cbd1 100644
--- a/src/pkg/websocket/Makefile
+++ b/src/pkg/websocket/Makefile
@@ -1,4 +1,4 @@
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=websocket
GOFILES=\
diff --git a/src/pkg/xml/Makefile b/src/pkg/xml/Makefile
index 38e32e7a4..b780face6 100644
--- a/src/pkg/xml/Makefile
+++ b/src/pkg/xml/Makefile
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../Make.$(GOARCH)
+include ../../Make.inc
TARG=xml
diff --git a/src/sudo.bash b/src/sudo.bash
index d87fb231d..147e58f15 100755
--- a/src/sudo.bash
+++ b/src/sudo.bash
@@ -3,6 +3,9 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
+set -e
+. ./env.bash
+
case "`uname`" in
Darwin)
;;