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 @@
void
usage(void)
{
fprint(2, "usage: gobuild [-m] packagename *.go *.c *.s\n");
fprint(2, "usage: gobuild [-m] [packagename...]\n");
exits("usage");
}
......@@ -22,14 +22,47 @@ int makefile; // generate Makefile
char *thechar; // object character
char *goos;
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.
typedef struct Job Job;
struct Job
{
char *name;
char *pkg;
int pass;
};
Job *job;
int njob;
char **pkg;
int npkg;
// Run the command in argv.
// Return -1 if it fails (non-zero exit status).
......@@ -42,6 +75,7 @@ run(char **argv, int showoutput)
int pid, i;
Waitmsg *w;
vlong n0, n1;
char buf[100];
n0 = nsec();
pid = fork();
......@@ -49,22 +83,22 @@ run(char **argv, int showoutput)
sysfatal("fork: %r");
if(pid == 0){
dup(devnull, 0);
if(!showoutput){
dup(devnull, 1);
if(!showoutput)
dup(devnull, 2);
}else{
dup(2, 1);
}
if(devnull > 2)
close(devnull);
exec(argv[0], argv);
fprint(2, "exec %s: %r\n", argv[0]);
exit(1);
}
w = waitfor(pid);
n1 = nsec();
if(w == nil)
while((w = waitfor(pid)) == nil) {
rerrstr(buf, sizeof buf);
if(strstr(buf, "interrupt"))
continue;
sysfatal("waitfor %d: %r", pid);
}
n1 = nsec();
if(chatty > 1){
fprint(2, "%5.3f", (n1-n0)/1.e9);
for(i=0; argv[i]; i++)
......@@ -94,6 +128,30 @@ buildcc(char *cc, char *file, int 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.
int
suffix(char *s, char *suffix)
......@@ -137,6 +195,50 @@ goobj(char *file, char *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).
int
dollarfmt(Fmt *f)
......@@ -175,17 +277,13 @@ char preamble[] =
"AS=$(O)a\n"
"AR=$(O)ar\n"
"\n"
"PKG=%s.a\n"
"PKGDIR=$(GOROOT)/pkg%s\n"
"\n"
"install: $(PKG)\n"
"\tmv $(PKG) $(PKGDIR)/$(PKG)\n"
"\n"
"nuke: clean\n"
"\trm -f $(PKGDIR)/$(PKG)\n"
"default: packages\n"
"\n"
"clean:\n"
"\trm -f *.$O *.a $(PKG)\n"
"\trm -f *.$O *.a\n"
"\n"
"test: packages\n"
"\tgotest\n"
"\n"
"%%.$O: %%.go\n"
"\t$(GC) $*.go\n"
......@@ -199,30 +297,152 @@ char preamble[] =
;
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;
vlong o;
int i, k, l, pass;
char **obj;
int nobj;
oargc = argc;
oargv = argv;
fmtinstall('$', dollarfmt);
// Write makefile.
Binit(&bout, 1, OWRITE);
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{
default:
usage();
case 'm':
makefile = 1;
break;
case 'v':
chatty++;
// O2=\
// os_file.$O\
// os_time.$O\
//
obj = emalloc(njob*sizeof obj[0]);
for(pass=0;; pass++) {
nobj = 0;
for(i=0; i<njob; i++)
if(job[i].pass == pass)
obj[nobj++] = goobj(job[i].name, "$O");
if(nobj == 0)
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)
usage();
// math.a: a1 a2
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");
if(goos == nil)
......@@ -234,162 +454,117 @@ main(int argc, char **argv)
thechar = "6";
else
sysfatal("unknown $GOARCH");
devnull = open("/dev/null", OWRITE);
if(devnull < 0)
sysfatal("open /dev/null: %r");
goroot = getenv("GOROOT");
if(goroot == nil)
sysfatal("no $GOROOT");
pkgname = argv[0];
if(strchr(pkgname, '.')){
fprint(2, "pkgname has dot\n");
ARGBEGIN{
default:
usage();
}
q = strrchr(pkgname, '/');
if(q) {
pkgdir = pkgname;
*q++ = '\0';
pkgname = q;
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");
case 'm':
makefile = 1;
break;
case 'v':
chatty++;
break;
}ARGEND
// Compile by repeated passes: build as many .6 as you can,
// put them all in the archive, and repeat.
//
// "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");
// If no arguments, use all source files in current directory.
if(argc == 0)
argc = sourcefilenames(&argv);
// Make the job list.
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++){
nnext = 0;
nar = 3;
// Try to build.
for(i=0; i<nthis; i++){
if(buildcc(compiler(this[i]), this[i], 0) < 0){
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]);
// Look for non-go files, which don't have packages.
// If there's only one package in the go files, use it.
for(i=0; i<njob; i++) {
if(job[i].pkg == nil) {
if(npkg == 1) {
job[i].pkg = pkg[0];
continue;
}
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.
for(i=3; i<nar; i++)
unlink(ar[i]);
// TODO: subdirectory packages
// Set up for next pass: next = this.
tmp = next;
next = this;
this = tmp;
nthis = nnext;
// Create empty archives for each package.
for(i=0; i<npkg; i++) {
unlink(smprint("%s.a", pkg[i]));
ar(pkg[i], nil, 0);
}
if(makefile){
// Write makefile.
Binit(&bout, 1, OWRITE);
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);
// Compile by repeated passes: build as many .6 as you can,
// put them in their archives, and repeat.
pending = emalloc(njob*sizeof pending[0]);
for(i=0; i<njob; i++)
pending[i] = &job[i];
npending = njob;
fail = emalloc(njob*sizeof fail[0]);
success = emalloc(njob*sizeof success[0]);
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");
Bprint(&bout, preamble, thechar, pkgname, pkgdir);
// O2=\
// os_file.$O\
// 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);
if(nsuccess == 0) {
// Nothing ran; give up.
for(i=0; i<nfail; i++) {
j = fail[i];
buildcc(compiler(j->name), j->name, 1);
}
Bprint(&bout, "\t%$\\\n", goobj(job[i].name, "$O"));
exits("stalemate");
}
Bprint(&bout, "\n");
// $(PKG): a1 a2
Bprint(&bout, "$(PKG):");
for(i=0; i<pass; i++)
Bprint(&bout, " a%d", i+1);
Bprint(&bout, "\n");
if(chatty == 1)
fprint(2, "\n");
// a1: $(O1)
// $(AS) grc $(PKG) $(O1)
// rm -f $(O1)
for(i=0; i<pass; i++){
Bprint(&bout, "a%d:\t$(O%d)\n", i+1, i+1);
Bprint(&bout, "\t$(AR) grc $(PKG) $(O%d)\n", i+1);
Bprint(&bout, "\trm -f $(O%d)\n", i+1);
// Update archives.
for(i=0; i<npkg; i++) {
narfiles = 0;
for(k=0; k<nsuccess; k++) {
j = success[k];
if(j->pkg == pkg[i])
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
// $(O2): a1
Bprint(&bout, "$(O1): nuke\n");
for(i=1; i<pass; i++)
Bprint(&bout, "$(O%d): a%d\n", i+1, i);
Bprint(&bout, "\n");
Bterm(&bout);
for(i=0; i<nfail; i++)
pending[i] = fail[i];
npending = nfail;
}
if(makefile)
writemakefile();
exits(0);
}
......@@ -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