diff options
| author | ruki <[email protected]> | 2016-04-28 11:14:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-04-28 11:14:04 +0800 |
| commit | 3571f65949d94560efbb2ae26703e0f5ac8a5f13 (patch) | |
| tree | 270eccf3ff12e44673fde8bcb0bc5c5a0dc93682 /xmake/tools/nmake.lua | |
| parent | 52eb26701de17e800ae69cc495ac665a39d5d1dd (diff) | |
add link and nmake tools for windows
Diffstat (limited to 'xmake/tools/nmake.lua')
| -rw-r--r-- | xmake/tools/nmake.lua | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/xmake/tools/nmake.lua b/xmake/tools/nmake.lua new file mode 100644 index 000000000..d62b785b0 --- /dev/null +++ b/xmake/tools/nmake.lua @@ -0,0 +1,75 @@ +--!The Automatic Cross-platform Build Tool +-- +-- XMake is free software; you can redistribute it and/or modify +-- it under the terms of the GNU Lesser General Public License as published by +-- the Free Software Foundation; either version 2.1 of the License, or +-- (at your option) any later version. +-- +-- XMake is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public License +-- along with XMake; +-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> +-- +-- Copyright (C) 2015 - 2016, ruki All rights reserved. +-- +-- @author ruki +-- @file nmake.lua +-- + +-- imports +import("utils.vsenv") +import("core.base.option") + +-- init it +function init(shellname) + + -- save name + _g.shellname = shellname or "nmake.exe" + +end + +-- get the property +function get(name) + + -- get it + return _g[name] +end + +-- run it +function run(makefile, target, jobs) + + -- is verbose? + local verbose = ifelse(option.get("verbose"), "-v", "") + + -- enter vs envirnoment + vsenv.enter() + + -- run command + if makefile and os.isfile(makefile) then + os.run("%s /nologo /f %s %s VERBOSE=%s", _g.shellname, makefile, target or "", verbose) + else + os.run("%s /nologo %s VERBOSE=%s", _g.shellname, target or "", verbose) + end + + -- leave vs envirnoment + vsenv.leave() +end + +-- check the given flags +function check(flags) + + -- make an empty makefile + local makefile = path.join(os.tmpdir(), "xmake.checker.nmake") + io.write(makefile, "all:\n") + + -- check it + os.run("%s /nologo %s /f %s", _g.shellname, ifelse(flags, flags, ""), makefile) + + -- remove this makefile + os.rm(makefile) +end + |
