diff options
Diffstat (limited to 'xmake/tools/ml.lua')
| -rwxr-xr-x | xmake/tools/ml.lua | 30 |
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 |
