mirror of
https://github.com/golang/go
synced 2024-11-12 10:20:27 -07:00
goinstall: generate makefiles using exp/template
R=golang-dev, adg CC=golang-dev https://golang.org/cl/4809052
This commit is contained in:
parent
7e1101d470
commit
2fc962697a
@ -8,11 +8,11 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"exp/template"
|
||||||
"go/build"
|
"go/build"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"template"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// domake builds the package in dir.
|
// domake builds the package in dir.
|
||||||
@ -138,43 +138,38 @@ type makedata struct {
|
|||||||
Imports []string // gc/ld import paths
|
Imports []string // gc/ld import paths
|
||||||
}
|
}
|
||||||
|
|
||||||
var makefileTemplate = template.MustParse(`
|
var makefileTemplate = template.New("Makefile").MustParse(`
|
||||||
include $(GOROOT)/src/Make.inc
|
include $(GOROOT)/src/Make.inc
|
||||||
|
|
||||||
TARG={Targ}
|
TARG={{.Targ}}
|
||||||
TARGDIR={TargDir}
|
TARGDIR={{.TargDir}}
|
||||||
|
|
||||||
{.section GoFiles}
|
{{with .GoFiles}}
|
||||||
GOFILES=\
|
GOFILES=\
|
||||||
{.repeated section @}
|
{{range .}} {{.}}\
|
||||||
{@}\
|
{{end}}
|
||||||
{.end}
|
|
||||||
|
|
||||||
{.end}
|
{{end}}
|
||||||
{.section OFiles}
|
{{with .OFiles}}
|
||||||
OFILES=\
|
OFILES=\
|
||||||
{.repeated section @}
|
{{range .}} {{.}}\
|
||||||
{@}\
|
{{end}}
|
||||||
{.end}
|
|
||||||
|
|
||||||
{.end}
|
{{end}}
|
||||||
{.section CgoFiles}
|
{{with .CgoFiles}}
|
||||||
CGOFILES=\
|
CGOFILES=\
|
||||||
{.repeated section @}
|
{{range .}} {{.}}\
|
||||||
{@}\
|
{{end}}
|
||||||
{.end}
|
|
||||||
|
|
||||||
{.end}
|
{{end}}
|
||||||
{.section CgoOFiles}
|
{{with .CgoOFiles}}
|
||||||
CGO_OFILES=\
|
CGO_OFILES=\
|
||||||
{.repeated section @}
|
{{range .}} {{.}}\
|
||||||
{@}\
|
{{end}}
|
||||||
{.end}
|
|
||||||
|
|
||||||
{.end}
|
{{end}}
|
||||||
GCIMPORTS={.repeated section Imports}-I "{@}" {.end}
|
GCIMPORTS={{range .Imports}}-I "{{.}}" {{end}}
|
||||||
LDIMPORTS={.repeated section Imports}-L "{@}" {.end}
|
LDIMPORTS={{range .Imports}}-L "{{.}}" {{end}}
|
||||||
|
|
||||||
include $(GOROOT)/src/Make.{Type}
|
include $(GOROOT)/src/Make.{{.Type}}
|
||||||
`,
|
`)
|
||||||
nil)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user