1
0
mirror of https://github.com/golang/go synced 2024-11-21 17:54:39 -07:00

build: remove unnecessary references to GOBIN and GOROOT

All scripts and makefiles assume that GOBIN is correctly set
in PATH.

R=rsc
CC=golang-dev
https://golang.org/cl/2043041
This commit is contained in:
Christian Himpel 2010-08-30 15:40:56 -04:00 committed by Russ Cox
parent c1497a0589
commit 5c603dbb75
19 changed files with 64 additions and 77 deletions

View File

@ -2,10 +2,10 @@
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
include $(GOROOT)/src/Make.inc include ../src/Make.inc
TARG=htmlgen TARG=htmlgen
GOFILES=\ GOFILES=\
htmlgen.go\ htmlgen.go\
include $(GOROOT)/src/Make.cmd include ../src/Make.cmd

View File

@ -6,12 +6,7 @@ include ../../../src/Make.inc
all: index.html all: index.html
# ugly hack to deal with whitespaces in $GOROOT include ../../../src/Make.common
nullstring :=
space := $(nullstring) # a space at the end
QUOTED_GOROOT:=$(subst $(space),\ ,$(GOROOT))
include $(QUOTED_GOROOT)/src/Make.common
CLEANFILES+=index.html srcextract.bin htmlify.bin CLEANFILES+=index.html srcextract.bin htmlify.bin
@ -23,7 +18,7 @@ test: final.bin
rm -f final.6 final.bin rm -f final.6 final.bin
%.bin: %.$O %.bin: %.$O
$(QUOTED_GOBIN)/$(LD) -o $@ $< $(LD) -o $@ $<
%.$O: %.$O:
$(QUOTED_GOBIN)/$(GC) $*.go $(GC) $*.go

View File

