summaryrefslogtreecommitdiff
path: root/xmake/tools/go.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-02-14 09:00:26 +0800
committerruki <[email protected]>2017-02-14 09:00:26 +0800
commit5e23aa6f9344b21dee98ad3fad9182808d690485 (patch)
tree2592b6b087dce76b6447d4de2a5a1446b6c98169 /xmake/tools/go.lua
parentf7eaf51c4cad7d94989e130de2172df2cbc74193 (diff)
modify interface for compiling multiple source files
Diffstat (limited to 'xmake/tools/go.lua')
-rwxr-xr-xxmake/tools/go.lua50
1 files changed, 35 insertions, 15 deletions
diff --git a/xmake/tools/go.lua b/xmake/tools/go.lua
index c81a0c206..1703862b1 100755
--- a/xmake/tools/go.lua
+++ b/xmake/tools/go.lua
@@ -69,13 +69,6 @@ function linkcmd(objectfiles, targetfile, flags)
return format("%s tool link %s -o %s %s", _g.shellname, flags, targetfile, objectfiles)
end
--- make the complie command
-function compcmd(sourcefile, objectfile, flags)
-
- -- make it
- return format("%s tool compile %s -o %s %s", _g.shellname, flags, objectfile, sourcefile)
-end
-
-- make the archive command
function archivecmd(objectfiles, targetfile, flags)
@@ -103,24 +96,51 @@ function link(objectfiles, targetfile, flags)
os.run(linkcmd(objectfiles, targetfile, flags))
end
+-- archive the library file
+function archive(objectfiles, targetfile, flags)
+
+ -- ensure the target directory
+ os.mkdir(path.directory(targetfile))
+
+ -- link it
+ os.run(archivecmd(objectfiles, targetfile, flags))
+end
+
+-- make the complie command
+function _compcmd1(sourcefile, objectfile, flags)
+
+ -- make it
+ return format("%s tool compile %s -o %s %s", _g.shellname, flags, objectfile, sourcefile)
+end
+
-- complie the source file
-function compile(sourcefile, objectfile, incdepfile, flags)
+function _compile1(sourcefile, objectfile, incdepfile, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
-- compile it
- os.run(compcmd(sourcefile, objectfile, flags))
+ os.run(_compcmd1(sourcefile, objectfile, flags))
end
--- archive the library file
-function archive(objectfiles, targetfile, flags)
+-- make the complie command
+function compcmd(sourcefiles, objectfile, flags)
- -- ensure the target directory
- os.mkdir(path.directory(targetfile))
+ -- only support single source file now
+ assert(type(sourcefiles) == "string", "not support")
- -- link it
- os.run(archivecmd(objectfiles, targetfile, flags))
+ -- for only single source file
+ return _compcmd1(sourcefiles, objectfile, flags)
+end
+
+-- complie the source file
+function compile(sourcefiles, objectfile, incdepfiles, flags)
+
+ -- only support single source file now
+ assert(type(sourcefiles) == "string", "not support")
+
+ -- for only single source file
+ _compile1(sourcefiles, objectfile, incdepfiles, flags)
end
-- check the given flags