summaryrefslogtreecommitdiff
path: root/xmake/scripts/platform/windows/tools/nmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-12 12:30:56 +0800
committerruki <[email protected]>2015-06-12 12:30:56 +0800
commit99b9eb72c8db9854311fc0b5a79e07f8cae85242 (patch)
tree837868dffc057d9a987ac4dc0592d98b015563c2 /xmake/scripts/platform/windows/tools/nmake.lua
parent1678ef146c122b8a38a4485262f43b816230aa0f (diff)
modify platform and probe toolchains
Diffstat (limited to 'xmake/scripts/platform/windows/tools/nmake.lua')
-rw-r--r--xmake/scripts/platform/windows/tools/nmake.lua56
1 files changed, 9 insertions, 47 deletions
diff --git a/xmake/scripts/platform/windows/tools/nmake.lua b/xmake/scripts/platform/windows/tools/nmake.lua
index 7d42dc706..f84f9ee6f 100644
--- a/xmake/scripts/platform/windows/tools/nmake.lua
+++ b/xmake/scripts/platform/windows/tools/nmake.lua
@@ -26,47 +26,11 @@ local path = require("base/path")
local utils = require("base/utils")
local string = require("base/string")
local config = require("base/config")
+local platform = require("platform/platform")
-- define module: nmake
local nmake = nmake or {}
--- enter the given environment
-function nmake._enter(name)
-
- -- check
- assert(name)
-
- -- get the pathes for the vs environment
- local old = nil
- local new = config.get("__vsenv_" .. name)
- if new then
-
- -- get the current pathes
- old = os.getenv(name) or ""
-
- -- append the current pathes
- new = new .. ";" .. old
-
- -- update the pathes for the environment
- os.setenv(name, new)
- end
-
- -- return the previous environment
- return old;
-end
-
--- leave the given environment
-function nmake._leave(name, old)
-
- -- check
- assert(name)
-
- -- restore the previous environment
- if old then
- os.setenv(name, old)
- end
-end
-
-- the init function
function nmake.init(self, name)
@@ -81,11 +45,12 @@ end
-- the main function
function nmake.main(self, mkfile, target)
- -- enter the vs environment
- local pathes = nmake._enter("path")
- local libs = nmake._enter("lib")
- local includes = nmake._enter("include")
- local libpathes = nmake._enter("libpath")
+ -- the windows module
+ local windows = platform.module()
+ assert(windows)
+
+ -- enter envirnoment
+ windows.enter()
-- make command
local cmd = nil
@@ -98,11 +63,8 @@ function nmake.main(self, mkfile, target)
-- done
local ok = os.execute(cmd)
- -- leave the vs environment
- nmake._leave("path", pathes)
- nmake._leave("lib", libs)
- nmake._leave("include", includes)
- nmake._leave("libpath", libpathes)
+ -- leave envirnoment
+ windows.leave()
-- ok?
return utils.ifelse(ok == 0, true, false)