diff options
author | Russ Cox <rsc@golang.org> | 2009-06-05 10:59:55 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-06-05 10:59:55 -0700 |
commit | b7918384eb08c46f0713242dfc12189355c5a46d (patch) | |
tree | 95be254f79134e2709431c95f6ddfea42bfca2e6 /src | |
parent | 5f86e72160dde4dbd68635e517e9a908a14f6aaa (diff) | |
download | go-b7918384eb08c46f0713242dfc12189355c5a46d.tar.gz |
restructure makefiles, scripts to factor out O= logic.
remove a few hardcoded paths elsewhere too.
R=r,gri
DELTA=123 (44 added, 15 deleted, 64 changed)
OCL=29914
CL=29945
Diffstat (limited to 'src')
-rw-r--r-- | src/Make.386 | 9 | ||||
-rw-r--r-- | src/Make.amd64 | 9 | ||||
-rw-r--r-- | src/Make.arm | 9 | ||||
-rwxr-xr-x | src/cmd/gc/mkbuiltin | 9 | ||||
-rwxr-xr-x | src/cmd/gotest/gotest | 20 | ||||
-rw-r--r-- | src/cmd/ld/go.c | 20 | ||||
-rw-r--r-- | src/cmd/make.bash | 11 | ||||
-rw-r--r-- | src/lib/Makefile | 2 |
8 files changed, 60 insertions, 29 deletions
diff --git a/src/Make.386 b/src/Make.386 new file mode 100644 index 000000000..d97965f1c --- /dev/null +++ b/src/Make.386 @@ -0,0 +1,9 @@ +# 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. + +O=8 +AS=${O}a +CC=${O}c +GC=${O}g +LD=${O}l diff --git a/src/Make.amd64 b/src/Make.amd64 new file mode 100644 index 000000000..a6bc9c67d --- /dev/null +++ b/src/Make.amd64 @@ -0,0 +1,9 @@ +# 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. + +O=6 +AS=${O}a +CC=${O}c +GC=${O}g +LD=${O}l diff --git a/src/Make.arm b/src/Make.arm new file mode 100644 index 000000000..ef907329d --- /dev/null +++ b/src/Make.arm @@ -0,0 +1,9 @@ +# 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. + +O=5 +AS=${O}a +CC=${O}c +GC=${O}g +LD=${O}l diff --git a/src/cmd/gc/mkbuiltin b/src/cmd/gc/mkbuiltin index 97d98fd82..ba01cbb45 100755 --- a/src/cmd/gc/mkbuiltin +++ b/src/cmd/gc/mkbuiltin @@ -4,11 +4,18 @@ # license that can be found in the LICENSE file. set -e + +. $GOROOT/src/Make.$GOARCH +if [ -z "$GC" ]; then + echo 'missing $GC - maybe no Make.$GOARCH?' 1>&2 + exit 1 +fi + gcc -o mkbuiltin1 mkbuiltin1.c rm -f _builtin.c for i in sys unsafe do - 6g $i.go + $GC $i.go ./mkbuiltin1 $i >>_builtin.c done diff --git a/src/cmd/gotest/gotest b/src/cmd/gotest/gotest index 7574926ab..7d64d56cc 100755 --- a/src/cmd/gotest/gotest +++ b/src/cmd/gotest/gotest @@ -8,18 +8,20 @@ # tests. # If files are named on the command line, use them instead of test*.go. -case "$GOARCH" in -amd64) O=6;; -arm) O=5;; -386) O=8;; -*) echo 'unknown $GOARCH' 1>&2 -esac +_GC=$GC # Make.$GOARCH will overwrite this -GC=${GC:-${O}g} -GL=${GL:-${O}l} -export GC GL +. $GOROOT/src/Make.$GOARCH +if [ -z "$O" ]; then + echo 'missing $O - maybe no Make.$GOARCH?' 1>&2 + exit 1 +fi + +# Allow overrides +GC=${_GC:-$GC} +GL=${GL:-$LD} GC="$GC -I _obj" GL="$GL -L _obj" +export GC GL gofiles="" loop=true diff --git a/src/cmd/ld/go.c b/src/cmd/ld/go.c index e20f10a14..6990d7329 100644 --- a/src/cmd/ld/go.c +++ b/src/cmd/ld/go.c @@ -100,12 +100,12 @@ ldpkg(Biobuf *f, int64 len, char *filename) return; if((int)len != len) { - fprint(2, "6l: too much pkg data in %s\n", filename); + fprint(2, "%s: too much pkg data in %s\n", argv0, filename); return; } data = mal(len+1); if(Bread(f, data, len) != len) { - fprint(2, "6l: short pkg read %s\n", filename); + fprint(2, "%s: short pkg read %s\n", argv0, filename); return; } data[len] = '\0'; @@ -121,13 +121,13 @@ ldpkg(Biobuf *f, int64 len, char *filename) // second marks end of exports / beginning of local data p1 = strstr(p0, "\n$$"); if(p1 == nil) { - fprint(2, "6l: cannot find end of exports in %s\n", filename); + fprint(2, "%s: cannot find end of exports in %s\n", argv0, filename); return; } while(*p0 == ' ' || *p0 == '\t' || *p0 == '\n') p0++; if(strncmp(p0, "package ", 8) != 0) { - fprint(2, "6l: bad package section in %s\n", filename); + fprint(2, "%s: bad package section in %s\n", argv0, filename); return; } p0 += 8; @@ -147,7 +147,7 @@ ldpkg(Biobuf *f, int64 len, char *filename) // local types end at next \n$$. p1 = strstr(p0, "\n$$"); if(p1 == nil) { - fprint(2, "6l: cannot find end of local types in %s\n", filename); + fprint(2, "%s: cannot find end of local types in %s\n", argv0, filename); return; } @@ -173,13 +173,13 @@ loadpkgdata(char *file, char *data, int len) x->export = export; } else { if(strcmp(x->prefix, prefix) != 0) { - fprint(2, "6l: conflicting definitions for %s\n", name); + fprint(2, "%s: conflicting definitions for %s\n", argv0, name); fprint(2, "%s:\t%s %s ...\n", x->file, x->prefix, name); fprint(2, "%s:\t%s %s ...\n", file, prefix, name); nerrors++; } else if(strcmp(x->def, def) != 0) { - fprint(2, "6l: conflicting definitions for %s\n", name); + fprint(2, "%s: conflicting definitions for %s\n", argv0, name); fprint(2, "%s:\t%s %s %s\n", x->file, x->prefix, name, x->def); fprint(2, "%s:\t%s %s %s\n", file, prefix, name, def); nerrors++; @@ -232,7 +232,7 @@ parsepkgdata(char *file, char **pp, char *ep, int *exportp, char **prefixp, char else if(strncmp(p, "const ", 6) == 0) p += 6; else{ - fprint(2, "6l: confused in pkg data near <<%.20s>>\n", p); + fprint(2, "%s: confused in pkg data near <<%.20s>>\n", argv0, p); nerrors++; return -1; } @@ -265,7 +265,7 @@ parsepkgdata(char *file, char **pp, char *ep, int *exportp, char **prefixp, char // indented we could do something more complicated, // but for now just diagnose the problem and assume // 6g will keep indenting for us. - fprint(2, "6l: %s: expected methods to be indented %p %p %.10s\n", + fprint(2, "%s: %s: expected methods to be indented %p %p %.10s\n", argv0, file, edef, meth, meth); nerrors++; return -1; @@ -305,7 +305,7 @@ parsemethod(char **pp, char *ep, char **methp) while(p < ep && *p != '\n') p++; if(p >= ep) { - fprint(2, "6l: lost end of line in method definition\n"); + fprint(2, "%s: lost end of line in method definition\n", argv0); *pp = ep; return -1; } diff --git a/src/cmd/make.bash b/src/cmd/make.bash index f406e358a..ca4517218 100644 --- a/src/cmd/make.bash +++ b/src/cmd/make.bash @@ -7,14 +7,11 @@ set -e bash clean.bash -case "$GOARCH" in -386) O=8;; -amd64) O=6;; -arm) O=5;; -*) - echo 'unknown $GOARCH' 1>&2 +. $GOROOT/src/Make.$GOARCH +if [ -z "$O" ]; then + echo 'missing $O - maybe no Make.$GOARCH?' 1>&2 exit 1 -esac +fi cd ${O}l bash mkenam diff --git a/src/lib/Makefile b/src/lib/Makefile index bdcfa0194..6627f586e 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -11,8 +11,6 @@ all: install -GC=6g - DIRS=\ bignum\ bufio\ |