mirror of
https://github.com/golang/go
synced 2024-11-22 05:54:40 -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
|
# 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.
|
||||||
|
|
||||||
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 \
|
for i in \
|
||||||
file.go \
|
file.go \
|
||||||
@ -23,12 +30,12 @@ for i in \
|
|||||||
; do
|
; do
|
||||||
BASE=$(basename $i .go)
|
BASE=$(basename $i .go)
|
||||||
|
|
||||||
6g $i
|
$GC $i
|
||||||
done
|
done
|
||||||
|
|
||||||
function testit {
|
function testit {
|
||||||
6l $1.6
|
$LD $1.$O
|
||||||
x=$(echo $(./6.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
|
||||||
echo $1 failed: '"'$x'"' is not '"'$3'"'
|
echo $1 failed: '"'$x'"' is not '"'$3'"'
|
||||||
@ -36,8 +43,8 @@ function testit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testitpipe {
|
function testitpipe {
|
||||||
6l $1.6
|
$LD $1.$O
|
||||||
x=$(echo $(./6.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
|
||||||
echo $1 failed: '"'$x'"' is not '"'$3'"'
|
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"
|
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
|
||||||
6g server.go
|
$GC server.go
|
||||||
testit server1 "" ""
|
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.
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
set -e
|
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
|
gcc -o mkbuiltin1 mkbuiltin1.c
|
||||||
rm -f _builtin.c
|
rm -f _builtin.c
|
||||||
for i in sys unsafe
|
for i in sys unsafe
|
||||||
do
|
do
|
||||||
6g $i.go
|
$GC $i.go
|
||||||
./mkbuiltin1 $i >>_builtin.c
|
./mkbuiltin1 $i >>_builtin.c
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -8,18 +8,20 @@
|
|||||||
# tests.
|
# tests.
|
||||||
# If files are named on the command line, use them instead of test*.go.
|
# If files are named on the command line, use them instead of test*.go.
|
||||||
|
|
||||||
case "$GOARCH" in
|
_GC=$GC # Make.$GOARCH will overwrite this
|
||||||
amd64) O=6;;
|
|
||||||
arm) O=5;;
|
|
||||||
386) O=8;;
|
|
||||||
*) echo 'unknown $GOARCH' 1>&2
|
|
||||||
esac
|
|
||||||
|
|
||||||
GC=${GC:-${O}g}
|
. $GOROOT/src/Make.$GOARCH
|
||||||
GL=${GL:-${O}l}
|
if [ -z "$O" ]; then
|
||||||
export GC GL
|
echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Allow overrides
|
||||||
|
GC=${_GC:-$GC}
|
||||||
|
GL=${GL:-$LD}
|
||||||
GC="$GC -I _obj"
|
GC="$GC -I _obj"
|
||||||
GL="$GL -L _obj"
|
GL="$GL -L _obj"
|
||||||
|
export GC GL
|
||||||
|
|
||||||
gofiles=""
|
gofiles=""
|
||||||
loop=true
|
loop=true
|
||||||
|
@ -100,12 +100,12 @@ ldpkg(Biobuf *f, int64 len, char *filename)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if((int)len != len) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
data = mal(len+1);
|
data = mal(len+1);
|
||||||
if(Bread(f, data, len) != len) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
data[len] = '\0';
|
data[len] = '\0';
|
||||||
@ -121,13 +121,13 @@ ldpkg(Biobuf *f, int64 len, char *filename)
|
|||||||
// second marks end of exports / beginning of local data
|
// second marks end of exports / beginning of local data
|
||||||
p1 = strstr(p0, "\n$$");
|
p1 = strstr(p0, "\n$$");
|
||||||
if(p1 == nil) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
while(*p0 == ' ' || *p0 == '\t' || *p0 == '\n')
|
while(*p0 == ' ' || *p0 == '\t' || *p0 == '\n')
|
||||||
p0++;
|
p0++;
|
||||||
if(strncmp(p0, "package ", 8) != 0) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
p0 += 8;
|
p0 += 8;
|
||||||
@ -147,7 +147,7 @@ ldpkg(Biobuf *f, int64 len, char *filename)
|
|||||||
// local types end at next \n$$.
|
// local types end at next \n$$.
|
||||||
p1 = strstr(p0, "\n$$");
|
p1 = strstr(p0, "\n$$");
|
||||||
if(p1 == nil) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,13 +173,13 @@ loadpkgdata(char *file, char *data, int len)
|
|||||||
x->export = export;
|
x->export = export;
|
||||||
} else {
|
} else {
|
||||||
if(strcmp(x->prefix, prefix) != 0) {
|
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", x->file, x->prefix, name);
|
||||||
fprint(2, "%s:\t%s %s ...\n", file, prefix, name);
|
fprint(2, "%s:\t%s %s ...\n", file, prefix, name);
|
||||||
nerrors++;
|
nerrors++;
|
||||||
}
|
}
|
||||||
else if(strcmp(x->def, def) != 0) {
|
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", x->file, x->prefix, name, x->def);
|
||||||
fprint(2, "%s:\t%s %s %s\n", file, prefix, name, def);
|
fprint(2, "%s:\t%s %s %s\n", file, prefix, name, def);
|
||||||
nerrors++;
|
nerrors++;
|
||||||
@ -232,7 +232,7 @@ parsepkgdata(char *file, char **pp, char *ep, int *exportp, char **prefixp, char
|
|||||||
else if(strncmp(p, "const ", 6) == 0)
|
else if(strncmp(p, "const ", 6) == 0)
|
||||||
p += 6;
|
p += 6;
|
||||||
else{
|
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++;
|
nerrors++;
|
||||||
return -1;
|
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,
|
// indented we could do something more complicated,
|
||||||
// but for now just diagnose the problem and assume
|
// but for now just diagnose the problem and assume
|
||||||
// 6g will keep indenting for us.
|
// 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);
|
file, edef, meth, meth);
|
||||||
nerrors++;
|
nerrors++;
|
||||||
return -1;
|
return -1;
|
||||||
@ -305,7 +305,7 @@ parsemethod(char **pp, char *ep, char **methp)
|
|||||||
while(p < ep && *p != '\n')
|
while(p < ep && *p != '\n')
|
||||||
p++;
|
p++;
|
||||||
if(p >= ep) {
|
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;
|
*pp = ep;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,11 @@ set -e
|
|||||||
|
|
||||||
bash clean.bash
|
bash clean.bash
|
||||||
|
|
||||||
case "$GOARCH" in
|
. $GOROOT/src/Make.$GOARCH
|
||||||
386) O=8;;
|
if [ -z "$O" ]; then
|
||||||
amd64) O=6;;
|
echo 'missing $O - maybe no Make.$GOARCH?' 1>&2
|
||||||
arm) O=5;;
|
|
||||||
*)
|
|
||||||
echo 'unknown $GOARCH' 1>&2
|
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
fi
|
||||||
|
|
||||||
cd ${O}l
|
cd ${O}l
|
||||||
bash mkenam
|
bash mkenam
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
all: install
|
all: install
|
||||||
|
|
||||||
GC=6g
|
|
||||||
|
|
||||||
DIRS=\
|
DIRS=\
|
||||||
bignum\
|
bignum\
|
||||||
bufio\
|
bufio\
|
||||||
|
@ -2,19 +2,18 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
G=6g
|
include $(GOROOT)/src/Make.$(GOARCH)
|
||||||
L=6l
|
|
||||||
|
|
||||||
all: untab godoc pretty
|
all: untab godoc pretty
|
||||||
|
|
||||||
untab: untab.6
|
untab: untab.$O
|
||||||
$(L) -o untab untab.6
|
$(LD) -o untab untab.$O
|
||||||
|
|
||||||
godoc: godoc.6
|
godoc: godoc.$O
|
||||||
$(L) -o godoc godoc.6
|
$(LD) -o godoc godoc.$O
|
||||||
|
|
||||||
pretty: pretty.6
|
pretty: pretty.$O
|
||||||
$(L) -o pretty pretty.6
|
$(LD) -o pretty pretty.$O
|
||||||
|
|
||||||
test: pretty
|
test: pretty
|
||||||
./test.sh
|
./test.sh
|
||||||
@ -28,11 +27,11 @@ install: pretty godoc untab
|
|||||||
cp untab $(HOME)/bin/untab
|
cp untab $(HOME)/bin/untab
|
||||||
|
|
||||||
clean:
|
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
|
%.$O: %.go
|
||||||
$(G) $(F) $<
|
$(GC) $(F) $<
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
|
|
||||||
#!/bin/bash
|
#!/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"
|
CMD="./pretty -format=ast.txt"
|
||||||
TMP1=test_tmp1.go
|
TMP1=test_tmp1.go
|
||||||
TMP2=test_tmp2.go
|
TMP2=test_tmp2.go
|
||||||
@ -103,7 +109,7 @@ valid() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
6g -o /dev/null $TMP1
|
$GC -o /dev/null $TMP1
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo "Error (step 2 of validity test): test.sh $1"
|
echo "Error (step 2 of validity test): test.sh $1"
|
||||||
exit 1
|
exit 1
|
||||||
@ -125,7 +131,7 @@ runtest() {
|
|||||||
runtests() {
|
runtests() {
|
||||||
if [ $# == 0 ]; then
|
if [ $# == 0 ]; then
|
||||||
runtest apply
|
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
|
# do it in local directory only because of the prerequisites required
|
||||||
#echo "Testing validity"
|
#echo "Testing validity"
|
||||||
cleanup
|
cleanup
|
||||||
|
Loading…
Reference in New Issue
Block a user