OLD | NEW |
1 // Copyright 2010 The Go Authors. All rights reserved. | 1 // Copyright 2010 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Run "make install" to build package. | 5 // Run "make install" to build package. |
6 | 6 |
7 package main | 7 package main |
8 | 8 |
9 import ( | 9 import ( |
10 "bytes" | 10 "bytes" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 var buf bytes.Buffer | 76 var buf bytes.Buffer |
77 md := makedata{pkg, goFiles, cgoFiles, oFiles} | 77 md := makedata{pkg, goFiles, cgoFiles, oFiles} |
78 if err := makefileTemplate.Execute(&md, &buf); err != nil { | 78 if err := makefileTemplate.Execute(&md, &buf); err != nil { |
79 return nil, err | 79 return nil, err |
80 } | 80 } |
81 return buf.Bytes(), nil | 81 return buf.Bytes(), nil |
82 } | 82 } |
83 | 83 |
84 // makedata is the data type for the makefileTemplate. | 84 // makedata is the data type for the makefileTemplate. |
85 type makedata struct { | 85 type makedata struct { |
86 » pkg string // package import path | 86 » Pkg string // package import path |
87 » goFiles []string // list of non-cgo .go files | 87 » GoFiles []string // list of non-cgo .go files |
88 » cgoFiles []string // list of cgo .go files | 88 » CgoFiles []string // list of cgo .go files |
89 » oFiles []string // list of ofiles for cgo | 89 » OFiles []string // list of ofiles for cgo |
90 } | 90 } |
91 | 91 |
92 var makefileTemplate = template.MustParse(` | 92 var makefileTemplate = template.MustParse(` |
93 include $(GOROOT)/src/Make.inc | 93 include $(GOROOT)/src/Make.inc |
94 | 94 |
95 TARG={pkg} | 95 TARG={Pkg} |
96 | 96 |
97 {.section goFiles} | 97 {.section GoFiles} |
98 GOFILES=\ | 98 GOFILES=\ |
99 {.repeated section goFiles} | 99 {.repeated section GoFiles} |
100 {@}\ | 100 {@}\ |
101 {.end} | 101 {.end} |
102 | 102 |
103 {.end} | 103 {.end} |
104 {.section cgoFiles} | 104 {.section CgoFiles} |
105 CGOFILES=\ | 105 CGOFILES=\ |
106 {.repeated section cgoFiles} | 106 {.repeated section CgoFiles} |
107 {@}\ | 107 {@}\ |
108 {.end} | 108 {.end} |
109 | 109 |
110 {.end} | 110 {.end} |
111 {.section oFiles} | 111 {.section OFiles} |
112 CGO_OFILES=\ | 112 CGO_OFILES=\ |
113 {.repeated section oFiles} | 113 {.repeated section OFiles} |
114 {@}\ | 114 {@}\ |
115 {.end} | 115 {.end} |
116 | 116 |
117 {.end} | 117 {.end} |
118 include $(GOROOT)/src/Make.pkg | 118 include $(GOROOT)/src/Make.pkg |
119 `, | 119 `, |
120 nil) | 120 nil) |
OLD | NEW |