summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xxmake/actions/config/makefile.lua4
-rw-r--r--xmake/core/platform/compiler.lua24
2 files changed, 19 insertions, 9 deletions
diff --git a/xmake/actions/config/makefile.lua b/xmake/actions/config/makefile.lua
index 3f3832837..57c94d503 100755
--- a/xmake/actions/config/makefile.lua
+++ b/xmake/actions/config/makefile.lua
@@ -83,10 +83,10 @@ function _make_object(makefile, target, srcfile, objfile)
local filetype = path.extension(srcfile):lower()
-- make the object for the *.o/obj source makefile
- if filetype == ".o" or filetype ~= ".obj" then
+ if filetype == ".o" or filetype == ".obj" then
return _make_object_for_object(makefile, target, srcfile, objfile)
-- make the object for the *.[a|lib] source file
- elseif filetype == ".a" or filetype ~= ".lib" then
+ elseif filetype == ".a" or filetype == ".lib" then
return _make_object_for_static(makefile, target, srcfile, objfile)
end
diff --git a/xmake/core/platform/compiler.lua b/xmake/core/platform/compiler.lua
index 86ef1ef86..5c380d569 100644
--- a/xmake/core/platform/compiler.lua
+++ b/xmake/core/platform/compiler.lua
@@ -306,7 +306,7 @@ end
function compiler._make_for_option(self, opt, srcfile, objfile, logfile)
-- check
- assert(self and self._TOOL and opt)
+ assert(self and self:_tool() and opt)
-- the flag names
local flagnames = compiler._flagnames(self._KIND)
@@ -331,7 +331,7 @@ function compiler._make_for_option(self, opt, srcfile, objfile, logfile)
flags = table.unique(flags)
-- execute the compile command
- return self._TOOL:command_compile(srcfile, objfile, table.concat(flags, " "):trim(), logfile)
+ return self:_tool():command_compile(srcfile, objfile, table.concat(flags, " "):trim(), logfile)
end
-- get the flag names from the given compiler name
@@ -358,6 +358,16 @@ function compiler._flagnames(name)
return flagnames
end
+-- get the tool
+function compiler._tool(self)
+
+ -- check
+ assert(self and self:_tool())
+
+ -- get it
+ return self:_tool()
+end
+
-- get the compiler kind from the source file type
function compiler._kind(srcfile)
@@ -451,7 +461,7 @@ end
function compiler.makecmd(self, target, srcfile, objfile, logfile)
-- check
- assert(self and self._TOOL and target)
+ assert(self and self:_tool() and target)
-- the flag names
local flagnames = compiler._flagnames(self._KIND)
@@ -461,7 +471,7 @@ function compiler.makecmd(self, target, srcfile, objfile, logfile)
local flags = self:flags(flagnames, target)
-- make the compile command
- return self._TOOL:command_compile(srcfile, objfile, table.concat(flags, " "):trim(), logfile)
+ return self:_tool():command_compile(srcfile, objfile, table.concat(flags, " "):trim(), logfile)
end
-- check include for the project option
@@ -493,7 +503,7 @@ function compiler.check_include(opt, include, srcpath, objpath)
if not self then return end
-- execute the compile command
- return self._TOOL:main(self:_make_for_option(opt, srcpath, objpath, utils.ifelse(option.get("verbose"), nil, xmake._NULDEV)))
+ return self:_tool():main(self:_make_for_option(opt, srcpath, objpath, utils.ifelse(option.get("verbose"), nil, xmake._NULDEV)))
end
-- check function for the project option
@@ -537,7 +547,7 @@ function compiler.check_function(opt, interface, srcpath, objpath)
srcfile:close()
-- execute the compile command
- return self._TOOL:main(self:_make_for_option(opt, srcpath, objpath, utils.ifelse(option.get("verbose"), nil, xmake._NULDEV)))
+ return self:_tool():main(self:_make_for_option(opt, srcpath, objpath, utils.ifelse(option.get("verbose"), nil, xmake._NULDEV)))
end
-- check typedef for the project option
@@ -581,7 +591,7 @@ function compiler.check_typedef(opt, typedef, srcpath, objpath)
srcfile:close()
-- execute the compile command
- return self._TOOL:main(self:_make_for_option(opt, srcpath, objpath, utils.ifelse(option.get("verbose"), nil, xmake._NULDEV)))
+ return self:_tool():main(self:_make_for_option(opt, srcpath, objpath, utils.ifelse(option.get("verbose"), nil, xmake._NULDEV)))
end
-- return module