Commit 360151d4 authored by Russ Cox's avatar Russ Cox

gobuild changes.

	* handles multiple packages per directory
	* scans directory for files if given no arguments
	* infers package name
	* includes test rule invoking gotest

R=r
DELTA=746  (444 added, 150 deleted, 152 changed)
OCL=19504
CL=19521
parent c1efd7d6
This diff is collapsed.
......@@ -10,4 +10,5 @@ clean:
@true
install: $(TARG)
test -f $(BIN)/$(TARG) && chmod u+w $(BIN)/$(TARG)
cp $(TARG) $(BIN)/$(TARG)
......@@ -8,9 +8,28 @@
# tests.
# If files are named on the command line, use them instead of test*.go.
set -e
gofiles=""
loop=true
while $loop; do
case "x$1" in
x-*)
loop=false
;;
x)
loop=false
;;
*)
gofiles="$gofiles $1"
shift
;;
esac
done
case "x$gofiles" in
x)
gofiles=$(echo test*.go)
esac
gofiles=${*:-$(echo test*.go)}
ofiles=$(echo $gofiles | sed 's/\.go/.6/g')
files=$(echo $gofiles | sed 's/\.go//g')
......@@ -19,8 +38,10 @@ do
6g $i
done
# They all compile; now generate the code to call them.
set -e
# They all compile; now generate the code to call them.
trap "rm -f _testmain.go _testmain.6 6.out" 0 1 2 3 14 15
{
# package spec
echo 'package main'
......@@ -48,4 +69,4 @@ done
6g _testmain.go
6l _testmain.6
6.out
6.out "$@"
......@@ -3,24 +3,20 @@
# license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild.
# gobuild -m fmt format.go print.go
# gobuild -m >Makefile
O=6
GC=$(O)g
CC=$(O)c -w
AS=$(O)a
AR=$(O)ar
PKG=fmt.a
PKGDIR=$(GOROOT)/pkg
install: $(PKG)
mv $(PKG) $(PKGDIR)/$(PKG)
nuke: clean
rm -f $(PKGDIR)/$(PKG)
default: packages
clean:
rm -f *.$O *.a $(PKG)
rm -f *.$O *.a
test: packages
gotest
%.$O: %.go
$(GC) $*.go
......@@ -31,21 +27,33 @@ clean:
%.$O: %.s
$(AS) $*.s
O1=\
format.$O\
O2=\
print.$O\
$(PKG): a1 a2
fmt.a: a1 a2
a1: $(O1)
$(AR) grc $(PKG) $(O1)
$(AR) grc fmt.a format.$O
rm -f $(O1)
a2: $(O2)
$(AR) grc $(PKG) $(O2)
$(AR) grc fmt.a print.$O
rm -f $(O2)
$(O1): nuke
newpkg: clean
$(AR) grc fmt.a
$(O1): newpkg
$(O2): a1
nuke: clean
rm -f $(GOROOT)/pkg/fmt.a
packages: fmt.a
install: packages
cp fmt.a $(GOROOT)/pkg/fmt.a
......@@ -3,23 +3,21 @@
# license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild.
# gobuild -m http conn.go request.go server.go url.go
# gobuild -m >Makefile
O=6
GC=$(O)g
CC=$(O)c -w
AS=$(O)a
AR=$(O)ar
PKG=$(GOROOT)/pkg/http.a
install: $(PKG)
nuke: clean
rm -f $(PKG)
default: packages
clean:
rm -f *.$O *.a
test: packages
gotest
%.$O: %.go
$(GC) $*.go
......@@ -29,7 +27,6 @@ clean:
%.$O: %.s
$(AS) $*.s
O1=\
url.$O\
......@@ -42,22 +39,48 @@ O3=\
O4=\
server.$O\
$(PKG): a1 a2 a3 a4
O5=\
triv.$O\
http.a: a1 a2 a3 a4 a5
main.a: a1 a2 a3 a4 a5
a1: $(O1)
$(AR) grc $(PKG) $(O1)
$(AR) grc http.a url.$O
rm -f $(O1)
a2: $(O2)
$(AR) grc $(PKG) $(O2)
$(AR) grc http.a request.$O
rm -f $(O2)
a3: $(O3)
$(AR) grc $(PKG) $(O3)
$(AR) grc http.a conn.$O
rm -f $(O3)
a4: $(O4)
$(AR) grc $(PKG) $(O4)
$(AR) grc http.a server.$O
rm -f $(O4)
$(O1): nuke
a5: $(O5)
$(AR) grc main.a triv.$O
rm -f $(O5)
newpkg: clean
$(AR) grc http.a
$(AR) grc main.a
$(O1): newpkg
$(O2): a1
$(O3): a2
$(O4): a3
$(O5): a4
nuke: clean
rm -f $(GOROOT)/pkg/http.a $(GOROOT)/pkg/main.a
packages: http.a main.a
install: packages
cp http.a $(GOROOT)/pkg/http.a
cp main.a $(GOROOT)/pkg/main.a
......@@ -3,26 +3,20 @@
# license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild.
# gobuild -m math asin.go atan.go atan2.go exp.go fabs.go floor.go\
# fmod.go hypot.go log.go pow.go pow10.go sin.go sinh.go sqrt.go\
# tan.go tanh.go
# gobuild -m >Makefile
O=6
GC=$(O)g
CC=$(O)c -w
AS=$(O)a
AR=$(O)ar
PKG=math.a
PKGDIR=$(GOROOT)/pkg
install: $(PKG)
mv $(PKG) $(PKGDIR)/$(PKG)
nuke: clean
rm -f $(PKGDIR)/$(PKG)
default: packages
clean:
rm -f *.$O *.a $(PKG)
rm -f *.$O *.a
test: packages
gotest
%.$O: %.go
$(GC) $*.go
......@@ -33,7 +27,6 @@ clean:
%.$O: %.s
$(AS) $*.s
O1=\
atan.$O\
fabs.$O\
......@@ -58,22 +51,37 @@ O3=\
O4=\
tanh.$O\
$(PKG): a1 a2 a3 a4
math.a: a1 a2 a3 a4
a1: $(O1)
$(AR) grc $(PKG) $(O1)
$(AR) grc math.a atan.$O fabs.$O floor.$O fmod.$O hypot.$O log.$O pow10.$O sin.$O sqrt.$O tan.$O
rm -f $(O1)
a2: $(O2)
$(AR) grc $(PKG) $(O2)
$(AR) grc math.a asin.$O atan2.$O exp.$O
rm -f $(O2)
a3: $(O3)
$(AR) grc $(PKG) $(O3)
$(AR) grc math.a pow.$O sinh.$O
rm -f $(O3)
a4: $(O4)
$(AR) grc $(PKG) $(O4)
$(AR) grc math.a tanh.$O
rm -f $(O4)
$(O1): nuke
newpkg: clean
$(AR) grc math.a
$(O1): newpkg
$(O2): a1
$(O3): a2
$(O4): a3
nuke: clean
rm -f $(GOROOT)/pkg/math.a
packages: math.a
install: packages
cp math.a $(GOROOT)/pkg/math.a
......@@ -3,23 +3,21 @@
# license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild.
# gobuild -m net fd_darwin.go fd.go net.go net_darwin.go ip.go
# gobuild -m fd_darwin.go fd.go net.go net_darwin.go ip.go >Makefile
O=6
GC=$(O)g
CC=$(O)c -w
AS=$(O)a
AR=$(O)ar
PKG=$(GOROOT)/pkg/net.a
install: $(PKG)
nuke: clean
rm -f $(PKG)
default: packages
clean:
rm -f *.$O *.a
test: packages
gotest
%.$O: %.go
$(GC) $*.go
......@@ -29,7 +27,6 @@ clean:
%.$O: %.s
$(AS) $*.s
O1=\
ip.$O\
......@@ -43,22 +40,37 @@ O3=\
O4=\
net.$O\
$(PKG): a1 a2 a3 a4
net.a: a1 a2 a3 a4
a1: $(O1)
$(AR) grc $(PKG) $(O1)
$(AR) grc net.a ip.$O
rm -f $(O1)
a2: $(O2)
$(AR) grc $(PKG) $(O2)
$(AR) grc net.a fd_$(GOOS).$O net_$(GOOS).$O
rm -f $(O2)
a3: $(O3)
$(AR) grc $(PKG) $(O3)
$(AR) grc net.a fd.$O
rm -f $(O3)
a4: $(O4)
$(AR) grc $(PKG) $(O4)
$(AR) grc net.a net.$O
rm -f $(O4)
$(O1): nuke
newpkg: clean
$(AR) grc net.a
$(O1): newpkg
$(O2): a1
$(O3): a2
$(O4): a3
nuke: clean
rm -f $(GOROOT)/pkg/net.a
packages: net.a
install: packages
cp net.a $(GOROOT)/pkg/net.a
......@@ -3,23 +3,21 @@
# license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild.
# gobuild -m os os_error.go os_file.go os_time.go os_env.go
# gobuild -m >Makefile
O=6
GC=$(O)g
CC=$(O)c -w
AS=$(O)a
AR=$(O)ar
PKG=$(GOROOT)/pkg/os.a
install: $(PKG)
nuke: clean
rm -f $(PKG)
default: packages
clean:
rm -f *.$O *.a
test: packages
gotest
%.$O: %.go
$(GC) $*.go
......@@ -29,21 +27,35 @@ clean:
%.$O: %.s
$(AS) $*.s
O1=\
os_error.$O\
O2=\
os_env.$O\
os_file.$O\
os_time.$O\
os_env.$O\
$(PKG): a1 a2
os.a: a1 a2
a1: $(O1)
$(AR) grc $(PKG) $(O1)
$(AR) grc os.a os_error.$O
rm -f $(O1)
a2: $(O2)
$(AR) grc $(PKG) $(O2)
$(AR) grc os.a os_env.$O os_file.$O os_time.$O
rm -f $(O2)
$(O1): nuke
newpkg: clean
$(AR) grc os.a
$(O1): newpkg
$(O2): a1
nuke: clean
rm -f $(GOROOT)/pkg/os.a
packages: os.a
install: packages
cp os.a $(GOROOT)/pkg/os.a
......@@ -3,24 +3,21 @@
# license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild.
# gobuild -m reflect tostring.go type.go value.go cast_amd64.s\
# typestring.c
# gobuild -m >Makefile
O=6
GC=$(O)g
CC=$(O)c -w
AS=$(O)a
AR=$(O)ar
PKG=$(GOROOT)/pkg/reflect.a
install: $(PKG)
nuke: clean
rm -f $(PKG)
default: packages
clean:
rm -f *.$O *.a
test: packages
gotest
%.$O: %.go
$(GC) $*.go
......@@ -30,10 +27,9 @@ clean:
%.$O: %.s
$(AS) $*.s
O1=\
cast_$(GOARCH).$O\
type.$O\
cast_amd64.$O\
typestring.$O\
O2=\
......@@ -42,15 +38,32 @@ O2=\
O3=\
tostring.$O\
$(PKG): a1 a2 a3
reflect.a: a1 a2 a3
a1: $(O1)
$(AR) grc $(PKG) $(O1)
$(AR) grc reflect.a cast_$(GOARCH).$O type.$O typestring.$O
rm -f $(O1)
a2: $(O2)
$(AR) grc $(PKG) $(O2)
$(AR) grc reflect.a value.$O
rm -f $(O2)
a3: $(O3)
$(AR) grc $(PKG) $(O3)
$(AR) grc reflect.a tostring.$O
rm -f $(O3)
newpkg: clean
$(AR) grc reflect.a
$(O1): nuke
$(O1): newpkg
$(O2): a1
$(O3): a2
nuke: clean
rm -f $(GOROOT)/pkg/reflect.a
packages: reflect.a
install: packages
cp reflect.a $(GOROOT)/pkg/reflect.a
......@@ -3,23 +3,21 @@
# license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild.
# gobuild -m strconv atof.go atoi.go decimal.go ftoa.go itoa.go
# gobuild -m >Makefile
O=6
GC=$(O)g
CC=$(O)c -w
AS=$(O)a
AR=$(O)ar
PKG=$(GOROOT)/pkg/strconv.a
install: $(PKG)
nuke: clean
rm -f $(PKG)
default: packages
clean:
rm -f *.$O *.a
test: packages
gotest
%.$O: %.go
$(GC) $*.go
......@@ -29,11 +27,10 @@ clean:
%.$O: %.s
$(AS) $*.s
O1=\
atoi.$O\
decimal.$O\
itoa.$O\
decimal.$O\
O2=\
ftoa.$O\
......@@ -41,18 +38,32 @@ O2=\
O3=\
atof.$O\
$(PKG): a1 a2 a3
strconv.a: a1 a2 a3
a1: $(O1)
$(AR) grc $(PKG) $(O1)
$(AR) grc strconv.a atoi.$O itoa.$O decimal.$O
rm -f $(O1)
a2: $(O2)
$(AR) grc $(PKG) $(O2)
$(AR) grc strconv.a ftoa.$O
rm -f $(O2)
a3: $(O3)
$(AR) grc $(PKG) $(O3)
$(AR) grc strconv.a atof.$O
rm -f $(O3)
$(O1): nuke
newpkg: clean
$(AR) grc strconv.a
$(O1): newpkg
$(O2): a1
$(O3): a2
nuke: clean
rm -f $(GOROOT)/pkg/strconv.a
packages: strconv.a
install: packages
cp strconv.a $(GOROOT)/pkg/strconv.a
......@@ -3,25 +3,23 @@
# license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild.
# gobuild -m syscall errstr_darwin.go file_darwin.go socket_darwin.go\
# gobuild -m errstr_darwin.go file_darwin.go socket_darwin.go\
# syscall_amd64_darwin.go time_amd64_darwin.go types_amd64_darwin.go\
# asm_amd64_darwin.s cast_amd64.s syscall.go
# asm_amd64_darwin.s cast_amd64.s syscall.go >Makefile
O=6
GC=$(O)g
CC=$(O)c -w
AS=$(O)a
AR=$(O)ar
PKG=$(GOROOT)/pkg/syscall.a
install: $(PKG)
nuke: clean
rm -f $(PKG)
default: packages
clean:
rm -f *.$O *.a
test: packages
gotest
%.$O: %.go
$(GC) $*.go
......@@ -31,7 +29,6 @@ clean:
%.$O: %.s
$(AS) $*.s
O1=\
errstr_$(GOOS).$O\
syscall_$(GOARCH)_$(GOOS).$O\
......@@ -45,14 +42,27 @@ O2=\
socket_$(GOOS).$O\
time_$(GOARCH)_$(GOOS).$O\
$(PKG): a1 a2
syscall.a: a1 a2
a1: $(O1)
$(AR) grc $(PKG) $(O1)
$(AR) grc syscall.a errstr_$(GOOS).$O syscall_$(GOARCH)_$(GOOS).$O types_$(GOARCH)_$(GOOS).$O asm_$(GOARCH)_$(GOOS).$O cast_$(GOARCH).$O syscall.$O
rm -f $(O1)
a2: $(O2)
$(AR) grc $(PKG) $(O2)
$(AR) grc syscall.a file_$(GOOS).$O socket_$(GOOS).$O time_$(GOARCH)_$(GOOS).$O
rm -f $(O2)
$(O1): nuke
newpkg: clean
$(AR) grc syscall.a
$(O1): newpkg
$(O2): a1
nuke: clean
rm -f $(GOROOT)/pkg/syscall.a
packages: syscall.a
install: packages
cp syscall.a $(GOROOT)/pkg/syscall.a
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment