diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/clean.bash | 17 | ||||
-rw-r--r-- | src/cmd/gobuild/Makefile | 20 | ||||
-rw-r--r-- | src/cmd/gobuild/gobuild.c | 340 | ||||
-rwxr-xr-x | src/lib/clean.bash | 2 | ||||
-rwxr-xr-x | src/lib/make.bash | 2 | ||||
-rw-r--r-- | src/lib/math/Makefile | 83 | ||||
-rw-r--r-- | src/lib/math/clean.bash | 7 | ||||
-rw-r--r-- | src/lib/math/main.go | 207 | ||||
-rw-r--r-- | src/lib/math/make.bash | 11 | ||||
-rw-r--r-- | src/lib/math/math.go | 48 | ||||
-rw-r--r-- | src/lib/os/Makefile | 46 | ||||
-rw-r--r-- | src/libbio/Makefile | 2 | ||||
-rw-r--r-- | src/libmach_amd64/Makefile | 6 | ||||
-rwxr-xr-x | src/make.bash | 31 | ||||
-rw-r--r-- | src/runtime/clean.bash | 11 | ||||
-rw-r--r-- | src/runtime/make.bash | 9 |
16 files changed, 465 insertions, 377 deletions
diff --git a/src/clean.bash b/src/clean.bash index cba2129cf..36b0c99fb 100755 --- a/src/clean.bash +++ b/src/clean.bash @@ -3,16 +3,15 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -for i in lib9 libbio libmach_amd64 libregexp syscall +for i in lib9 libbio libmach_amd64 libregexp syscall cmd runtime lib do cd $i - make clean - cd .. -done - -for i in cmd runtime lib -do - cd $i - bash clean.bash + case $i in + cmd | lib) + bash clean.bash + ;; + *) + make clean + esac cd .. done diff --git a/src/cmd/gobuild/Makefile b/src/cmd/gobuild/Makefile new file mode 100644 index 000000000..339399033 --- /dev/null +++ b/src/cmd/gobuild/Makefile @@ -0,0 +1,20 @@ +# 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. + +include ../../Make.conf + +TARG=gobuild +OFILES=\ + gobuild.$O\ + +$(TARG): $(OFILES) + $(LD) -o $(TARG) -L$(GOROOT)/lib $(OFILES) -lbio -l9 + +clean: + rm -f $(OFILES) $(TARG) + +install: $(TARG) + cp $(TARG) $(BIN)/$(TARG) + +$(OFILES): $(HFILES) diff --git a/src/cmd/gobuild/gobuild.c b/src/cmd/gobuild/gobuild.c new file mode 100644 index 000000000..0fdf68e19 --- /dev/null +++ b/src/cmd/gobuild/gobuild.c @@ -0,0 +1,340 @@ +// 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. + +// Build a collection of go programs into a single package. + +#include <u.h> +#include <unistd.h> +#include <libc.h> +#include <bio.h> + +void +usage(void) +{ + fprint(2, "usage: gobuild [-m] packagename *.go *.c *.s\n"); + exits("usage"); +} + +int chatty; +int devnull; // fd of /dev/null +int makefile; // generate Makefile +char *thechar; // object character + +// Info about when to compile a particular file. +typedef struct Job Job; +struct Job +{ + char *name; + int pass; +}; + +// Run the command in argv. +// Return -1 if it fails (non-zero exit status). +// Return 0 on success. +// Showoutput controls whether to let output from command display +// on standard output and standard error. +int +run(char **argv, int showoutput) +{ + int pid, i; + Waitmsg *w; + vlong n0, n1; + + n0 = nsec(); + pid = fork(); + if(pid < 0) + sysfatal("fork: %r"); + if(pid == 0){ + dup(devnull, 0); + if(!showoutput){ + dup(devnull, 1); + dup(devnull, 2); + } + 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) + sysfatal("waitfor %d: %r", pid); + if(chatty > 1){ + fprint(2, "%5.3f", (n1-n0)/1.e9); + for(i=0; argv[i]; i++) + fprint(2, " %s", argv[i]); + if(w->msg[0]) + fprint(2, " [%s]", w->msg); + fprint(2, "\n"); + } + if(w->msg[0]) + return -1; + return 0; +} + +// Build the file using the compiler cc. +// Return -1 on error, 0 on success. +// If show is set, print the command and the output. +int +buildcc(char *cc, char *file, int show) +{ + char *argv[3]; + + if(show) + fprint(2, "$ %s %s\n", cc, file); + argv[0] = cc; + argv[1] = file; + argv[2] = nil; + return run(argv, show); +} + +// Return bool whether s ends in suffix. +int +suffix(char *s, char *suffix) +{ + int n1, n2; + + n1 = strlen(s); + n2 = strlen(suffix); + if(n1>n2 && strcmp(s+n1-n2, suffix) == 0) + return 1; + return 0; +} + +// Return the name of the compiler for file. +char* +compiler(char *file) +{ + static char buf[20]; + + if(suffix(file, ".go")) + snprint(buf, sizeof buf, "%sg", thechar); + else if(suffix(file, ".c")) + snprint(buf, sizeof buf, "%sc", thechar); + else if(suffix(file, ".s")) + snprint(buf, sizeof buf, "%sa", thechar); + else + sysfatal("don't know how to build %s", file); + return buf; +} + +// Return the object name for file, replacing the +// .c or .g or .a with .suffix. +char* +goobj(char *file, char *suffix) +{ + char *p; + + p = strrchr(file, '.'); + if(p == nil) + sysfatal("don't know object name for %s", file); + return smprint("%.*s.%s", utfnlen(file, p-file), file, suffix); +} + +// Makefile preamble template. +char preamble[] = + "O=%s\n" + "GC=$(O)g\n" + "CC=$(O)c -w\n" + "AS=$(O)a\n" + "AR=$(O)ar\n" + "\n" + "PKG=$(GOROOT)/pkg/%s.a\n" + "\n" + "install: $(PKG)\n" + "\n" + "nuke: clean\n" + "\trm -f $(PKG)\n" + "\n" + "clean:\n" + "\trm -f *.$O *.a\n" + "\n" + "%%.$O: %%.go\n" + "\t$(GC) $*.go\n" + "\n" + "%%.$O: %%.c\n" + "\t$(CC) $*.c\n" + "\n" + "%%.$O: %%.s\n" + "\t$(AS) $*.s\n" + "\n" +; + +void +main(int argc, char **argv) +{ + int i, o, p, n, pass, nar, njob, nthis, nnext, oargc; + char **ar, **next, **this, **tmp, *goarch, *goroot, *pkgname, *pkgpath, **oargv; + Job *job; + Biobuf bout; + + oargc = argc; + oargv = argv; + + ARGBEGIN{ + default: + usage(); + case 'm': + makefile = 1; + break; + case 'v': + chatty++; + break; + }ARGEND + + if(argc < 2) + usage(); + + goarch = getenv("GOARCH"); + if(goarch == nil) + sysfatal("no $GOARCH"); + if(strcmp(goarch, "amd64") == 0) + thechar = "6"; + else + sysfatal("unknown $GOARCH"); + + goroot = getenv("GOROOT"); + if(goroot == nil) + sysfatal("no $GOROOT"); + + pkgname = argv[0]; + if(strchr(pkgname, '.')){ + fprint(2, "pkgname has dot\n"); + usage(); + } + + pkgpath = smprint("%s/pkg/%s.a", goroot, 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, + // 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; + + njob = 0; + + 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]); + } + } + 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]); + + // Set up for next pass: next = this. + tmp = next; + next = this; + this = tmp; + nthis = nnext; + } + + 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); + } + Bprint(&bout, " %s", oargv[i]); + } + Bprint(&bout, "\n"); + Bprint(&bout, preamble, thechar, pkgname); + + // 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); + } + Bprint(&bout, "\t%s\\\n", goobj(job[i].name, "$O")); + } + Bprint(&bout, "\n"); + + // $(PKG): a1 a2 + Bprint(&bout, "$(PKG):"); + for(i=0; i<pass; i++) + Bprint(&bout, " a%d", i+1); + Bprint(&bout, "\n"); + + // a1: $(O1) + // $(AS) grc $(PKG) $(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, "\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); + } + + exits(0); +} diff --git a/src/lib/clean.bash b/src/lib/clean.bash index 0f63401c8..3ae43f4a2 100755 --- a/src/lib/clean.bash +++ b/src/lib/clean.bash @@ -6,7 +6,7 @@ rm -f $GOROOT/pkg/* -for i in os math +for i in os math net time do cd $i make nuke diff --git a/src/lib/make.bash b/src/lib/make.bash index 5714954fa..6277c93f8 100755 --- a/src/lib/make.bash +++ b/src/lib/make.bash @@ -6,8 +6,6 @@ set -e -echo; echo; echo %%%% making lib %%%%; echo - for i in os math do echo; echo; echo %%%% making lib/$i %%%%; echo diff --git a/src/lib/math/Makefile b/src/lib/math/Makefile index f66cc4161..c792a8eb1 100644 --- a/src/lib/math/Makefile +++ b/src/lib/math/Makefile @@ -2,51 +2,72 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -CFLAGS= +# 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 O=6 -CC=$(O)c -AS=$(O)a GC=$(O)g +CC=$(O)c -w +AS=$(O)a +AR=$(O)ar -# TODO(r): building directly in the target makes internal dependencies self-consistent. -# need to address this a better way. PKG=$(GOROOT)/pkg/math.a -O1=\ - atan.$O fabs.$O floor.$O fmod.$O hypot.$O log.$O pow10.$O sin.$O sqrt.$O tan.$O -O2=\ - asin.$O atan2.$O exp.$O -O3=\ - pow.$O sinh.$O -O4=\ - tanh.$O - install: $(PKG) -$(PKG): a1 a2 a3 a4 +nuke: clean + rm -f $(PKG) + +clean: + rm -f *.$O *.a + +%.$O: %.go + $(GC) $*.go -a1: $(O1) - $(O)ar grc $(PKG) $(O1) +%.$O: %.c + $(CC) $*.c -a2: $(O2) - $(O)ar grc $(PKG) $(O2) +%.$O: %.s + $(AS) $*.s -a3: $(O3) - $(O)ar grc $(PKG) $(O3) -a4: $(O4) - $(O)ar grc $(PKG) $(O4) +O1=\ + atan.$O\ + fabs.$O\ + floor.$O\ + fmod.$O\ + hypot.$O\ + log.$O\ + pow10.$O\ + sin.$O\ + sqrt.$O\ + tan.$O\ + +O2=\ + asin.$O\ + atan2.$O\ + exp.$O\ + +O3=\ + pow.$O\ + sinh.$O\ + +O4=\ + tanh.$O\ + +$(PKG): a1 a2 a3 a4 +a1: $(O1) + $(AR) grc $(PKG) $(O1) +a2: $(O2) + $(AR) grc $(PKG) $(O2) +a3: $(O3) + $(AR) grc $(PKG) $(O3) +a4: $(O4) + $(AR) grc $(PKG) $(O4) $(O1): nuke $(O2): a1 $(O3): a2 $(O4): a3 -nuke: - rm -f *.$(O) *.a $(PKG) - -clean: - rm -f *.$(O) *.a - -%.$O: %.go - $(GC) $< diff --git a/src/lib/math/clean.bash b/src/lib/math/clean.bash deleted file mode 100644 index 9028ac2a3..000000000 --- a/src/lib/math/clean.bash +++ /dev/null @@ -1,7 +0,0 @@ -# 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. - -#!/bin/bash - -make nuke diff --git a/src/lib/math/main.go b/src/lib/math/main.go deleted file mode 100644 index bc27e4e5d..000000000 --- a/src/lib/math/main.go +++ /dev/null @@ -1,207 +0,0 @@ -// 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. - - -package main - -import math "math" - -const length = 10; - -var -( - vf [length]float64; - asin [length]float64; - atan [length]float64; - exp [length]float64; - floor [length]float64; - log [length]float64; - pow [length]float64; - sin [length]float64; - sinh [length]float64; - sqrt [length]float64; - tan [length]float64; - tanh [length]float64; -) - -func ck(a,b float64); - -func -main() -{ - for i:=0; i<length; i=i+1 { - f := vf[i]; - - ck(asin[i], math.asin(f/10)); - ck(atan[i], math.atan(f)); - ck(exp[i], math.exp(f)); - ck(floor[i], math.floor(f)); - ck(log[i], math.log(math.fabs(f))); - ck(pow[i], math.pow(10, f)); - ck(sin[i], math.sin(f)); - ck(sinh[i], math.sinh(f)); - ck(sqrt[i], math.sqrt(math.fabs(f))); - ck(tan[i], math.tan(f)); - ck(tanh[i], math.tanh(f)); - ck(math.fabs(tanh[i]*math.sqrt(2)), - math.hypot(tanh[i], tanh[i])); - } -} - -func -ck(a,b float64) -{ - d := a-b; - if d < 0 { - d = -d; - } - - e := 1e-14; - if a != 0 { - e = e*a; - if e < 0 { - e = -e; - } - } - - if d > e { - panic a, " ", b, "\n"; - } -} - -func -init() -{ - vf[0] = 4.9790119248836735e+00; - vf[1] = 7.7388724745781045e+00; - vf[2] = -2.7688005719200159e-01; - vf[3] = -5.0106036182710749e+00; - vf[4] = 9.6362937071984173e+00; - vf[5] = 2.9263772392439646e+00; - vf[6] = 5.2290834314593066e+00; - vf[7] = 2.7279399104360102e+00; - vf[8] = 1.8253080916808550e+00; - vf[9] = -8.6859247685756013e+00; - - asin[0] = 5.2117697218417440e-01; - asin[1] = 8.8495619865825236e-01; - asin[2] = -2.7691544662819413e-02; - asin[3] = -5.2482360935268932e-01; - asin[4] = 1.3002662421166553e+00; - asin[5] = 2.9698415875871901e-01; - asin[6] = 5.5025938468083364e-01; - asin[7] = 2.7629597861677200e-01; - asin[8] = 1.8355989225745148e-01; - asin[9] = -1.0523547536021498e+00; - - atan[0] = 1.3725902621296217e+00; - atan[1] = 1.4422906096452980e+00; - atan[2] = -2.7011324359471755e-01; - atan[3] = -1.3738077684543379e+00; - atan[4] = 1.4673921193587666e+00; - atan[5] = 1.2415173565870167e+00; - atan[6] = 1.3818396865615167e+00; - atan[7] = 1.2194305844639670e+00; - atan[8] = 1.0696031952318783e+00; - atan[9] = -1.4561721938838085e+00; - - exp[0] = 1.4533071302642137e+02; - exp[1] = 2.2958822575694450e+03; - exp[2] = 7.5814542574851664e-01; - exp[3] = 6.6668778421791010e-03; - exp[4] = 1.5310493273896035e+04; - exp[5] = 1.8659907517999329e+01; - exp[6] = 1.8662167355098713e+02; - exp[7] = 1.5301332413189379e+01; - exp[8] = 6.2047063430646876e+00; - exp[9] = 1.6894712385826522e-04; - - floor[0] = 4.0000000000000000e+00; - floor[1] = 7.0000000000000000e+00; - floor[2] = -1.0000000000000000e+00; - floor[3] = -6.0000000000000000e+00; - floor[4] = 9.0000000000000000e+00; - floor[5] = 2.0000000000000000e+00; - floor[6] = 5.0000000000000000e+00; - floor[7] = 2.0000000000000000e+00; - floor[8] = 1.0000000000000000e+00; - floor[9] = -9.0000000000000000e+00; - - log[0] = 1.6052314626930630e+00; - log[1] = 2.0462560018708768e+00; - log[2] = -1.2841708730962657e+00; - log[3] = 1.6115563905281544e+00; - log[4] = 2.2655365644872018e+00; - log[5] = 1.0737652208918380e+00; - log[6] = 1.6542360106073545e+00; - log[7] = 1.0035467127723465e+00; - log[8] = 6.0174879014578053e-01; - log[9] = 2.1617038728473527e+00; - - pow[0] = 9.5282232631648415e+04; - pow[1] = 5.4811599352999900e+07; - pow[2] = 5.2859121715894400e-01; - pow[3] = 9.7587991957286472e-06; - pow[4] = 4.3280643293460450e+09; - pow[5] = 8.4406761805034551e+02; - pow[6] = 1.6946633276191194e+05; - pow[7] = 5.3449040147551940e+02; - pow[8] = 6.6881821384514159e+01; - pow[9] = 2.0609869004248744e-09; - - sin[0] = -9.6466616586009283e-01; - sin[1] = 9.9338225271646543e-01; - sin[2] = -2.7335587039794395e-01; - sin[3] = 9.5586257685042800e-01; - sin[4] = -2.0994210667799692e-01; - sin[5] = 2.1355787807998605e-01; - sin[6] = -8.6945689711673619e-01; - sin[7] = 4.0195666811555783e-01; - sin[8] = 9.6778633541688000e-01; - sin[9] = -6.7344058690503452e-01; - - sinh[0] = 7.2661916084208533e+01; - sinh[1] = 1.1479409110035194e+03; - sinh[2] = -2.8043136512812520e-01; - sinh[3] = -7.4994290911815868e+01; - sinh[4] = 7.6552466042906761e+03; - sinh[5] = 9.3031583421672010e+00; - sinh[6] = 9.3308157558281088e+01; - sinh[7] = 7.6179893137269143e+00; - sinh[8] = 3.0217691805496156e+00; - sinh[9] = -2.9595057572444951e+03; - - sqrt[0] = 2.2313699659365484e+00; - sqrt[1] = 2.7818829009464263e+00; - sqrt[2] = 5.2619393496314792e-01; - sqrt[3] = 2.2384377628763938e+00; - sqrt[4] = 3.1042380236055380e+00; - sqrt[5] = 1.7106657298385224e+00; - sqrt[6] = 2.2867189227054791e+00; - sqrt[7] = 1.6516476350711160e+00; - sqrt[8] = 1.3510396336454586e+00; - sqrt[9] = 2.9471892997524950e+00; - - tan[0] = -3.6613165650402277e+00; - tan[1] = 8.6490023264859754e+00; - tan[2] = -2.8417941955033615e-01; - tan[3] = 3.2532901859747287e+00; - tan[4] = 2.1472756403802937e-01; - tan[5] = -2.1860091071106700e-01; - tan[6] = -1.7600028178723679e+00; - tan[7] = -4.3898089147528178e-01; - tan[8] = -3.8438855602011305e+00; - tan[9] = 9.1098879337768517e-01; - - tanh[0] = 9.9990531206936328e-01; - tanh[1] = 9.9999962057085307e-01; - tanh[2] = -2.7001505097318680e-01; - tanh[3] = -9.9991110943061700e-01; - tanh[4] = 9.9999999146798441e-01; - tanh[5] = 9.9427249436125233e-01; - tanh[6] = 9.9994257600983156e-01; - tanh[7] = 9.9149409509772863e-01; - tanh[8] = 9.4936501296239700e-01; - tanh[9] = -9.9999994291374019e-01; -} diff --git a/src/lib/math/make.bash b/src/lib/math/make.bash deleted file mode 100644 index 66062b3fa..000000000 --- a/src/lib/math/make.bash +++ /dev/null @@ -1,11 +0,0 @@ -# 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. - -#!/bin/bash - -set -e - -make install - -# old way: bash g1 && cp math.a $GOROOT/pkg/math.a diff --git a/src/lib/math/math.go b/src/lib/math/math.go deleted file mode 100644 index 9e6be9527..000000000 --- a/src/lib/math/math.go +++ /dev/null @@ -1,48 +0,0 @@ -// 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. - -package math - -import -( - math "asin" - math "atan" - math "atan2" - math "exp" - math "fabs" - math "floor" - math "fmod" - math "hypot" - math "log" - math "pow" - math "pow10" - math "sin" - math "sinh" - math "sqrt" - math "sys" - math "tan" - math "tanh" -) - -export -( - asin, acos - atan - atan2 - exp - fabs - floor, ceil - fmod - hypot - log, log10 - pow - pow10 - sin, cos - sinh, cosh - sqrt - modf, frexp, ldexp - NaN, isInf, Inf - tan - tanh -) diff --git a/src/lib/os/Makefile b/src/lib/os/Makefile index 130f62c86..e0ad76988 100644 --- a/src/lib/os/Makefile +++ b/src/lib/os/Makefile @@ -2,35 +2,47 @@ # Use of this source code is governed by a BSD-style # 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 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) + +clean: + rm -f *.$O *.a + +%.$O: %.go + $(GC) $*.go + +%.$O: %.c + $(CC) $*.c + +%.$O: %.s + $(AS) $*.s + + O1=\ - os_error.$O + os_error.$O\ + O2=\ os_file.$O\ os_time.$O\ -install: nuke $(PKG) - $(PKG): a1 a2 - -a1: $(O1) - $(O)ar grc $(PKG) $(O1) - -a2: $(O2) - $(O)ar grc $(PKG) $(O2) +a1: $(O1) + $(AR) grc $(PKG) $(O1) +a2: $(O2) + $(AR) grc $(PKG) $(O2) $(O1): nuke $(O2): a1 -nuke: - rm -f *.$(O) *.a $(PKG) - -clean: - rm -f *.$(O) *.a - -%.$O: %.go - $(GC) $< diff --git a/src/libbio/Makefile b/src/libbio/Makefile index 02eaaa684..9123d03bd 100644 --- a/src/libbio/Makefile +++ b/src/libbio/Makefile @@ -61,3 +61,5 @@ y.tab.c: $(YFILES) clean: rm -f $(OFILES) *.6 6.out $(LIB) +nuke: clean + rm -f $(GOROOT)/lib/$(LIB) diff --git a/src/libmach_amd64/Makefile b/src/libmach_amd64/Makefile index 66ed283b8..de564a03b 100644 --- a/src/libmach_amd64/Makefile +++ b/src/libmach_amd64/Makefile @@ -82,4 +82,8 @@ $(LIB): $(OFILES) $(OFILES): $(HFILES) clean: - rm -f $(OFILES) $(LIB) + rm -f *.$O $(LIB) + +nuke: clean + rm -f $(GOROOT)/lib/$(LIB) + diff --git a/src/make.bash b/src/make.bash index b36d515a8..037457fb8 100755 --- a/src/make.bash +++ b/src/make.bash @@ -8,32 +8,17 @@ export MAKEFLAGS=-j4 bash clean.bash -for i in lib9 libbio libmach_amd64 libregexp -do - cd $i - make install - cd .. -done - -for i in cmd runtime -do - cd $i - bash make.bash - cd .. -done - -# do these after go compiler and runtime are built -for i in syscall +for i in lib9 libbio libmach_amd64 libregexp cmd runtime syscall lib do echo; echo; echo %%%% making $i %%%%; echo cd $i - make install + case $i in + cmd | lib) + bash make.bash + ;; + *) + make install + esac cd .. done -for i in lib -do - cd $i - bash make.bash - cd .. -done diff --git a/src/runtime/clean.bash b/src/runtime/clean.bash deleted file mode 100644 index a64198096..000000000 --- a/src/runtime/clean.bash +++ /dev/null @@ -1,11 +0,0 @@ -# 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. - -set -ex - -for GOOS in linux darwin -do - make nuke -done - diff --git a/src/runtime/make.bash b/src/runtime/make.bash deleted file mode 100644 index 8fa8691d9..000000000 --- a/src/runtime/make.bash +++ /dev/null @@ -1,9 +0,0 @@ -# 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. - -set -ex - -make clean -make install - |