@ -5,9 +5,7 @@
set -e set -e
GOBIN="${GOBIN:-$HOME/bin}" eval $(gomake -f ../../src/Make.inc go-env)
eval $("$GOBIN"/gomake -f ../../src/Make.inc go-env)
if [ -z "$O" ]; then if [ -z "$O" ]; then
echo 'missing $O - maybe no Make.$GOARCH?' 1>&2 echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
@ -34,11 +32,11 @@ for i in \
; do ; do
BASE=$(basename $i .go) BASE=$(basename $i .go)
"$GOBIN"/$GC $i $GC $i
done done
function testit { function testit {
"$GOBIN"/$LD $1.$O $LD $1.$O
x=$(echo $(./$O.out $2 2>&1)) # extra echo canonicalizes x=$(echo $(./$O.out $2 2>&1)) # extra echo canonicalizes
if [ "$x" != "$3" ] if [ "$x" != "$3" ]
then then
@ -47,7 +45,7 @@ function testit {
} }
function testitpipe { function testitpipe {
"$GOBIN"/$LD $1.$O $LD $1.$O
x=$(echo $(./$O.out | $2 2>&1)) # extra echo canonicalizes x=$(echo $(./$O.out | $2 2>&1)) # extra echo canonicalizes
if [ "$x" != "$3" ] if [ "$x" != "$3" ]
then then
@ -76,7 +74,7 @@ testitpipe sieve "sed 10q" "2 3 5 7 11 13 17 19 23 29"
testitpipe sieve "sed 10q" "2 3 5 7 11 13 17 19 23 29" testitpipe sieve "sed 10q" "2 3 5 7 11 13 17 19 23 29"
# server hangs; don't run it, just compile it # server hangs; don't run it, just compile it
"$GOBIN"/$GC server.go $GC server.go
testit server1 "" "" testit server1 "" ""
rm -f $O.out *.$O rm -f $O.out *.$O

View File

@ -15,5 +15,5 @@ CLEANFILES+=hello fib chain run.out
include ../../../src/Make.pkg include ../../../src/Make.pkg
%: install %.go %: install %.go
$(QUOTED_GOBIN)/$(GC) $*.go $(GC) $*.go
$(QUOTED_GOBIN)/$(LD) -o $@ $*.$O $(LD) -o $@ $*.$O

View File

@ -4,8 +4,7 @@
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
set -e set -e
GOBIN="${GOBIN:-$HOME/bin}" gomake hello fib chain
"$GOBIN"/gomake hello fib chain
echo '*' hello >run.out echo '*' hello >run.out
./hello >>run.out ./hello >>run.out
echo '*' fib >>run.out echo '*' fib >>run.out
@ -13,4 +12,4 @@ echo '*' fib >>run.out
echo '*' chain >>run.out echo '*' chain >>run.out
./chain >>run.out ./chain >>run.out
diff run.out golden.out diff run.out golden.out
"$GOBIN"/gomake clean gomake clean

View File

@ -6,7 +6,7 @@ clean:
rm -rf *.o *.a *.[$(OS)] [$(OS)].out $(CLEANFILES) rm -rf *.o *.a *.[$(OS)] [$(OS)].out $(CLEANFILES)
%.make: %.make:
(cd $* && $(QUOTED_GOBIN)/gomake install) (cd $* && gomake install)
.PHONY: all clean nuke install coverage test bench testpackage-clean\ .PHONY: all clean nuke install coverage test bench testpackage-clean\
importpath dir importpath dir

View File

@ -27,6 +27,6 @@ do(
if test -f clean.bash; then if test -f clean.bash; then
bash clean.bash bash clean.bash
else else
"$GOBIN"/gomake clean gomake clean
fi fi
)done )done

View File

@ -20,7 +20,7 @@ gcc -o mkbuiltin1 mkbuiltin1.c
rm -f _builtin.c rm -f _builtin.c
for i in runtime unsafe for i in runtime unsafe
do do
"$GOBIN"/$GC -A $i.go $GC -A $i.go
O=$O ./mkbuiltin1 $i >>_builtin.c O=$O ./mkbuiltin1 $i >>_builtin.c
done done

View File

@ -71,10 +71,10 @@ do
bash make.bash bash make.bash
;; ;;
pkg) pkg)
"$GOBIN"/gomake install gomake install
;; ;;
*) *)
"$GOBIN"/gomake install gomake install
esac esac
) || exit 1 ) || exit 1
esac esac
@ -84,7 +84,7 @@ done
# Implemented as a function so that all.bash can repeat the output # Implemented as a function so that all.bash can repeat the output
# after run.bash finishes running all the tests. # after run.bash finishes running all the tests.
installed() { installed() {
eval $("$GOBIN"/gomake -f Make.inc go-env) eval $(gomake -f Make.inc go-env)
echo echo
echo --- echo ---
echo Installed Go for $GOOS/$GOARCH in "$GOROOT". echo Installed Go for $GOOS/$GOARCH in "$GOROOT".

View File

@ -22,16 +22,16 @@ GOFILES=\
include ../../../Make.pkg include ../../../Make.pkg
main.$O: main.go $(pkgdir)/$(TARG).a main.$O: main.go $(pkgdir)/$(TARG).a
$(QUOTED_GOBIN)/$(GC) $< $(GC) $<
eval: main.$O eval: main.$O
$(QUOTED_GOBIN)/$(LD) -o $@ $< $(LD) -o $@ $<
gen.$O: gen.go gen.$O: gen.go
$(QUOTED_GOBIN)/$(GC) $< $(GC) $<
generate: gen.$O $(pkgdir)/$(TARG).a generate: gen.$O $(pkgdir)/$(TARG).a
$(QUOTED_GOBIN)/$(LD) -o $@ $<;\ $(LD) -o $@ $<;\
./generate > expr1.go;\ ./generate > expr1.go;\
gofmt -w expr1.go gofmt -w expr1.go

View File

@ -10,10 +10,8 @@
set -e set -e
GOBIN="${GOBIN:-$HOME/bin}" gomake
6g main.go && 6l main.6
"$GOBIN"/gomake
"$GOBIN"/6g main.go && "$GOBIN"/6l main.6
( (
for i in $(egrep -l '// \$G (\$D/)?\$F\.go \&\& \$L \$F\.\$A && \./\$A\.out' "$GOROOT"/test/*.go "$GOROOT"/test/*/*.go) for i in $(egrep -l '// \$G (\$D/)?\$F\.go \&\& \$L \$F\.\$A && \./\$A\.out' "$GOROOT"/test/*.go "$GOROOT"/test/*/*.go)
do do

View File

@ -23,7 +23,7 @@ CLEANFILES+=ogle
include ../../../Make.pkg include ../../../Make.pkg
main.$O: main.go package main.$O: main.go package
$(QUOTED_GOBIN)/$(GC) -I_obj $< $(GC) -I_obj $<
ogle: main.$O ogle: main.$O
$(QUOTED_GOBIN)/$(LD) -L_obj -o $@ $< $(LD) -L_obj -o $@ $<

View File

@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
include $(GOROOT)/src/Make.inc include ../../../Make.inc
TARG=image/jpeg TARG=image/jpeg
GOFILES=\ GOFILES=\
@ -10,4 +10,4 @@ GOFILES=\
idct.go\ idct.go\
reader.go\ reader.go\
include $(GOROOT)/src/Make.pkg include ../../../Make.pkg

View File

@ -123,10 +123,10 @@ $(GOARCH)/asm.h: mkasmh.sh runtime.acid.$(GOARCH)
mv -f $@.x $@ mv -f $@.x $@
goc2c: goc2c.c goc2c: goc2c.c
$(QUOTED_GOBIN)/quietgcc -o $@ $< quietgcc -o $@ $<
mkversion: mkversion.c mkversion: mkversion.c
$(QUOTED_GOBIN)/quietgcc -o $@ -I "$(GOROOT)/include" $< "$(GOROOT)/lib/lib9.a" quietgcc -o $@ -I "$(GOROOT)/include" $< "$(GOROOT)/lib/lib9.a"
version.go: mkversion version.go: mkversion
./mkversion >version.go ./mkversion >version.go
@ -136,32 +136,32 @@ version.go: mkversion
mv -f $@.tmp $@ mv -f $@.tmp $@
%.$O: $(GOARCH)/%.c %.$O: $(GOARCH)/%.c
$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $< $(CC) $(CFLAGS) $<
%.$O: $(GOOS)/%.c %.$O: $(GOOS)/%.c
$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $< $(CC) $(CFLAGS) $<
%.$O: $(GOOS)/$(GOARCH)/%.c %.$O: $(GOOS)/$(GOARCH)/%.c
$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $< $(CC) $(CFLAGS) $<
%.$O: $(GOARCH)/%.s $(GOARCH)/asm.h %.$O: $(GOARCH)/%.s $(GOARCH)/asm.h
$(QUOTED_GOBIN)/$(AS) $< $(AS) $<
%.$O: $(GOOS)/$(GOARCH)/%.s $(GOARCH)/asm.h %.$O: $(GOOS)/$(GOARCH)/%.s $(GOARCH)/asm.h
$(QUOTED_GOBIN)/$(AS) $< $(AS) $<
# for discovering offsets inside structs when debugging # for discovering offsets inside structs when debugging
runtime.acid.$(GOARCH): runtime.h proc.c runtime.acid.$(GOARCH): runtime.h proc.c
$(QUOTED_GOBIN)/$(CC) $(CFLAGS) -a proc.c >$@ $(CC) $(CFLAGS) -a proc.c >$@
# 386 traceback is really amd64 traceback # 386 traceback is really amd64 traceback
ifeq ($(GOARCH),386) ifeq ($(GOARCH),386)
traceback.$O: amd64/traceback.c traceback.$O: amd64/traceback.c
$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $< $(CC) $(CFLAGS) $<
endif endif
# NaCl closure is special. # NaCl closure is special.
ifeq ($(GOOS),nacl) ifeq ($(GOOS),nacl)
closure.$O: nacl/$(GOARCH)/closure.c closure.$O: nacl/$(GOARCH)/closure.c
$(QUOTED_GOBIN)/$(CC) $(CFLAGS) $< $(CC) $(CFLAGS) $<
endif endif

View File

@ -4,7 +4,7 @@
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
# The master for this file is $GOROOT/src/quietgcc.bash # The master for this file is $GOROOT/src/quietgcc.bash
# Changes made to $HOME/bin/quietgcc will be overridden. # Changes made to $GOBIN/quietgcc will be overridden.
# Gcc output that we don't care to see. # Gcc output that we don't care to see.
ignore=': error: .Each undeclared identifier' ignore=': error: .Each undeclared identifier'

View File

@ -36,11 +36,11 @@ maketest() {
( (
xcd $i xcd $i
if $rebuild; then if $rebuild; then
"$GOBIN"/gomake clean gomake clean
time "$GOBIN"/gomake time gomake
"$GOBIN"/gomake install gomake install
fi fi
"$GOBIN"/gomake test gomake test
) || exit $? ) || exit $?
done done
} }
@ -53,36 +53,36 @@ maketest \
(xcd pkg/sync; (xcd pkg/sync;
if $rebuild; then if $rebuild; then
"$GOBIN"/gomake clean; gomake clean;
time "$GOBIN"/gomake time gomake
fi fi
GOMAXPROCS=10 "$GOBIN"/gomake test GOMAXPROCS=10 gomake test
) || exit $? ) || exit $?
(xcd cmd/gofmt (xcd cmd/gofmt
if $rebuild; then if $rebuild; then
"$GOBIN"/gomake clean; gomake clean;
time "$GOBIN"/gomake time gomake
fi fi
time "$GOBIN"/gomake smoketest time gomake smoketest
) || exit $? ) || exit $?
(xcd cmd/ebnflint (xcd cmd/ebnflint
if $rebuild; then if $rebuild; then
"$GOBIN"/gomake clean; gomake clean;
time "$GOBIN"/gomake time gomake
fi fi
time "$GOBIN"/gomake test time gomake test
) || exit $? ) || exit $?
(xcd ../misc/cgo/stdio (xcd ../misc/cgo/stdio
"$GOBIN"/gomake clean gomake clean
./test.bash ./test.bash
) || exit $? ) || exit $?
(xcd pkg/exp/ogle (xcd pkg/exp/ogle
"$GOBIN"/gomake clean gomake clean
time "$GOBIN"/gomake ogle time gomake ogle
) || exit $? ) || exit $?
(xcd ../doc/progs (xcd ../doc/progs

View File

@ -5,9 +5,7 @@
set -e set -e
GOBIN="${GOBIN:-$HOME/bin}" eval $(gomake --no-print-directory -f ../../src/Make.inc go-env)
eval $("$GOBIN"/gomake --no-print-directory -f ../../src/Make.inc go-env)
PATH=.:$PATH PATH=.:$PATH
mode=run mode=run
@ -18,11 +16,11 @@ X-test)
esac esac
gc() { gc() {
"$GOBIN"/$GC $1.go; "$GOBIN"/$LD $1.$O $GC $1.go; $LD $1.$O
} }
gc_B() { gc_B() {
"$GOBIN"/$GC -B $1.go; "$GOBIN"/$LD $1.$O $GC -B $1.go; $LD $1.$O
} }
runonly() { runonly() {

View File

@ -3,8 +3,7 @@
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
GOBIN="${GOBIN:-$HOME/bin}" eval $(gomake --no-print-directory -f ../src/Make.inc go-env)
eval $("$GOBIN"/gomake --no-print-directory -f ../src/Make.inc go-env)
case X"$GOARCH" in case X"$GOARCH" in
Xamd64) Xamd64)
@ -35,7 +34,7 @@ unset GREP_OPTIONS # in case user has a non-standard set
failed=0 failed=0
PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$HOME/bin}:`pwd` PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$GOROOT/bin}:`pwd`
RUNFILE=/tmp/gorun-$$-$USER RUNFILE=/tmp/gorun-$$-$USER
TMP1FILE=/tmp/gotest1-$$-$USER TMP1FILE=/tmp/gotest1-$$-$USER

View File

@ -24,7 +24,7 @@ export G=${A}g
export L=${A}l export L=${A}l
export GOTRACEBACK=0 export GOTRACEBACK=0
PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$HOME/bin}:`pwd` PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$GOROOT/bin}:`pwd`
RUNFILE=/tmp/gorun-$$-$USER RUNFILE=/tmp/gorun-$$-$USER
TMP1FILE=/tmp/gotest1-$$-$USER TMP1FILE=/tmp/gotest1-$$-$USER