summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-03 23:06:36 +0800
committerruki <[email protected]>2022-05-03 23:06:36 +0800
commitbf0bdbaff7a2b5fb5fc4e0b5ab201fe764ea84d0 (patch)
tree9dce52ae5ab1fee87ebcde135a60a76fe2487e79 /xmake
parent0938467b411d557a2012b03ae7d6f377bc783ac6 (diff)
improve nasm
Diffstat (limited to 'xmake')
-rw-r--r--xmake/modules/core/tools/nasm.lua46
1 files changed, 17 insertions, 29 deletions
diff --git a/xmake/modules/core/tools/nasm.lua b/xmake/modules/core/tools/nasm.lua
index 8297e21bc..b4b623b61 100644
--- a/xmake/modules/core/tools/nasm.lua
+++ b/xmake/modules/core/tools/nasm.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.language.language")
-- init it
function init(self)
@@ -45,16 +46,23 @@ function init(self)
})
end
+-- make the symbol flag
+function nf_symbol(self, level)
+ -- only for source kind
+ local kind = self:kind()
+ if language.sourcekinds()[kind] then
+ local maps = {
+ debug = "-g"
+ }
+ return maps[level]
+ end
+end
+
-- make the warning flag
function nf_warning(self, level)
-
- -- the maps
- local maps =
- {
+ local maps = {
none = "-w"
}
-
- -- make it
return maps[level]
end
@@ -79,12 +87,12 @@ function nf_sysincludedir(self, dir)
end
-- make the compile arguments list
-function _compargv1(self, sourcefile, objectfile, flags)
+function compargv(self, sourcefile, objectfile, flags)
return self:program(), table.join(flags, "-o", objectfile, sourcefile)
end
-- compile the source file
-function _compile1(self, sourcefile, objectfile, dependinfo, flags)
+function compile(self, sourcefile, objectfile, dependinfo, flags)
-- ensure the object directory
os.mkdir(path.directory(objectfile))
@@ -93,7 +101,7 @@ function _compile1(self, sourcefile, objectfile, dependinfo, flags)
local outdata, errdata = try
{
function ()
- return os.iorunv(_compargv1(self, sourcefile, objectfile, flags))
+ return os.iorunv(compargv(self, sourcefile, objectfile, flags))
end,
catch
{
@@ -122,23 +130,3 @@ function _compile1(self, sourcefile, objectfile, dependinfo, flags)
}
end
--- make the compile arguments list
-function compargv(self, sourcefiles, objectfile, flags)
-
- -- only support single source file now
- assert(type(sourcefiles) ~= "table", "'object:sources' not support!")
-
- -- for only single source file
- return _compargv1(self, sourcefiles, objectfile, flags)
-end
-
--- compile the source file
-function compile(self, sourcefiles, objectfile, dependinfo, flags)
-
- -- only support single source file now
- assert(type(sourcefiles) ~= "table", "'object:sources' not support!")
-
- -- for only single source file
- _compile1(self, sourcefiles, objectfile, dependinfo, flags)
-end
-