summaryrefslogtreecommitdiff
path: root/xmake/tools/ar.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-02-17 20:02:00 +0800
committerruki <[email protected]>2017-02-17 20:02:00 +0800
commit6fcb7f953c4c397b7e08bf577f37195508663260 (patch)
tree72d63622b2c4a84079d88c3d2f40aab86f032156 /xmake/tools/ar.lua
parentbd54ed5a6c59f75ad768d4d37843262314dd1aa1 (diff)
build go project ok
Diffstat (limited to 'xmake/tools/ar.lua')
-rw-r--r--xmake/tools/ar.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/xmake/tools/ar.lua b/xmake/tools/ar.lua
index dfecc9340..4c82a7c5b 100644
--- a/xmake/tools/ar.lua
+++ b/xmake/tools/ar.lua
@@ -61,20 +61,26 @@ function strip(level)
end
-- make the link command
-function linkcmd(objectfiles, targetfile, flags)
+function linkcmd(objectfiles, targetkind, targetfile, flags)
+
+ -- check
+ assert(targetkind == "static")
-- make it
return format("%s %s %s %s", _g.shellname, flags, targetfile, objectfiles)
end
-- link the library file
-function link(objectfiles, targetfile, flags)
+function link(objectfiles, targetkind, targetfile, flags)
+
+ -- check
+ assert(targetkind == "static", "the target kind: %s is not support for ar", targetkind)
-- ensure the target directory
os.mkdir(path.directory(targetfile))
-- link it
- os.run(linkcmd(objectfiles, targetfile, flags))
+ os.run(linkcmd(objectfiles, targetkind, targetfile, flags))
end
-- extract the static library to object directory
@@ -125,7 +131,7 @@ function check(flags)
compiler.compile(sourcefile, objectfile)
-- check it
- link(objectfile, libraryfile, arflags)
+ link(objectfile, "static", libraryfile, arflags)
-- remove files
os.rm(objectfile)