aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
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
commitda392d9136b56b28d901aacf9fe79996bf729c65 (patch)
tree049d4382b068bdd59ecec8dad9617bbb3be5f512 /src/cmd
parent31339c32244a58263dd2f375d0c32d5f0ac596e5 (diff)
downloadgo-da392d9136b56b28d901aacf9fe79996bf729c65.tar.xz
build: no required environment variables
R=adg, r, PeterGo CC=golang-dev https://golang.org/cl/1942044
Diffstat (limited to 'src/cmd')
-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
15 files changed, 58 insertions, 15 deletions
diff --git a/src/cmd/cgo/Makefile b/src/cmd/cgo/Makefile
index 34ca3dd46e..5458c3e4f4 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 8cb9fd821d..77279db245 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 13309ec320..e29487e4bc 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 d799219dd2..106f46effa 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 2294fd1dbf..43434a5659 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 133cc8a64f..36f7d6e48e 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 cf4728401a..6ddb32be72 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 5d2af2e7ca..ffa6eb7afc 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 c15709b313..769c874159 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 0000000000..2f35fd9dd5
--- /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 b20b1daffd..8360fd1841 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 cea2ab9058..9995496ad6 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 77ac918bc9..54b8f3360f 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 f7d64bc123..1ef98d7f97 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 d0fda7d183..4ee22776b3 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