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
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
void void
usage(void) usage(void)
{ {
fprint(2, "usage: gobuild [-m] packagename *.go *.c *.s\n"); fprint(2, "usage: gobuild [-m] [packagename...]\n");
exits("usage"); exits("usage");
} }
...@@ -22,14 +22,47 @@ int makefile; // generate Makefile ...@@ -22,14 +22,47 @@ int makefile; // generate Makefile
char *thechar; // object character char *thechar; // object character
char *goos; char *goos;
char *goarch; char *goarch;
char *goroot;
char **oargv;
int oargc;
void writemakefile(void);
int sourcefilenames(char***);
void*
emalloc(int n)
{
void *v;
v = malloc(n);
if(v == nil)
sysfatal("out of memory");
memset(v, 0, n);
return v;
}
void*
erealloc(void *v, int n)
{
v = realloc(v, n);
if(v == nil)
sysfatal("out of memory");
return v;
}
// Info about when to compile a particular file. // Info about when to compile a particular file.
typedef struct Job Job; typedef struct Job Job;
struct Job struct Job
{ {
char *name; char *name;
char *pkg;
int pass; int pass;
}; };
Job *job;
int njob;
char **pkg;
int npkg;
// Run the command in argv. // Run the command in argv.
// Return -1 if it fails (non-zero exit status). // Return -1 if it fails (non-zero exit status).
...@@ -42,6 +75,7 @@ run(char **argv, int showoutput) ...@@ -42,6 +75,7 @@ run(char **argv, int showoutput)
int pid, i; int pid, i;
Waitmsg *w; Waitmsg *w;
vlong n0, n1; vlong n0, n1;
char buf[100];
n0 = nsec(); n0 = nsec();
pid = fork(); pid = fork();
...@@ -49,22 +83,22 @@ run(char **argv, int showoutput) ...@@ -49,22 +83,22 @@ run(char **argv, int showoutput)
sysfatal("fork: %r"); sysfatal("fork: %r");
if(pid == 0){ if(pid == 0){
dup(devnull, 0); dup(devnull, 0);
if(!showoutput){ if(!showoutput)
dup(devnull, 1);
dup(devnull, 2); dup(devnull, 2);
}else{
dup(2, 1); dup(2, 1);
}
if(devnull > 2) if(devnull > 2)
close(devnull); close(devnull);
exec(argv[0], argv); exec(argv[0], argv);
fprint(2, "exec %s: %r\n", argv[0]); fprint(2, "exec %s: %r\n", argv[0]);
exit(1); exit(1);
} }
w = waitfor(pid); while((w = waitfor(pid)) == nil) {
n1 = nsec(); rerrstr(buf, sizeof buf);
if(w == nil) if(strstr(buf, "interrupt"))
continue;
sysfatal("waitfor %d: %r", pid); sysfatal("waitfor %d: %r", pid);
}
n1 = nsec();
if(chatty > 1){ if(chatty > 1){
fprint(2, "%5.3f", (n1-n0)/1.e9); fprint(2, "%5.3f", (n1-n0)/1.e9);
for(i=0; argv[i]; i++) for(i=0; argv[i]; i++)
...@@ -94,6 +128,30 @@ buildcc(char *cc, char *file, int show) ...@@ -94,6 +128,30 @@ buildcc(char *cc, char *file, int show)
return run(argv, show); return run(argv, show);
} }
// Run ar to add the given files to pkg.a.
void
ar(char *pkg, char **file, int nfile)
{
char **arg;
int i, n;
char sixar[20];
char pkga[1000];
arg = emalloc((4+nfile)*sizeof arg[0]);
n = 0;
snprint(sixar, sizeof sixar, "%sar", thechar);
snprint(pkga, sizeof pkga, "%s.a", pkg);
arg[n++] = sixar;
arg[n++] = "grc";
arg[n++] = pkga;
for(i=0; i<nfile; i++)
arg[n++] = file[i];
arg[n] = nil;
if(run(arg, 1) < 0)
sysfatal("ar: %r");
}
// Return bool whether s ends in suffix. // Return bool whether s ends in suffix.
int int
suffix(char *s, char *suffix) suffix(char *s, char *suffix)
...@@ -137,6 +195,50 @@ goobj(char *file, char *suffix) ...@@ -137,6 +195,50 @@ goobj(char *file, char *suffix)
return smprint("%.*s.%s", utfnlen(file, p-file), file, suffix); return smprint("%.*s.%s", utfnlen(file, p-file), file, suffix);
} }
// Figure out package of .go file.
// Maintain list of all packages seen so far.
// Returned package string is in that list,
// so caller can use pointer compares.
char*
getpkg(char *file)
{
Biobuf *b;
char *p, *q;
int i;
if(!suffix(file, ".go"))
return nil;
if((b = Bopen(file, OREAD)) == nil)
sysfatal("open %s: %r", file);
while((p = Brdline(b, '\n')) != nil) {
p[Blinelen(b)-1] = '\0';
while(*p == ' ' || *p == '\t')
p++;
if(strncmp(p, "package", 7) == 0 && (p[7] == ' ' || p[7] == '\t')) {
p+=7;
while(*p == ' ' || *p == '\t')
p++;
q = p+strlen(p);
while(q > p && (*(q-1) == ' ' || *(q-1) == '\t'))
*--q = '\0';
for(i=0; i<npkg; i++) {
if(strcmp(pkg[i], p) == 0) {
Bterm(b);
return pkg[i];
}
}
npkg++;
pkg = erealloc(pkg, npkg*sizeof pkg[0]);
pkg[i] = emalloc(strlen(p)+1);
strcpy(pkg[i], p);
Bterm(b);
return pkg[i];
}
}
Bterm(b);
return nil;
}
// Format name using $(GOOS) and $(GOARCH). // Format name using $(GOOS) and $(GOARCH).
int int
dollarfmt(Fmt *f) dollarfmt(Fmt *f)
...@@ -175,17 +277,13 @@ char preamble[] = ...@@ -175,17 +277,13 @@ char preamble[] =
"AS=$(O)a\n" "AS=$(O)a\n"
"AR=$(O)ar\n" "AR=$(O)ar\n"
"\n" "\n"
"PKG=%s.a\n" "default: packages\n"
"PKGDIR=$(GOROOT)/pkg%s\n"
"\n"
"install: $(PKG)\n"
"\tmv $(PKG) $(PKGDIR)/$(PKG)\n"
"\n"
"nuke: clean\n"
"\trm -f $(PKGDIR)/$(PKG)\n"
"\n" "\n"
"clean:\n" "clean:\n"
"\trm -f *.$O *.a $(PKG)\n" "\trm -f *.$O *.a\n"
"\n"
"test: packages\n"
"\tgotest\n"
"\n" "\n"
"%%.$O: %%.go\n" "%%.$O: %%.go\n"
"\t$(GC) $*.go\n" "\t$(GC) $*.go\n"
...@@ -199,30 +297,152 @@ char preamble[] = ...@@ -199,30 +297,152 @@ char preamble[] =
; ;
void void
main(int argc, char **argv) writemakefile(void)
{ {
int i, o, p, n, pass, nar, njob, nthis, nnext, oargc;
char **ar, **next, **this, **tmp, *goroot, *pkgname, *pkgpath, *pkgdir, **oargv, *q;
Job *job;
Biobuf bout; Biobuf bout;
vlong o;
int i, k, l, pass;
char **obj;
int nobj;
oargc = argc; // Write makefile.
oargv = argv; Binit(&bout, 1, OWRITE);
fmtinstall('$', dollarfmt); Bprint(&bout, "# DO NOT EDIT. Automatically generated by gobuild.\n");
o = Boffset(&bout);
Bprint(&bout, "#");
for(i=0; i<oargc; i++){
if(Boffset(&bout) - o > 60){
Bprint(&bout, "\\\n# ");
o = Boffset(&bout);
}
Bprint(&bout, " %s", oargv[i]);
}
Bprint(&bout, " >Makefile\n");
Bprint(&bout, preamble, thechar);
ARGBEGIN{ // O2=\
default: // os_file.$O\
usage(); // os_time.$O\
case 'm': //
makefile = 1; obj = emalloc(njob*sizeof obj[0]);
break; for(pass=0;; pass++) {
case 'v': nobj = 0;
chatty++; for(i=0; i<njob; i++)
if(job[i].pass == pass)
obj[nobj++] = goobj(job[i].name, "$O");
if(nobj == 0)
break; break;
}ARGEND Bprint(&bout, "O%d=\\\n", pass+1);
for(i=0; i<nobj; i++)
Bprint(&bout, "\t%$\\\n", obj[i]);
Bprint(&bout, "\n");
}
if(argc < 2) // math.a: a1 a2
usage(); for(i=0; i<npkg; i++) {
Bprint(&bout, "%s.a:", pkg[i]);
for(k=0; k<pass; k++)
Bprint(&bout, " a%d", k+1);
Bprint(&bout, "\n");
}
Bprint(&bout, "\n");
// a1: $(O1)
// $(AS) grc $(PKG) $(O1)
// rm -f $(O1)
for(k=0; k<pass; k++){
Bprint(&bout, "a%d:\t$(O%d)\n", k+1, k+1);
for(i=0; i<npkg; i++) {
nobj = 0;
for(l=0; l<njob; l++)
if(job[l].pass == k && job[l].pkg == pkg[i])
obj[nobj++] = goobj(job[l].name, "$O");
if(nobj > 0) {
Bprint(&bout, "\t$(AR) grc %s.a", pkg[i]);
for(l=0; l<nobj; l++)
Bprint(&bout, " %$", obj[l]);
Bprint(&bout, "\n");
}
}
Bprint(&bout, "\trm -f $(O%d)\n", k+1);
Bprint(&bout, "\n");
}
// newpkg: clean
// 6ar grc pkg.a
Bprint(&bout, "newpkg: clean\n");
for(i=0; i<npkg; i++)
Bprint(&bout, "\t$(AR) grc %s.a\n", pkg[i]);
Bprint(&bout, "\n");
// $(O1): newpkg
// $(O2): a1
Bprint(&bout, "$(O1): newpkg\n");
for(i=1; i<pass; i++)
Bprint(&bout, "$(O%d): a%d\n", i+1, i);
Bprint(&bout, "\n");
// nuke: clean
// rm -f $(GOROOT)/pkg/xxx.a
Bprint(&bout, "nuke: clean\n");
Bprint(&bout, "\trm -f");
for(i=0; i<npkg; i++)
Bprint(&bout, " $(GOROOT)/pkg/%s.a", pkg[i]);
Bprint(&bout, "\n\n");
// packages: pkg.a
// rm -f $(GOROOT)/pkg/xxx.a
Bprint(&bout, "packages:");
for(i=0; i<npkg; i++)
Bprint(&bout, " %s.a", pkg[i]);
Bprint(&bout, "\n\n");
// install: packages
// cp xxx.a $(GOROOT)/pkg/xxx.a
Bprint(&bout, "install: packages\n");
for(i=0; i<npkg; i++)
Bprint(&bout, "\tcp %s.a $(GOROOT)/pkg/%s.a\n", pkg[i], pkg[i]);
Bprint(&bout, "\n");
Bterm(&bout);
}
int
sourcefilenames(char ***argvp)
{
Dir *d;
int dir, nd, i, argc;
char **argv;
if((dir = open(".", OREAD)) < 0)
sysfatal("open .: %r");
nd = dirreadall(dir, &d);
close(dir);
argv = emalloc((nd+1)*sizeof argv[0]);
argc = 0;
for(i=0; i<nd; i++) {
if(suffix(d[i].name, ".go")
|| suffix(d[i].name, ".c")
|| suffix(d[i].name, ".s"))
argv[argc++] = d[i].name;
}
*argvp = argv;
argv[argc] = nil;
return argc;
}
void
main(int argc, char **argv)
{
int i, k, pass, npending, nfail, nsuccess, narfiles;
Job **pending, **fail, **success, *j;
char **arfiles;
oargc = argc;
oargv = argv;
fmtinstall('$', dollarfmt);
goos = getenv("GOOS"); goos = getenv("GOOS");
if(goos == nil) if(goos == nil)
...@@ -234,162 +454,117 @@ main(int argc, char **argv) ...@@ -234,162 +454,117 @@ main(int argc, char **argv)
thechar = "6"; thechar = "6";
else else
sysfatal("unknown $GOARCH"); sysfatal("unknown $GOARCH");
devnull = open("/dev/null", OWRITE);
if(devnull < 0)
sysfatal("open /dev/null: %r");
goroot = getenv("GOROOT"); goroot = getenv("GOROOT");
if(goroot == nil) if(goroot == nil)
sysfatal("no $GOROOT"); sysfatal("no $GOROOT");
pkgname = argv[0]; ARGBEGIN{
if(strchr(pkgname, '.')){ default:
fprint(2, "pkgname has dot\n");
usage(); usage();
} case 'm':
makefile = 1;
q = strrchr(pkgname, '/'); break;
if(q) { case 'v':
pkgdir = pkgname; chatty++;
*q++ = '\0'; break;
pkgname = q; }ARGEND
pkgdir = smprint("/%s", pkgdir);
} else {
pkgdir = "";
}
pkgpath = smprint("%s.a", pkgname);
unlink(pkgpath);
if(chatty)
fprint(2, "pkg %s\n", pkgpath);
if((devnull = open("/dev/null", ORDWR)) < 0)
sysfatal("open /dev/null: %r");
// Compile by repeated passes: build as many .6 as you can, // If no arguments, use all source files in current directory.
// put them all in the archive, and repeat. if(argc == 0)
// argc = sourcefilenames(&argv);
// "this" contains the list of files to compile in this pass.
// "next" contains the list of files to re-try in the next pass.
// "job" contains the list of files that are done, annotated
// with their pass numbers.
// "ar" contains the ar command line to run at the end
// of the pass.
n = argc-1;
this = malloc(n*sizeof this[0]);
next = malloc(n*sizeof next[0]);
job = malloc(n*sizeof job[0]);
ar = malloc((n+4)*sizeof job[0]);
if(this == nil || next == nil || job == 0 || ar == 0)
sysfatal("malloc: %r");
// Initial "this" is the files given on the command line.
for(i=0; i<n; i++)
this[i] = argv[i+1];
nthis = n;
ar[0] = smprint("%sar", thechar);
ar[1] = "grc";
ar[2] = pkgpath;
ar[3] = nil;
if(run(ar, 1) < 0)
sysfatal("ar: %r");
// Make the job list.
njob = 0; njob = 0;
job = emalloc(argc*sizeof job[0]);
for(i=0; i<argc; i++) {
if(strncmp(argv[i], "test", 4) == 0)
continue;
job[njob].name = argv[i];
job[njob].pass = -1;
job[njob].pkg = getpkg(argv[i]);
njob++;
}
for(pass=0; nthis > 0; pass++){ // Look for non-go files, which don't have packages.
nnext = 0; // If there's only one package in the go files, use it.
nar = 3; for(i=0; i<njob; i++) {
if(job[i].pkg == nil) {
// Try to build. if(npkg == 1) {
for(i=0; i<nthis; i++){ job[i].pkg = pkg[0];
if(buildcc(compiler(this[i]), this[i], 0) < 0){ continue;
next[nnext++] = this[i];
}else{
job[njob].pass = pass;
job[njob++].name = this[i];
ar[nar++] = goobj(this[i], thechar);
if(chatty == 1)
fprint(2, "%s ", this[i]);
} }
sysfatal("cannot determine package for %s", job[i].name);
} }
if(nthis == nnext){ // they all failed
fprint(2, "cannot make progress\n");
for(i=0; i<nthis; i++)
buildcc(compiler(this[i]), this[i], 1);
exits("stalemate");
} }
if(chatty == 1)
fprint(2, "\n");
// Add to archive.
ar[nar] = nil;
if(run(ar, 1) < 0)
sysfatal("ar: %r");
// Delete objects. // TODO: subdirectory packages
for(i=3; i<nar; i++)
unlink(ar[i]);
// Set up for next pass: next = this. // Create empty archives for each package.
tmp = next; for(i=0; i<npkg; i++) {
next = this; unlink(smprint("%s.a", pkg[i]));
this = tmp; ar(pkg[i], nil, 0);
nthis = nnext;
} }
if(makefile){ // Compile by repeated passes: build as many .6 as you can,
// Write makefile. // put them in their archives, and repeat.
Binit(&bout, 1, OWRITE); pending = emalloc(njob*sizeof pending[0]);
Bprint(&bout, "# DO NOT EDIT. Automatically generated by gobuild.\n"); for(i=0; i<njob; i++)
o = Boffset(&bout); pending[i] = &job[i];
Bprint(&bout, "#"); npending = njob;
for(i=0; i<oargc; i++){
if(Boffset(&bout) - o > 60){ fail = emalloc(njob*sizeof fail[0]);
Bprint(&bout, "\\\n# "); success = emalloc(njob*sizeof success[0]);
o = Boffset(&bout); arfiles = emalloc(njob*sizeof arfiles[0]);
for(pass=0; npending > 0; pass++) {
// Run what we can.
nfail = 0;
nsuccess = 0;
for(i=0; i<npending; i++) {
j = pending[i];
if(buildcc(compiler(j->name), j->name, 0) < 0)
fail[nfail++] = j;
else{
if(chatty == 1)
fprint(2, "%s ", j->name);
success[nsuccess++] = j;
} }
Bprint(&bout, " %s", oargv[i]);
} }
Bprint(&bout, "\n"); if(nsuccess == 0) {
Bprint(&bout, preamble, thechar, pkgname, pkgdir); // Nothing ran; give up.
for(i=0; i<nfail; i++) {
// O2=\ j = fail[i];
// os_file.$O\ buildcc(compiler(j->name), j->name, 1);
// os_time.$O\
//
p = -1;
for(i=0; i<n; i++){
if(job[i].pass != p){
p = job[i].pass;
Bprint(&bout, "\nO%d=\\\n", p+1);
} }
Bprint(&bout, "\t%$\\\n", goobj(job[i].name, "$O")); exits("stalemate");
} }
Bprint(&bout, "\n"); if(chatty == 1)
fprint(2, "\n");
// $(PKG): a1 a2
Bprint(&bout, "$(PKG):");
for(i=0; i<pass; i++)
Bprint(&bout, " a%d", i+1);
Bprint(&bout, "\n");
// a1: $(O1) // Update archives.
// $(AS) grc $(PKG) $(O1) for(i=0; i<npkg; i++) {
// rm -f $(O1) narfiles = 0;
for(i=0; i<pass; i++){ for(k=0; k<nsuccess; k++) {
Bprint(&bout, "a%d:\t$(O%d)\n", i+1, i+1); j = success[k];
Bprint(&bout, "\t$(AR) grc $(PKG) $(O%d)\n", i+1); if(j->pkg == pkg[i])
Bprint(&bout, "\trm -f $(O%d)\n", i+1); arfiles[narfiles++] = goobj(j->name, thechar);
j->pass = pass;
}
if(narfiles > 0)
ar(pkg[i], arfiles, narfiles);
for(k=0; k<narfiles; k++)
unlink(arfiles[k]);
} }
Bprint(&bout, "\n");
// $(O1): nuke for(i=0; i<nfail; i++)
// $(O2): a1 pending[i] = fail[i];
Bprint(&bout, "$(O1): nuke\n"); npending = nfail;
for(i=1; i<pass; i++)
Bprint(&bout, "$(O%d): a%d\n", i+1, i);
Bprint(&bout, "\n");
Bterm(&bout);
} }
if(makefile)
writemakefile();
exits(0); exits(0);
} }
...@@ -10,4 +10,5 @@ clean: ...@@ -10,4 +10,5 @@ clean:
@true @true
install: $(TARG) install: $(TARG)
test -f $(BIN)/$(TARG) && chmod u+w $(BIN)/$(TARG)
cp $(TARG) $(BIN)/$(TARG) cp $(TARG) $(BIN)/$(TARG)
...@@ -8,9 +8,28 @@ ...@@ -8,9 +8,28 @@
# 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.
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') ofiles=$(echo $gofiles | sed 's/\.go/.6/g')
files=$(echo $gofiles | sed 's/\.go//g') files=$(echo $gofiles | sed 's/\.go//g')
...@@ -19,8 +38,10 @@ do ...@@ -19,8 +38,10 @@ do
6g $i 6g $i
done 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 # package spec
echo 'package main' echo 'package main'
...@@ -48,4 +69,4 @@ done ...@@ -48,4 +69,4 @@ done
6g _testmain.go 6g _testmain.go
6l _testmain.6 6l _testmain.6
6.out 6.out "$@"
...@@ -3,24 +3,20 @@ ...@@ -3,24 +3,20 @@
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild. # DO NOT EDIT. Automatically generated by gobuild.
# gobuild -m fmt format.go print.go # gobuild -m >Makefile
O=6 O=6
GC=$(O)g GC=$(O)g
CC=$(O)c -w CC=$(O)c -w
AS=$(O)a AS=$(O)a
AR=$(O)ar AR=$(O)ar
PKG=fmt.a default: packages
PKGDIR=$(GOROOT)/pkg
install: $(PKG)
mv $(PKG) $(PKGDIR)/$(PKG)
nuke: clean
rm -f $(PKGDIR)/$(PKG)
clean: clean:
rm -f *.$O *.a $(PKG) rm -f *.$O *.a
test: packages
gotest
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
...@@ -31,21 +27,33 @@ clean: ...@@ -31,21 +27,33 @@ clean:
%.$O: %.s %.$O: %.s
$(AS) $*.s $(AS) $*.s
O1=\ O1=\
format.$O\ format.$O\
O2=\ O2=\
print.$O\ print.$O\
$(PKG): a1 a2 fmt.a: a1 a2
a1: $(O1) a1: $(O1)
$(AR) grc $(PKG) $(O1) $(AR) grc fmt.a format.$O
rm -f $(O1) rm -f $(O1)
a2: $(O2) a2: $(O2)
$(AR) grc $(PKG) $(O2) $(AR) grc fmt.a print.$O
rm -f $(O2) rm -f $(O2)
$(O1): nuke newpkg: clean
$(AR) grc fmt.a
$(O1): newpkg
$(O2): a1 $(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 @@ ...@@ -3,23 +3,21 @@
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild. # DO NOT EDIT. Automatically generated by gobuild.
# gobuild -m http conn.go request.go server.go url.go # gobuild -m >Makefile
O=6 O=6
GC=$(O)g GC=$(O)g
CC=$(O)c -w CC=$(O)c -w
AS=$(O)a AS=$(O)a
AR=$(O)ar AR=$(O)ar
PKG=$(GOROOT)/pkg/http.a default: packages
install: $(PKG)
nuke: clean
rm -f $(PKG)
clean: clean:
rm -f *.$O *.a rm -f *.$O *.a
test: packages
gotest
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
...@@ -29,7 +27,6 @@ clean: ...@@ -29,7 +27,6 @@ clean:
%.$O: %.s %.$O: %.s
$(AS) $*.s $(AS) $*.s
O1=\ O1=\
url.$O\ url.$O\
...@@ -42,22 +39,48 @@ O3=\ ...@@ -42,22 +39,48 @@ O3=\
O4=\ O4=\
server.$O\ 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) a1: $(O1)
$(AR) grc $(PKG) $(O1) $(AR) grc http.a url.$O
rm -f $(O1) rm -f $(O1)
a2: $(O2) a2: $(O2)
$(AR) grc $(PKG) $(O2) $(AR) grc http.a request.$O
rm -f $(O2) rm -f $(O2)
a3: $(O3) a3: $(O3)
$(AR) grc $(PKG) $(O3) $(AR) grc http.a conn.$O
rm -f $(O3) rm -f $(O3)
a4: $(O4) a4: $(O4)
$(AR) grc $(PKG) $(O4) $(AR) grc http.a server.$O
rm -f $(O4) 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 $(O2): a1
$(O3): a2 $(O3): a2
$(O4): a3 $(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 @@ ...@@ -3,26 +3,20 @@
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild. # DO NOT EDIT. Automatically generated by gobuild.
# gobuild -m math asin.go atan.go atan2.go exp.go fabs.go floor.go\ # gobuild -m >Makefile
# fmod.go hypot.go log.go pow.go pow10.go sin.go sinh.go sqrt.go\
# tan.go tanh.go
O=6 O=6
GC=$(O)g GC=$(O)g
CC=$(O)c -w CC=$(O)c -w
AS=$(O)a AS=$(O)a
AR=$(O)ar AR=$(O)ar
PKG=math.a default: packages
PKGDIR=$(GOROOT)/pkg
install: $(PKG)
mv $(PKG) $(PKGDIR)/$(PKG)
nuke: clean
rm -f $(PKGDIR)/$(PKG)
clean: clean:
rm -f *.$O *.a $(PKG) rm -f *.$O *.a
test: packages
gotest
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
...@@ -33,7 +27,6 @@ clean: ...@@ -33,7 +27,6 @@ clean:
%.$O: %.s %.$O: %.s
$(AS) $*.s $(AS) $*.s
O1=\ O1=\
atan.$O\ atan.$O\
fabs.$O\ fabs.$O\
...@@ -58,22 +51,37 @@ O3=\ ...@@ -58,22 +51,37 @@ O3=\
O4=\ O4=\
tanh.$O\ tanh.$O\
$(PKG): a1 a2 a3 a4 math.a: a1 a2 a3 a4
a1: $(O1) 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) rm -f $(O1)
a2: $(O2) a2: $(O2)
$(AR) grc $(PKG) $(O2) $(AR) grc math.a asin.$O atan2.$O exp.$O
rm -f $(O2) rm -f $(O2)
a3: $(O3) a3: $(O3)
$(AR) grc $(PKG) $(O3) $(AR) grc math.a pow.$O sinh.$O
rm -f $(O3) rm -f $(O3)
a4: $(O4) a4: $(O4)
$(AR) grc $(PKG) $(O4) $(AR) grc math.a tanh.$O
rm -f $(O4) rm -f $(O4)
$(O1): nuke newpkg: clean
$(AR) grc math.a
$(O1): newpkg
$(O2): a1 $(O2): a1
$(O3): a2 $(O3): a2
$(O4): a3 $(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 @@ ...@@ -3,23 +3,21 @@
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild. # 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 O=6
GC=$(O)g GC=$(O)g
CC=$(O)c -w CC=$(O)c -w
AS=$(O)a AS=$(O)a
AR=$(O)ar AR=$(O)ar
PKG=$(GOROOT)/pkg/net.a default: packages
install: $(PKG)
nuke: clean
rm -f $(PKG)
clean: clean:
rm -f *.$O *.a rm -f *.$O *.a
test: packages
gotest
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
...@@ -29,7 +27,6 @@ clean: ...@@ -29,7 +27,6 @@ clean:
%.$O: %.s %.$O: %.s
$(AS) $*.s $(AS) $*.s
O1=\ O1=\
ip.$O\ ip.$O\
...@@ -43,22 +40,37 @@ O3=\ ...@@ -43,22 +40,37 @@ O3=\
O4=\ O4=\
net.$O\ net.$O\
$(PKG): a1 a2 a3 a4 net.a: a1 a2 a3 a4
a1: $(O1) a1: $(O1)
$(AR) grc $(PKG) $(O1) $(AR) grc net.a ip.$O
rm -f $(O1) rm -f $(O1)
a2: $(O2) a2: $(O2)
$(AR) grc $(PKG) $(O2) $(AR) grc net.a fd_$(GOOS).$O net_$(GOOS).$O
rm -f $(O2) rm -f $(O2)
a3: $(O3) a3: $(O3)
$(AR) grc $(PKG) $(O3) $(AR) grc net.a fd.$O
rm -f $(O3) rm -f $(O3)
a4: $(O4) a4: $(O4)
$(AR) grc $(PKG) $(O4) $(AR) grc net.a net.$O
rm -f $(O4) rm -f $(O4)
$(O1): nuke newpkg: clean
$(AR) grc net.a
$(O1): newpkg
$(O2): a1 $(O2): a1
$(O3): a2 $(O3): a2
$(O4): a3 $(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 @@ ...@@ -3,23 +3,21 @@
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild. # 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 O=6
GC=$(O)g GC=$(O)g
CC=$(O)c -w CC=$(O)c -w
AS=$(O)a AS=$(O)a
AR=$(O)ar AR=$(O)ar
PKG=$(GOROOT)/pkg/os.a default: packages
install: $(PKG)
nuke: clean
rm -f $(PKG)
clean: clean:
rm -f *.$O *.a rm -f *.$O *.a
test: packages
gotest
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
...@@ -29,21 +27,35 @@ clean: ...@@ -29,21 +27,35 @@ clean:
%.$O: %.s %.$O: %.s
$(AS) $*.s $(AS) $*.s
O1=\ O1=\
os_error.$O\ os_error.$O\
O2=\ O2=\
os_env.$O\
os_file.$O\ os_file.$O\
os_time.$O\ os_time.$O\
os_env.$O\
$(PKG): a1 a2 os.a: a1 a2
a1: $(O1) a1: $(O1)
$(AR) grc $(PKG) $(O1) $(AR) grc os.a os_error.$O
rm -f $(O1)
a2: $(O2) 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 $(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 @@ ...@@ -3,24 +3,21 @@
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild. # DO NOT EDIT. Automatically generated by gobuild.
# gobuild -m reflect tostring.go type.go value.go cast_amd64.s\ # gobuild -m >Makefile
# typestring.c
O=6 O=6
GC=$(O)g GC=$(O)g
CC=$(O)c -w CC=$(O)c -w
AS=$(O)a AS=$(O)a
AR=$(O)ar AR=$(O)ar
PKG=$(GOROOT)/pkg/reflect.a default: packages
install: $(PKG)
nuke: clean
rm -f $(PKG)
clean: clean:
rm -f *.$O *.a rm -f *.$O *.a
test: packages
gotest
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
...@@ -30,10 +27,9 @@ clean: ...@@ -30,10 +27,9 @@ clean:
%.$O: %.s %.$O: %.s
$(AS) $*.s $(AS) $*.s
O1=\ O1=\
cast_$(GOARCH).$O\
type.$O\ type.$O\
cast_amd64.$O\
typestring.$O\ typestring.$O\
O2=\ O2=\
...@@ -42,15 +38,32 @@ O2=\ ...@@ -42,15 +38,32 @@ O2=\
O3=\ O3=\
tostring.$O\ tostring.$O\
$(PKG): a1 a2 a3 reflect.a: a1 a2 a3
a1: $(O1) a1: $(O1)
$(AR) grc $(PKG) $(O1) $(AR) grc reflect.a cast_$(GOARCH).$O type.$O typestring.$O
rm -f $(O1)
a2: $(O2) a2: $(O2)
$(AR) grc $(PKG) $(O2) $(AR) grc reflect.a value.$O
rm -f $(O2)
a3: $(O3) 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 $(O2): a1
$(O3): a2 $(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 @@ ...@@ -3,23 +3,21 @@
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild. # 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 O=6
GC=$(O)g GC=$(O)g
CC=$(O)c -w CC=$(O)c -w
AS=$(O)a AS=$(O)a
AR=$(O)ar AR=$(O)ar
PKG=$(GOROOT)/pkg/strconv.a default: packages
install: $(PKG)
nuke: clean
rm -f $(PKG)
clean: clean:
rm -f *.$O *.a rm -f *.$O *.a
test: packages
gotest
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
...@@ -29,11 +27,10 @@ clean: ...@@ -29,11 +27,10 @@ clean:
%.$O: %.s %.$O: %.s
$(AS) $*.s $(AS) $*.s
O1=\ O1=\
atoi.$O\ atoi.$O\
decimal.$O\
itoa.$O\ itoa.$O\
decimal.$O\
O2=\ O2=\
ftoa.$O\ ftoa.$O\
...@@ -41,18 +38,32 @@ O2=\ ...@@ -41,18 +38,32 @@ O2=\
O3=\ O3=\
atof.$O\ atof.$O\
$(PKG): a1 a2 a3 strconv.a: a1 a2 a3
a1: $(O1) a1: $(O1)
$(AR) grc $(PKG) $(O1) $(AR) grc strconv.a atoi.$O itoa.$O decimal.$O
rm -f $(O1) rm -f $(O1)
a2: $(O2) a2: $(O2)
$(AR) grc $(PKG) $(O2) $(AR) grc strconv.a ftoa.$O
rm -f $(O2) rm -f $(O2)
a3: $(O3) a3: $(O3)
$(AR) grc $(PKG) $(O3) $(AR) grc strconv.a atof.$O
rm -f $(O3) rm -f $(O3)
$(O1): nuke newpkg: clean
$(AR) grc strconv.a
$(O1): newpkg
$(O2): a1 $(O2): a1
$(O3): a2 $(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 @@ ...@@ -3,25 +3,23 @@
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
# DO NOT EDIT. Automatically generated by gobuild. # 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\ # 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 O=6
GC=$(O)g GC=$(O)g
CC=$(O)c -w CC=$(O)c -w
AS=$(O)a AS=$(O)a
AR=$(O)ar AR=$(O)ar
PKG=$(GOROOT)/pkg/syscall.a default: packages
install: $(PKG)
nuke: clean
rm -f $(PKG)
clean: clean:
rm -f *.$O *.a rm -f *.$O *.a
test: packages
gotest
%.$O: %.go %.$O: %.go
$(GC) $*.go $(GC) $*.go
...@@ -31,7 +29,6 @@ clean: ...@@ -31,7 +29,6 @@ clean:
%.$O: %.s %.$O: %.s
$(AS) $*.s $(AS) $*.s
O1=\ O1=\
errstr_$(GOOS).$O\ errstr_$(GOOS).$O\
syscall_$(GOARCH)_$(GOOS).$O\ syscall_$(GOARCH)_$(GOOS).$O\
...@@ -45,14 +42,27 @@ O2=\ ...@@ -45,14 +42,27 @@ O2=\
socket_$(GOOS).$O\ socket_$(GOOS).$O\
time_$(GOARCH)_$(GOOS).$O\ time_$(GOARCH)_$(GOOS).$O\
$(PKG): a1 a2 syscall.a: a1 a2
a1: $(O1) 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) rm -f $(O1)
a2: $(O2) a2: $(O2)
$(AR) grc $(PKG) $(O2) $(AR) grc syscall.a file_$(GOOS).$O socket_$(GOOS).$O time_$(GOARCH)_$(GOOS).$O
rm -f $(O2) rm -f $(O2)
$(O1): nuke newpkg: clean
$(AR) grc syscall.a
$(O1): newpkg
$(O2): a1 $(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