]> Cypherpunks repositories - gostls13.git/commitdiff
go/build: support compiler as build constraint
authorIan Lance Taylor <iant@golang.org>
Thu, 1 Nov 2012 18:12:15 +0000 (11:12 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 1 Nov 2012 18:12:15 +0000 (11:12 -0700)
This supports writing different .c/.s code when using gccgo.

R=golang-dev, dsymonds, iant, rsc
CC=golang-dev
https://golang.org/cl/6823055

src/pkg/go/build/build.go
src/pkg/go/build/doc.go

index b8b1c13b5b8ad5f3c363d7920a866cec3beea3f8..d32afc31db9a30ee6b597815d39f7bf5ac8794c3 100644 (file)
@@ -897,6 +897,8 @@ func splitQuoted(s string) (r []string, err error) {
 //     $GOARCH
 //     cgo (if cgo is enabled)
 //     !cgo (if cgo is disabled)
+//     ctxt.Compiler
+//     !ctxt.Compiler
 //     tag (if tag is listed in ctxt.BuildTags)
 //     !tag (if tag is not listed in ctxt.BuildTags)
 //     a comma-separated list of any of these
@@ -928,7 +930,7 @@ func (ctxt *Context) match(name string) bool {
        if ctxt.CgoEnabled && name == "cgo" {
                return true
        }
-       if name == ctxt.GOOS || name == ctxt.GOARCH {
+       if name == ctxt.GOOS || name == ctxt.GOARCH || name == ctxt.Compiler {
                return true
        }
 
index 3aaa6ac657832204668afa4ee2759b5e1653df0b..36dd308934c57227c2b22e81eff571df93cfb752 100644 (file)
@@ -88,6 +88,7 @@
 //
 //     - the target operating system, as spelled by runtime.GOOS
 //     - the target architecture, as spelled by runtime.GOARCH
+//     - the compiler being used, currently either "gc" or "gccgo"
 //     - "cgo", if ctxt.CgoEnabled is true
 //     - any additional words listed in ctxt.BuildTags
 //