~push-gopher/golang/stable

« back to all changes in this revision

Viewing changes to src/pkg/go/build/build.go

  • Committer: Push Gopher
  • Author(s): Rob Pike
  • Date: 2013-06-13 01:13:34 UTC
  • Revision ID: push-gopher@niemeyer.net-20130613011334-81ucwaa7ggbi8xsi
testing: add -outputdir flag so "go test" controls where the files are written
Obscure misfeature now fixed: When run from "go test", profiles were always
written in the package's source directory. This change puts them in the directory
where "go test" is run.
Also fix a couple of problems causing errors in testing.after to go unreported
unless -v was set.

R=rsc, minux.ma, iant, alex.brainman
CC=golang-dev
https://codereview.appspot.com/10234044
HG=17064:3018dd1d3e6f

Show diffs side-by-side

added added

removed removed

Lines of Context:
353
353
        CgoFiles       []string // .go source files that import "C"
354
354
        IgnoredGoFiles []string // .go source files ignored for this build
355
355
        CFiles         []string // .c source files
356
 
        HFiles         []string // .h source files
 
356
        CXXFiles       []string // .cc, .cpp and .cxx source files
 
357
        HFiles         []string // .h, .hh, .hpp and .hxx source files
357
358
        SFiles         []string // .s source files
358
 
        SysoFiles      []string // .syso system object files to add to archive
359
359
        SwigFiles      []string // .swig files
360
360
        SwigCXXFiles   []string // .swigcxx files
 
361
        SysoFiles      []string // .syso system object files to add to archive
361
362
 
362
363
        // Cgo directives
363
 
        CgoPkgConfig []string // Cgo pkg-config directives
364
364
        CgoCFLAGS    []string // Cgo CFLAGS directives
 
365
        CgoCPPFLAGS  []string // Cgo CPPFLAGS directives
 
366
        CgoCXXFLAGS  []string // Cgo CXXFLAGS directives
365
367
        CgoLDFLAGS   []string // Cgo LDFLAGS directives
 
368
        CgoPkgConfig []string // Cgo pkg-config directives
366
369
 
367
370
        // Dependency information
368
371
        Imports   []string                    // imports from GoFiles, CgoFiles
600
603
                }
601
604
 
602
605
                switch ext {
603
 
                case ".go", ".c", ".s", ".h", ".S", ".swig", ".swigcxx":
 
606
                case ".go", ".c", ".cc", ".cxx", ".cpp", ".s", ".h", ".hh", ".hpp", ".hxx", ".S", ".swig", ".swigcxx":
604
607
                        // tentatively okay - read to make sure
605
608
                case ".syso":
606
609
                        // binary objects to add to package archive
643
646
                case ".c":
644
647
                        p.CFiles = append(p.CFiles, name)
645
648
                        continue
646
 
                case ".h":
 
649
                case ".cc", ".cpp", ".cxx":
 
650
                        p.CXXFiles = append(p.CXXFiles, name)
 
651
                        continue
 
652
                case ".h", ".hh", ".hpp", ".hxx":
647
653
                        p.HFiles = append(p.HFiles, name)
648
654
                        continue
649
655
                case ".s":
851
857
}
852
858
 
853
859
// saveCgo saves the information from the #cgo lines in the import "C" comment.
854
 
// These lines set CFLAGS and LDFLAGS and pkg-config directives that affect
855
 
// the way cgo's C code is built.
 
860
// These lines set CFLAGS, CPPFLAGS, CXXFLAGS and LDFLAGS and pkg-config directives
 
861
// that affect the way cgo's C code is built.
856
862
//
857
863
// TODO(rsc): This duplicates code in cgo.
858
864
// Once the dust settles, remove this code from cgo.
910
916
                switch verb {
911
917
                case "CFLAGS":
912
918
                        di.CgoCFLAGS = append(di.CgoCFLAGS, args...)
 
919
                case "CPPFLAGS":
 
920
                        di.CgoCPPFLAGS = append(di.CgoCPPFLAGS, args...)
 
921
                case "CXXFLAGS":
 
922
                        di.CgoCXXFLAGS = append(di.CgoCXXFLAGS, args...)
913
923
                case "LDFLAGS":
914
924
                        di.CgoLDFLAGS = append(di.CgoLDFLAGS, args...)
915
925
                case "pkg-config":