diff options
| author | ruki <[email protected]> | 2017-02-17 20:02:00 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-02-17 20:02:00 +0800 |
| commit | 6fcb7f953c4c397b7e08bf577f37195508663260 (patch) | |
| tree | 72d63622b2c4a84079d88c3d2f40aab86f032156 /xmake/tools/go.lua | |
| parent | bd54ed5a6c59f75ad768d4d37843262314dd1aa1 (diff) | |
build go project ok
Diffstat (limited to 'xmake/tools/go.lua')
| -rwxr-xr-x | xmake/tools/go.lua | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/xmake/tools/go.lua b/xmake/tools/go.lua index da777bdd9..578a49f6a 100755 --- a/xmake/tools/go.lua +++ b/xmake/tools/go.lua @@ -38,7 +38,7 @@ function init(shellname, kind) _g.kind = kind -- init arflags - _g.arflags = { "grc" } + _g["go-arflags"] = { "grc" } -- init the file formats _g.formats = {} @@ -73,37 +73,24 @@ function nf_linkdir(dir) end -- make the link command -function linkcmd(objectfiles, targetfile, flags) +function linkcmd(objectfiles, targetkind, targetfile, flags) -- make it - return format("%s tool link %s -o %s %s", _g.shellname, flags, targetfile, objectfiles) -end - --- make the archive command -function archivecmd(objectfiles, targetfile, flags) - - -- make it - return format("%s tool pack %s %s %s", _g.shellname, flags, targetfile, objectfiles) + if targetkind == "static" then + return format("%s tool pack %s %s %s", _g.shellname, flags, targetfile, objectfiles) + else + return format("%s tool link %s -o %s %s", _g.shellname, flags, targetfile, objectfiles) + end end -- link the target file -function link(objectfiles, targetfile, flags) - - -- ensure the target directory - os.mkdir(path.directory(targetfile)) - - -- link it - os.run(linkcmd(objectfiles, targetfile, flags)) -end - --- archive the library file -function archive(objectfiles, targetfile, flags) +function link(objectfiles, targetkind, targetfile, flags) -- ensure the target directory os.mkdir(path.directory(targetfile)) -- link it - os.run(archivecmd(objectfiles, targetfile, flags)) + os.run(linkcmd(objectfiles, targetkind, targetfile, flags)) end -- make the complie command @@ -140,4 +127,3 @@ function check(flags) os.rm(objectfile) os.rm(sourcefile) end - |
