diff options
| author | ruki <[email protected]> | 2016-03-23 20:17:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-03-23 20:17:50 +0800 |
| commit | 2a549b0fb990bb06f6180fd7cbd3c212af5e2ebd (patch) | |
| tree | a6881c31940af297e5c9031e13e937d6f3c92b98 /xmake | |
| parent | 7312f0c3b96c79235d95c4cfe1e458a586a5cf81 (diff) | |
fix makefile bug
Diffstat (limited to 'xmake')
| -rwxr-xr-x | xmake/actions/config/makefile.lua | 4 | ||||
| -rw-r--r-- | xmake/core/platform/compiler.lua | 24 |
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 |
