1
0
mirror of https://github.com/golang/go synced 2024-10-04 11:11:21 -06:00

cgo: write _cgo_export.h to object directory, not source dir

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5540048
This commit is contained in:
Russ Cox 2012-01-12 15:04:31 -08:00
parent 630c838886
commit ba0e02b207
2 changed files with 2 additions and 3 deletions

View File

@ -396,7 +396,7 @@ func (p *Package) writeOutputFunc(fgcc *os.File, n *Name) {
// from Go so that they are callable from C. // from Go so that they are callable from C.
func (p *Package) writeExports(fgo2, fc, fm *os.File) { func (p *Package) writeExports(fgo2, fc, fm *os.File) {
fgcc := creat(*objDir + "_cgo_export.c") fgcc := creat(*objDir + "_cgo_export.c")
fgcch := creat("_cgo_export.h") fgcch := creat(*objDir + "_cgo_export.h")
fmt.Fprintf(fgcch, "/* Created by cgo - DO NOT EDIT. */\n") fmt.Fprintf(fgcch, "/* Created by cgo - DO NOT EDIT. */\n")
fmt.Fprintf(fgcch, "%s\n", gccExportHeaderProlog) fmt.Fprintf(fgcch, "%s\n", gccExportHeaderProlog)

View File

@ -396,8 +396,7 @@ func (b *build) cgo(cgofiles, cgocfiles []string) (outGo, outObj []string) {
Output: output, Output: output,
}) })
outGo = append(outGo, gofiles...) outGo = append(outGo, gofiles...)
exportH := filepath.Join(b.path, "_cgo_export.h") b.script.addIntermediate(defunC, b.obj+"_cgo_export.h", b.obj+"_cgo_flags")
b.script.addIntermediate(defunC, exportH, b.obj+"_cgo_flags")
b.script.addIntermediate(cfiles...) b.script.addIntermediate(cfiles...)
// cc _cgo_defun.c // cc _cgo_defun.c