summaryrefslogtreecommitdiff
path: root/xmake/tools/ml.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-07-09 15:08:28 +0800
committerruki <[email protected]>2016-07-09 15:08:28 +0800
commit9feb387e4e4e6694b2c9ac3de4d517fb4c4ae44a (patch)
tree9581332e5365025b5663c3c48f223a9dfd6f415c /xmake/tools/ml.lua
parent460030d64886772601749b874f06fe536f1d3fd5 (diff)
fix install directory and modify compiler and linker interfaces
Diffstat (limited to 'xmake/tools/ml.lua')
-rwxr-xr-xxmake/tools/ml.lua30
1 files changed, 22 insertions, 8 deletions
diff --git a/xmake/tools/ml.lua b/xmake/tools/ml.lua
index f705dd509..02e37d0df 100755
--- a/xmake/tools/ml.lua
+++ b/xmake/tools/ml.lua
@@ -96,10 +96,24 @@ function includedir(dir)
end
-- make the complie command
-function compcmd(srcfile, objfile, flags)
+function compcmd(sourcefile, objectfile, flags)
-- make it
- return format("%s -c %s -Fo%s %s", _g.shellname, flags, objfile, srcfile)
+ return format("%s -c %s -Fo%s %s", _g.shellname, flags, objectfile, sourcefile)
+end
+
+-- complie the source file
+function compile(sourcefile, objectfile, flags, multitasking)
+
+ -- ensure the object directory
+ os.mkdir(path.directory(objectfile))
+
+ -- compile it
+ if multitasking then
+ os.corun(compcmd(sourcefile, objectfile, flags))
+ else
+ os.run(compcmd(sourcefile, objectfile, flags))
+ end
end
-- run command
@@ -113,15 +127,15 @@ end
function check(flags)
-- make an stub source file
- local objfile = path.join(os.tmpdir(), "xmake.ml.obj")
- local srcfile = path.join(os.tmpdir(), "xmake.ml.asm")
- io.write(srcfile, "end")
+ local objectfile = path.join(os.tmpdir(), "xmake.ml.obj")
+ local sourcefile = path.join(os.tmpdir(), "xmake.ml.asm")
+ io.write(sourcefile, "end")
-- check it
- os.run("%s -c %s -Fo%s %s", _g.shellname, ifelse(flags, flags, ""), objfile, srcfile)
+ os.run("%s -c %s -Fo%s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
-- remove files
- os.rm(objfile)
- os.rm(srcfile)
+ os.rm(objectfile)
+ os.rm(sourcefile)
end