This repository has been archived by the owner on Feb 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
prog.go
61 lines (49 loc) · 1.35 KB
/
prog.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2018 Schibsted
package buildbuild
import "strings"
type ProgDesc struct {
LinkDesc
}
func (tmpl *ProgDesc) NewFromTemplate(bd, tname string, flavors []string) Descriptor {
return &ProgDesc{
LinkDesc: *tmpl.LinkDesc.NewFromTemplate(bd, tname, flavors),
}
}
func (p *ProgDesc) Parse(ops *GlobalOps, realsrcdir string, args map[string][]string) Descriptor {
desc := p.GenericParse(p, ops, realsrcdir, args, LinkerExtra())
p.LinkerParse(realsrcdir, args)
return desc
}
func (p *ProgDesc) Finalize(ops *GlobalOps) {
p.FinalizeCC(ops)
prog := p.TargetName
objs := p.SuffixedObjs(".o", nil)
goobj := p.FinalizeGoSrcs(ops, "lib")
objs = append(objs, goobj...)
objs = append(objs, ops.ResolveLibsOurStatic(p.Libs)...)
ldlibs := ops.ResolveLibsExternal(p.Libs)
link := ops.ResolveLibsLinker(p.Link, p.Libs)
eas := []string{"ldlibs=" + strings.Join(ldlibs, " ")}
p.AddTarget(prog, link, objs, p.Destdir, "", eas, p.TargetOptions)
p.FinalizeAnalyse(ops)
p.GeneralDesc.Finalize(ops)
}
var ProgTemplate = ProgDesc{
LinkDesc: LinkDesc{
GeneralDesc: GeneralDesc{
Destdir: "dest_bin",
TargetOptions: map[string]bool{"all": true},
},
Picrules: false,
Link: "link",
},
}
var ToolProgTemplate = ProgDesc{
LinkDesc: LinkDesc{
GeneralDesc: GeneralDesc{
Destdir: "dest_tool",
},
Picrules: false,
Link: "link",
},
}