Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Commit

Permalink
context: add linkmode and buildmode
Browse files Browse the repository at this point in the history
Fixes #340

No accessors to change linkmode and buildmode because we don't
support anything except buildmode=exe, and linkmode defaults to
automatic.
  • Loading branch information
davecheney committed Sep 15, 2015
1 parent 75e7810 commit edba66a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type Context struct {

gcflags []string // flags passed to the compiler
ldflags []string // flags passed to the linker

linkmode, buildmode string // link and build modes
}

// GOOS configures the Context to use goos as the target os.
Expand Down Expand Up @@ -88,9 +90,10 @@ func (p *Project) NewContext(opts ...func(*Context) error) (*Context, error) {
GcToolchain(),
}
ctx := Context{
Project: p,
workdir: mktmpdir(),
pkgs: make(map[string]*Package),
Project: p,
workdir: mktmpdir(),
pkgs: make(map[string]*Package),
buildmode: "exe",
}

for _, opt := range append(defaults, opts...) {
Expand Down
2 changes: 1 addition & 1 deletion gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (t *gcToolchain) Ld(pkg *Package, searchpaths []string, outfile, afile stri
}
args = append(args, "-extld="+gcc())
if gc15 {
args = append(args, "-buildmode=exe")
args = append(args, "-buildmode", pkg.buildmode)
}
args = append(args, afile)
if err := mkdir(filepath.Dir(outfile)); err != nil {
Expand Down

0 comments on commit edba66a

Please sign in to comment.