summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-09-14 10:59:39 +0800
committerruki <[email protected]>2016-09-14 10:59:39 +0800
commite578c2db7c8a93fd1ac6999b9ba6f1b5c3a74406 (patch)
tree34f407392f7f38e125ab4674b692674d48a54bf3
parente8097bc82c73a6e1724d104f6516f0abd4a6e36b (diff)
fix ml assember tool
-rwxr-xr-xxmake/tools/ml.lua98
1 files changed, 92 insertions, 6 deletions
diff --git a/xmake/tools/ml.lua b/xmake/tools/ml.lua
index 07372da97..6ae420aed 100755
--- a/xmake/tools/ml.lua
+++ b/xmake/tools/ml.lua
@@ -74,6 +74,96 @@ function get(name)
return _g[name]
end
+-- make the symbol flag
+function symbol(level, symbolfile)
+
+ -- check -FS flags
+ if _g._FS == nil then
+ local ok = try
+ {
+ function ()
+ check("-ZI -FS -Fd" .. os.tmpfile() .. ".pdb")
+ return true
+ end
+ }
+ if ok then
+ _g._FS = true
+ end
+ end
+
+ -- debug? generate *.pdb file
+ local flags = ""
+ if level == "debug" then
+ if symbolfile then
+ flags = "-ZI -Fd" .. symbolfile
+ if _g._FS then
+ flags = "-FS " .. flags
+ end
+ else
+ flags = "-ZI"
+ end
+ end
+
+ -- none
+ return flags
+end
+
+-- make the warning flag
+function warning(level)
+
+ -- the maps
+ local maps =
+ {
+ none = "-w"
+ , less = "-W1"
+ , more = "-W3"
+ , all = "-W3"
+ , error = "-WX"
+ }
+
+ -- make it
+ return maps[level] or ""
+end
+
+-- make the optimize flag
+function optimize(level)
+
+ -- the maps
+ local maps =
+ {
+ none = "-Od"
+ , fast = "-O1"
+ , faster = "-O2"
+ , fastest = "-Ot"
+ , smallest = "-Os"
+ , aggressive = "-Ox"
+ }
+
+ -- make it
+ return maps[level] or ""
+end
+
+-- make the vector extension flag
+function vectorext(extension)
+
+ -- the maps
+ local maps =
+ {
+ sse = "-arch:SSE"
+ , sse2 = "-arch:SSE2"
+ , avx = "-arch:AVX"
+ , avx2 = "-arch:AVX2"
+ }
+
+ -- make it
+ return maps[extension] or ""
+end
+
+-- make the language flag
+function language(stdname)
+ return ""
+end
+
-- make the define flag
function define(macro)
@@ -103,17 +193,13 @@ function compcmd(sourcefile, objectfile, flags)
end
-- complie the source file
-function compile(sourcefile, objectfile, flags, multitasking)
+function compile(sourcefile, objectfile, incdepfile, flags)
-- 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
+ os.run(compcmd(sourcefile, objectfile, flags))
end
-- check the given flags