mirror of
https://github.com/golang/go
synced 2024-11-22 00:04:41 -07:00
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
This commit is contained in:
parent
b014be75d2
commit
6609d2f88d
@ -3,7 +3,14 @@
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
rm -f *.6
|
||||
. $GOROOT/src/Make.$GOARCH
|
||||
|
||||
if [ -z "$O" ]; then
|
||||
echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f *.$O
|
||||
|
||||
for i in \
|
||||
file.go \
|
||||
@ -23,12 +30,12 @@ for i in \
|
||||
; do
|
||||
BASE=$(basename $i .go)
|
||||
|
||||
6g $i
|
||||
$GC $i
|
||||
done
|
||||
|
||||
function testit {
|
||||
6l $1.6
|
||||
x=$(echo $(./6.out $2 2>&1)) # extra echo canonicalizes
|
||||
$LD $1.$O
|
||||
x=$(echo $(./$O.out $2 2>&1)) # extra echo canonicalizes
|
||||
if [ "$x" != "$3" ]
|
||||
then
|
||||
echo $1 failed: '"'$x'"' is not '"'$3'"'
|
||||
@ -36,8 +43,8 @@ function testit {
|
||||
}
|
||||
|
||||
function testitpipe {
|
||||
6l $1.6
|
||||
x=$(echo $(./6.out | $2 2>&1)) # extra echo canonicalizes
|
||||
$LD $1.$O
|
||||
x=$(echo $(./$O.out | $2 2>&1)) # extra echo canonicalizes
|
||||
if [ "$x" != "$3" ]
|
||||
then
|
||||
echo $1 failed: '"'$x'"' is not '"'$3'"'
|
||||
@ -65,7 +72,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"
|
||||
|
||||
# server hangs; don't run it, just compile it
|
||||
6g server.go
|
||||
$GC server.go
|
||||
testit server1 "" ""
|
||||
|
||||
rm -f 6.out *.6
|
||||
rm -f $O.out *.$O
|
||||
|
9
src/Make.386
Normal file
9
src/Make.386
Normal file
@ -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
|
9
src/Make.amd64
Normal file
9
src/Make.amd64
Normal file
@ -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
|
9
src/Make.arm
Normal file
9
src/Make.arm
Normal file
@ -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
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
all: install
|
||||
|
||||
GC=6g
|
||||
|
||||
DIRS=\
|
||||
bignum\
|
||||
bufio\
|
||||
|
@ -2,19 +2,18 @@
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
G=6g
|
||||
L=6l
|
||||
include $(GOROOT)/src/Make.$(GOARCH)
|
||||
|
||||
all: untab godoc pretty
|
||||
|
||||
untab: untab.6
|
||||
$(L) -o untab untab.6
|
||||
untab: untab.$O
|
||||
$(LD) -o untab untab.$O
|
||||
|
||||
godoc: godoc.6
|
||||
$(L) -o godoc godoc.6
|
||||
godoc: godoc.$O
|
||||
$(LD) -o godoc godoc.$O
|
||||
|
||||
pretty: pretty.6
|
||||
$(L) -o pretty pretty.6
|
||||
pretty: pretty.$O
|
||||
$(LD) -o pretty pretty.$O
|
||||
|
||||
test: pretty
|
||||
./test.sh
|
||||
@ -28,11 +27,11 @@ install: pretty godoc untab
|
||||
cp untab $(HOME)/bin/untab
|
||||
|
||||
clean:
|
||||
rm -f pretty untab godoc *.6 *.a 6.out *~
|
||||
rm -f pretty untab godoc *.$O *.a 6.out *~
|
||||
|
||||
godoc.6: astprinter.6
|
||||
godoc.$O: astprinter.$O
|
||||
|
||||
pretty.6: astprinter.6
|
||||
pretty.$O: astprinter.$O
|
||||
|
||||
%.6: %.go
|
||||
$(G) $(F) $<
|
||||
%.$O: %.go
|
||||
$(GC) $(F) $<
|
||||
|
@ -4,6 +4,12 @@
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
. $GOROOT/src/Make.$GOARCH
|
||||
if [ -z "$O" ]; then
|
||||
echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CMD="./pretty -format=ast.txt"
|
||||
TMP1=test_tmp1.go
|
||||
TMP2=test_tmp2.go
|
||||
@ -103,7 +109,7 @@ valid() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
6g -o /dev/null $TMP1
|
||||
$GC -o /dev/null $TMP1
|
||||
if [ $? != 0 ]; then
|
||||
echo "Error (step 2 of validity test): test.sh $1"
|
||||
exit 1
|
||||
@ -125,7 +131,7 @@ runtest() {
|
||||
runtests() {
|
||||
if [ $# == 0 ]; then
|
||||
runtest apply
|
||||
# verify the pretty-printed files can be compiled with 6g again
|
||||
# verify the pretty-printed files can be compiled with $GC again
|
||||
# do it in local directory only because of the prerequisites required
|
||||
#echo "Testing validity"
|
||||
cleanup
|
||||
|
Loading…
Reference in New Issue
Block a user