build.go: prefix library name to generated object files

This commit is contained in:
Giacomo Tesio 2017-09-14 00:47:48 +02:00
parent 1c7d2a35fd
commit 5d8c601184
1 changed files with 7 additions and 1 deletions

View File

@ -466,8 +466,14 @@ func install(b *build) {
case len(b.Program) > 0:
move(b.Program, b.Install)
case len(b.Library) > 0:
ofiles := []string{}
for _, o := range b.ObjectFiles {
run(b, *shellhack, exec.Command("mv", o, b.Library + "-" + o))
ofiles = append(ofiles, b.Library + "-" + o)
}
libpath := path.Join(b.Install, b.Library)
args := append([]string{"-rs", libpath}, b.ObjectFiles...)
args := append([]string{"-rs", libpath}, ofiles...)
run(b, *shellhack, exec.Command(tools["ar"], args...))
run(b, *shellhack, exec.Command(tools["ranlib"], libpath))
}