summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-06-21 08:41:22 +0800
committerruki <[email protected]>2017-06-21 08:41:22 +0800
commit45a54659f7449ead7ed073f9c0cbbe1da9fcdc06 (patch)
treea09be69c75dce6435d7584ad467aeb51e3c8d37a
parentace13f7594d5dbddd771cfe0a4004bbcb506b11c (diff)
rename shellname to program
-rw-r--r--xmake/actions/build/kinds/object.lua1
-rw-r--r--xmake/actions/build/main.lua1
-rw-r--r--xmake/core/sandbox/modules/import/core/tool/tool.lua49
-rw-r--r--xmake/core/tool/tool.lua28
-rw-r--r--xmake/modules/devel/debugger/run.lua10
-rw-r--r--xmake/plugins/project/makefile/makefile.lua38
-rw-r--r--xmake/tools/ar.lua10
-rw-r--r--xmake/tools/cl.lua8
-rw-r--r--xmake/tools/clang.lua4
-rw-r--r--xmake/tools/clangxx.lua4
-rw-r--r--xmake/tools/dmd.lua13
-rw-r--r--xmake/tools/gcc.lua15
-rw-r--r--xmake/tools/gccgo.lua6
-rw-r--r--xmake/tools/gdc.lua4
-rw-r--r--xmake/tools/go.lua13
-rw-r--r--xmake/tools/gxx.lua4
-rw-r--r--xmake/tools/ldc.lua4
-rw-r--r--xmake/tools/lib.lua10
-rw-r--r--xmake/tools/link.lua10
-rw-r--r--xmake/tools/ml.lua10
-rw-r--r--xmake/tools/ml64.lua4
-rw-r--r--xmake/tools/rc.lua8
-rw-r--r--xmake/tools/rustc.lua11
-rw-r--r--xmake/tools/swiftc.lua11
24 files changed, 110 insertions, 166 deletions
diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua
index 5fc5e8044..18140dee5 100644
--- a/xmake/actions/build/kinds/object.lua
+++ b/xmake/actions/build/kinds/object.lua
@@ -24,7 +24,6 @@
-- imports
import("core.base.option")
-import("core.tool.tool")
import("core.tool.compiler")
import("core.tool.extractor")
import("core.project.config")
diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua
index 18df4afb9..c47045c59 100644
--- a/xmake/actions/build/main.lua
+++ b/xmake/actions/build/main.lua
@@ -29,7 +29,6 @@ import("core.project.config")
import("core.project.project")
import("core.project.cache")
import("core.platform.platform")
-import("core.tool.tool")
import("builder")
-- main
diff --git a/xmake/core/sandbox/modules/import/core/tool/tool.lua b/xmake/core/sandbox/modules/import/core/tool/tool.lua
deleted file mode 100644
index 9fbc68ced..000000000
--- a/xmake/core/sandbox/modules/import/core/tool/tool.lua
+++ /dev/null
@@ -1,49 +0,0 @@
---!The Make-like Build Utility based on Lua
---
--- Licensed to the Apache Software Foundation (ASF) under one
--- or more contributor license agreements. See the NOTICE file
--- distributed with this work for additional information
--- regarding copyright ownership. The ASF licenses this file
--- to you under the Apache License, Version 2.0 (the
--- "License"); you may not use this file except in compliance
--- with the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
---
--- Copyright (C) 2015 - 2017, TBOOX Open Source Group.
---
--- @author ruki
--- @file tool.lua
---
-
--- define module
-local sandbox_core_tool = sandbox_core_tool or {}
-
--- load modules
-local tool = require("tool/tool")
-local config = require("project/config")
-local platform = require("platform/platform")
-local raise = require("sandbox/modules/raise")
-
--- get the tool shell name
-function sandbox_core_tool.shellname(name)
-
- -- get it
- return platform.tool(name)
-end
-
--- check the tool and return the absolute path if exists
-function sandbox_core_tool.check(shellname, dirs, check)
-
- -- check it
- return tool.check(shellname, dirs, check)
-end
-
--- return module
-return sandbox_core_tool
diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua
index ca81ec0da..5185d7b2f 100644
--- a/xmake/core/tool/tool.lua
+++ b/xmake/core/tool/tool.lua
@@ -85,14 +85,14 @@ function tool._load(kind, name, program)
return nil, errors
end
--- check the shellname
-function tool._check(shellname, check)
+-- check the program
+function tool._check(program, check)
-- uses the passed checker
if check ~= nil then
-- check it
- local ok, errors = sandbox.load(check, shellname)
+ local ok, errors = sandbox.load(check, program)
if not ok then
utils.verror(errors)
end
@@ -102,14 +102,14 @@ function tool._check(shellname, check)
end
-- load the tool module
- local module, errors = tool._load(shellname)
+ local module, errors = tool._load(program)
if not module then
utils.verror(errors)
end
-- no checker? attempt to run it directly
if not module or not module.check then
- return 0 == os.exec(shellname, os.nuldev(), os.nuldev())
+ return 0 == os.exec(program, os.nuldev(), os.nuldev())
end
-- check it
@@ -150,35 +150,35 @@ function tool.load(kind)
end
-- check the tool and return the absolute path if exists
-function tool.check(shellname, dirs, check)
+function tool.check(program, dirs, check)
-- check
- assert(shellname)
+ assert(program)
-- attempt to get result from cache first
tool._CHECKINFO = tool._CHECKINFO or {}
- local result = tool._CHECKINFO[shellname]
+ local result = tool._CHECKINFO[program]
if result then
return result
end
-- attempt to check it directly
- if tool._check(shellname, check) then
- tool._CHECKINFO[shellname] = shellname
- return shellname
+ if tool._check(program, check) then
+ tool._CHECKINFO[program] = program
+ return program
end
-- attempt to check it from the given directories
- if not path.is_absolute(shellname) then
+ if not path.is_absolute(program) then
for _, dir in ipairs(table.wrap(dirs)) do
-- the tool path
- local toolpath = path.join(dir, shellname)
+ local toolpath = path.join(dir, program)
if os.isexec(toolpath) then
-- check it
if tool._check(toolpath, check) then
- tool._CHECKINFO[shellname] = toolpath
+ tool._CHECKINFO[program] = toolpath
return toolpath
end
end
diff --git a/xmake/modules/devel/debugger/run.lua b/xmake/modules/devel/debugger/run.lua
index 417d104ed..1b71caafe 100644
--- a/xmake/modules/devel/debugger/run.lua
+++ b/xmake/modules/devel/debugger/run.lua
@@ -62,18 +62,18 @@ function _run_lldb(program, argv)
return false
end
- -- attempt to split shellname, .e.g xcrun -sdk macosx lldb
- local shellnames = lldb:split("%s")
+ -- attempt to split name, .e.g xcrun -sdk macosx lldb
+ local names = lldb:split("%s")
-- patch arguments
argv = argv or {}
table.insert(argv, 1, program)
- for i = #shellnames, 2, -1 do
- table.insert(argv, 1, shellnames[i])
+ for i = #names, 2, -1 do
+ table.insert(argv, 1, names[i])
end
-- run it
- os.execv(shellnames[1], argv)
+ os.execv(names[1], argv)
-- ok
return true
diff --git a/xmake/plugins/project/makefile/makefile.lua b/xmake/plugins/project/makefile/makefile.lua
index 2df00a4a9..dadaaba1c 100644
--- a/xmake/plugins/project/makefile/makefile.lua
+++ b/xmake/plugins/project/makefile/makefile.lua
@@ -23,11 +23,11 @@
--
-- imports
-import("core.tool.tool")
import("core.tool.compiler")
import("core.project.config")
import("core.project.project")
import("core.language.language")
+import("core.platform.platform")
-- get log makefile
function _logfile()
@@ -99,8 +99,8 @@ function _make_object(makefile, target, sourcefile, objectfile)
return _make_object_for_static(makefile, target, sourcefile, objectfile)
end
- -- get shellname name
- local shellname = tool.shellname(sourcekind)
+ -- get program
+ local program = platform.tool(sourcekind)
-- get complier flags
local compflags = compiler.compflags(sourcefile, target, sourcekind)
@@ -114,8 +114,8 @@ function _make_object(makefile, target, sourcefile, objectfile)
command = format("%s$(%s_%s)%s", command:sub(1, p - 1), target:name(), sourcekind:upper(), command:sub(e + 1))
end
- -- replace shellname to $(XX)
- p, e = command:find(shellname, 1, true)
+ -- replace program to $(XX)
+ p, e = command:find(program, 1, true)
if p then
command = format("%s$(%s)%s", command:sub(1, p - 1), sourcekind:upper(), command:sub(e + 1))
end
@@ -160,8 +160,8 @@ function _make_single_object(makefile, target, sourcekind, sourcebatch)
local objectfiles = sourcebatch.objectfiles
local incdepfiles = sourcebatch.incdepfiles
- -- get shellname name
- local shellname = tool.shellname(sourcekind)
+ -- get program
+ local program = platform.tool(sourcekind)
-- get complier flags
local compflags = compiler.compflags(sourcefiles, target, sourcekind)
@@ -175,8 +175,8 @@ function _make_single_object(makefile, target, sourcekind, sourcebatch)
command = format("%s$(%s_%s)%s", command:sub(1, p - 1), target:name(), sourcekind:upper(), command:sub(e + 1))
end
- -- replace shellname to $(XX)
- p, e = command:find(shellname, 1, true)
+ -- replace program to $(XX)
+ p, e = command:find(program, 1, true)
if p then
command = format("%s$(%s)%s", command:sub(1, p - 1), sourcekind:upper(), command:sub(e + 1))
end
@@ -250,8 +250,8 @@ function _make_target(makefile, target)
-- get linker kind
local linkerkind = target:linker():get("kind")
- -- get shellname
- local shellname = tool.shellname(linkerkind)
+ -- get program
+ local program = platform.tool(linkerkind)
-- get command
local command = target:linkcmd()
@@ -262,8 +262,8 @@ function _make_target(makefile, target)
command = format("%s$(%s_%s)%s", command:sub(1, p - 1), target:name(), (linkerkind:upper():gsub('%-', '_')), command:sub(e + 1))
end
- -- replace shellname to $(XX)
- p, e = command:find(shellname, 1, true)
+ -- replace program to $(XX)
+ p, e = command:find(program, 1, true)
if p then
command = format("%s$(%s)%s", command:sub(1, p - 1), (linkerkind:upper():gsub('%-', '_')), command:sub(e + 1))
end
@@ -322,9 +322,9 @@ function _make_all(makefile)
-- make variables for source kinds
for sourcekind, _ in pairs(language.sourcekinds()) do
- local shellname = tool.shellname(sourcekind)
- if shellname and shellname ~= "" then
- makefile:print("%s=%s", sourcekind:upper(), shellname)
+ local program = platform.tool(sourcekind)
+ if program and program ~= "" then
+ makefile:print("%s=%s", sourcekind:upper(), program)
end
end
makefile:print("")
@@ -335,9 +335,9 @@ function _make_all(makefile)
table.join2(linkerkinds, _linkerkinds)
end
for _, linkerkind in ipairs(table.unique(linkerkinds)) do
- local shellname = tool.shellname(linkerkind)
- if shellname and shellname ~= "" then
- makefile:print("%s=%s", (linkerkind:upper():gsub('%-', '_')), shellname)
+ local program = platform.tool(linkerkind)
+ if program and program ~= "" then
+ makefile:print("%s=%s", (linkerkind:upper():gsub('%-', '_')), program)
end
end
makefile:print("")
diff --git a/xmake/tools/ar.lua b/xmake/tools/ar.lua
index e870aa866..5a0625dfd 100644
--- a/xmake/tools/ar.lua
+++ b/xmake/tools/ar.lua
@@ -26,10 +26,10 @@
import("core.tool.compiler")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- save the shell name
- _g.shellname = shellname or "ar"
+ _g.program = program or "ar"
-- save the tool kind
_g.kind = kind or "ar"
@@ -67,7 +67,7 @@ function linkcmd(objectfiles, targetkind, targetfile, flags)
assert(targetkind == "static")
-- make it
- return format("%s %s %s %s", _g.shellname, flags, targetfile, objectfiles)
+ return format("%s %s %s %s", _g.program, flags, targetfile, objectfiles)
end
-- link the library file
@@ -96,11 +96,11 @@ function extract(libraryfile, objectdir)
local olddir = os.cd(objectdir)
-- extract it
- os.run("%s -x %s", _g.shellname, libraryfile)
+ os.run("%s -x %s", _g.program, libraryfile)
-- check repeat object name
local repeats = {}
- local objectfiles = os.iorun("%s -t %s", _g.shellname, libraryfile)
+ local objectfiles = os.iorun("%s -t %s", _g.program, libraryfile)
for _, objectfile in ipairs(objectfiles:split('\n')) do
if repeats[objectfile] then
raise("object name(%s) conflicts in library: %s", objectfile, libraryfile)
diff --git a/xmake/tools/cl.lua b/xmake/tools/cl.lua
index 7781d619d..519451800 100644
--- a/xmake/tools/cl.lua
+++ b/xmake/tools/cl.lua
@@ -26,10 +26,10 @@
import("core.project.project")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- save the shell name
- _g.shellname = shellname or "cl.exe"
+ _g.program = program or "cl.exe"
-- save kind
_g.kind = kind
@@ -231,7 +231,7 @@ end
function _compcmd1(sourcefile, objectfile, flags)
-- make it
- return format("%s -c %s -Fo%s %s", _g.shellname, flags, objectfile, sourcefile)
+ return format("%s -c %s -Fo%s %s", _g.program, flags, objectfile, sourcefile)
end
-- complie the source file
@@ -327,7 +327,7 @@ function check(flags)
io.writefile(sourcefile, "int main(int argc, char** argv)\n{return 0;}")
-- check it
- os.run("%s -c %s -Fo%s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
+ os.run("%s -c %s -Fo%s %s", _g.program, ifelse(flags, flags, ""), objectfile, sourcefile)
-- remove files
os.rm(objectfile)
diff --git a/xmake/tools/clang.lua b/xmake/tools/clang.lua
index c49fb1b02..e93533f1f 100644
--- a/xmake/tools/clang.lua
+++ b/xmake/tools/clang.lua
@@ -26,10 +26,10 @@
inherit("gcc")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- init super
- _super.init(shellname or "clang", kind)
+ _super.init(program or "clang", kind)
-- init shflags
_super._g.shflags = { "-dynamiclib", "-fPIC" }
diff --git a/xmake/tools/clangxx.lua b/xmake/tools/clangxx.lua
index b9545995d..b32061f75 100644
--- a/xmake/tools/clangxx.lua
+++ b/xmake/tools/clangxx.lua
@@ -26,10 +26,10 @@
inherit("clang")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- init super
- _super.init(shellname or "clang++", kind)
+ _super.init(program or "clang++", kind)
end
diff --git a/xmake/tools/dmd.lua b/xmake/tools/dmd.lua
index bd6b67379..620cddb9d 100644
--- a/xmake/tools/dmd.lua
+++ b/xmake/tools/dmd.lua
@@ -23,16 +23,15 @@
--
-- imports
-import("core.tool.tool")
import("core.base.option")
import("core.project.config")
import("core.project.project")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- save the shell name
- _g.shellname = shellname or "dmd"
+ _g.program = program or "dmd"
-- save the kind
_g.kind = kind
@@ -184,7 +183,7 @@ end
function linkcmd(objectfiles, targetkind, targetfile, flags)
-- make it
- return format("%s %s -of%s %s", _g.shellname, flags, targetfile, objectfiles)
+ return format("%s %s -of%s %s", _g.program, flags, targetfile, objectfiles)
end
-- link the target file
@@ -201,7 +200,7 @@ end
function compcmd(sourcefiles, objectfile, flags)
-- make it
- return format("%s -c %s -of%s %s", _g.shellname, flags, objectfile, table.concat(table.wrap(sourcefiles), " "))
+ return format("%s -c %s -of%s %s", _g.program, flags, objectfile, table.concat(table.wrap(sourcefiles), " "))
end
-- complie the source file
@@ -227,9 +226,9 @@ function check(flags, trylink)
-- check it, need check compflags and linkflags
if trylink then
- os.run("%s %s -of%s %s", _g.shellname, ifelse(flags, flags, ""), binaryfile, sourcefile)
+ os.run("%s %s -of%s %s", _g.program, ifelse(flags, flags, ""), binaryfile, sourcefile)
else
- os.run("%s -c %s -of%s %s", _g.shellname, ifelse(flags, flags, ""), binaryfile, sourcefile)
+ os.run("%s -c %s -of%s %s", _g.program, ifelse(flags, flags, ""), binaryfile, sourcefile)
end
-- remove files
diff --git a/xmake/tools/gcc.lua b/xmake/tools/gcc.lua
index 7044916aa..ffe73c0e9 100644
--- a/xmake/tools/gcc.lua
+++ b/xmake/tools/gcc.lua
@@ -23,17 +23,16 @@
--
-- imports
-import("core.tool.tool")
import("core.base.option")
import("core.project.config")
import("core.project.project")
import("detect.tools.find_ccache")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- save the shell name
- _g.shellname = shellname or "gcc"
+ _g.program = program or "gcc"
-- save the kind
_g.kind = kind
@@ -281,7 +280,7 @@ end
function linkcmd(objectfiles, targetkind, targetfile, flags)
-- make it
- return format("%s -o %s %s %s", _g.shellname, targetfile, objectfiles, flags)
+ return format("%s -o %s %s %s", _g.program, targetfile, objectfiles, flags)
end
-- link the target file
@@ -304,7 +303,7 @@ function _compcmd1(sourcefile, objectfile, flags)
end
-- make it
- local command = format("%s -c %s -o %s %s", _g.shellname, flags, objectfile, sourcefile)
+ local command = format("%s -c %s -o %s %s", _g.program, flags, objectfile, sourcefile)
if ccache then
command = ccache:append(command, " ")
end
@@ -353,7 +352,7 @@ function _compile1(sourcefile, objectfile, incdepfile, flags)
local tmpfile = os.tmpfile()
-- generate it
- os.run("%s -c -MM %s -o %s %s", _g.shellname, flags or "", tmpfile, sourcefile)
+ os.run("%s -c -MM %s -o %s %s", _g.program, flags or "", tmpfile, sourcefile)
-- translate it
local results = {}
@@ -407,9 +406,9 @@ function check(flags, trylink)
-- check it, need check compflags and linkflags
if trylink then
- os.run("%s %s -o %s %s", _g.shellname, ifelse(flags, flags, ""), binaryfile, sourcefile)
+ os.run("%s %s -o %s %s", _g.program, ifelse(flags, flags, ""), binaryfile, sourcefile)
else
- os.run("%s -c %s -o %s %s", _g.shellname, ifelse(flags, flags, ""), binaryfile, sourcefile)
+ os.run("%s -c %s -o %s %s", _g.program, ifelse(flags, flags, ""), binaryfile, sourcefile)
end
-- remove files
diff --git a/xmake/tools/gccgo.lua b/xmake/tools/gccgo.lua
index 1254130d4..997820c96 100644
--- a/xmake/tools/gccgo.lua
+++ b/xmake/tools/gccgo.lua
@@ -26,10 +26,10 @@
inherit("gcc")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- init super
- _super.init(shellname or "gccgo", kind)
+ _super.init(program or "gccgo", kind)
end
-- check the given flags
@@ -43,7 +43,7 @@ function check(flags)
io.writefile(sourcefile, "package main\nfunc main() {\n}")
-- check it
- os.run("%s -c %s -o %s %s", _super._g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
+ os.run("%s -c %s -o %s %s", _super._g.program, ifelse(flags, flags, ""), objectfile, sourcefile)
-- remove files
os.rm(objectfile)
diff --git a/xmake/tools/gdc.lua b/xmake/tools/gdc.lua
index 64b36c2b9..70f1cc807 100644
--- a/xmake/tools/gdc.lua
+++ b/xmake/tools/gdc.lua
@@ -26,10 +26,10 @@
inherit("dmd")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- init super
- _super.init(shellname or "gdc", kind)
+ _super.init(program or "gdc", kind)
end
diff --git a/xmake/tools/go.lua b/xmake/tools/go.lua
index 472ff84ff..dc0e80f93 100644
--- a/xmake/tools/go.lua
+++ b/xmake/tools/go.lua
@@ -23,16 +23,15 @@
--
-- imports
-import("core.tool.tool")
import("core.base.option")
import("core.project.config")
import("core.project.project")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- save the shell name
- _g.shellname = shellname or "go"
+ _g.program = program or "go"
-- save the kind
_g.kind = kind
@@ -128,9 +127,9 @@ function linkcmd(objectfiles, targetkind, targetfile, flags)
-- make it
if targetkind == "static" then
- return format("%s tool pack %s %s %s", _g.shellname, flags, targetfile, objectfiles)
+ return format("%s tool pack %s %s %s", _g.program, flags, targetfile, objectfiles)
else
- return format("%s tool link %s -o %s %s", _g.shellname, flags, targetfile, objectfiles)
+ return format("%s tool link %s -o %s %s", _g.program, flags, targetfile, objectfiles)
end
end
@@ -148,7 +147,7 @@ end
function compcmd(sourcefiles, objectfile, flags)
-- make it
- return format("%s tool compile %s -o %s %s", _g.shellname, flags, objectfile, table.concat(table.wrap(sourcefiles), " "))
+ return format("%s tool compile %s -o %s %s", _g.program, flags, objectfile, table.concat(table.wrap(sourcefiles), " "))
end
-- complie the source file
@@ -172,7 +171,7 @@ function check(flags)
io.writefile(sourcefile, "package main\nfunc main() {\n}")
-- check it
- os.run("%s tool compile %s -o %s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
+ os.run("%s tool compile %s -o %s %s", _g.program, ifelse(flags, flags, ""), objectfile, sourcefile)
-- remove files
os.rm(objectfile)
diff --git a/xmake/tools/gxx.lua b/xmake/tools/gxx.lua
index f37bdb05a..256b5270d 100644
--- a/xmake/tools/gxx.lua
+++ b/xmake/tools/gxx.lua
@@ -26,10 +26,10 @@
inherit("gcc")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- init super
- _super.init(shellname or "g++", kind)
+ _super.init(program or "g++", kind)
end
diff --git a/xmake/tools/ldc.lua b/xmake/tools/ldc.lua
index 531d319be..eb051fd3a 100644
--- a/xmake/tools/ldc.lua
+++ b/xmake/tools/ldc.lua
@@ -26,10 +26,10 @@
inherit("dmd")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- init super
- _super.init(shellname or "ldc", kind)
+ _super.init(program or "ldc", kind)
-- init shflags
_super._g.shflags = { "-shared" }
diff --git a/xmake/tools/lib.lua b/xmake/tools/lib.lua
index 7b0a851e8..a59f7d713 100644
--- a/xmake/tools/lib.lua
+++ b/xmake/tools/lib.lua
@@ -23,10 +23,10 @@
--
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- save the shell name
- _g.shellname = shellname or "lib.exe"
+ _g.program = program or "lib.exe"
-- save the tool kind
_g.kind = kind
@@ -46,7 +46,7 @@ function extract(libraryfile, objectdir)
os.mkdir(objectdir)
-- list object files
- local objectfiles = os.iorun("%s -nologo -list %s", _g.shellname, libraryfile)
+ local objectfiles = os.iorun("%s -nologo -list %s", _g.program, libraryfile)
-- extrace all object files
for _, objectfile in ipairs(objectfiles:split('\n')) do
@@ -68,7 +68,7 @@ function extract(libraryfile, objectdir)
end
-- extract it
- os.run("%s -nologo -extract:%s -out:%s %s", _g.shellname, objectfile, outputfile, libraryfile)
+ os.run("%s -nologo -extract:%s -out:%s %s", _g.program, objectfile, outputfile, libraryfile)
end
end
end
@@ -85,7 +85,7 @@ function check(flags)
-- check it
os.run("cl -c -Fo%s %s", objfile, srcfile)
os.run("link -lib -out:%s %s", libfile, objfile)
- os.run("%s %s -list %s", _g.shellname, ifelse(flags, flags, ""), libfile)
+ os.run("%s %s -list %s", _g.program, ifelse(flags, flags, ""), libfile)
-- remove files
os.rm(objfile)
diff --git a/xmake/tools/link.lua b/xmake/tools/link.lua
index aa99377fb..c79d67a2a 100644
--- a/xmake/tools/link.lua
+++ b/xmake/tools/link.lua
@@ -26,10 +26,10 @@
import("core.project.config")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- save the shell name
- _g.shellname = shellname or "link.exe"
+ _g.program = program or "link.exe"
-- save the tool kind
_g.kind = kind
@@ -109,13 +109,13 @@ end
function linkcmd(objectfiles, targetkind, targetfile, flags)
-- make it
- local cmd = format("%s %s -out:%s %s", _g.shellname, flags, targetfile, objectfiles)
+ local cmd = format("%s %s -out:%s %s", _g.program, flags, targetfile, objectfiles)
-- too long?
if #cmd > 4096 then
local argfile = targetfile .. ".arg"
io.printf(argfile, "%s -out:%s %s", flags, targetfile, objectfiles)
- cmd = format("%s @%s", _g.shellname, argfile)
+ cmd = format("%s @%s", _g.program, argfile)
end
-- ok?
@@ -154,7 +154,7 @@ function check(flags)
-- check it
os.run("cl -c -Fo%s %s", objectfile, sourcefile)
- os.run("%s %s -out:%s %s", _g.shellname, ifelse(flags, flags, ""), binaryfile, objectfile)
+ os.run("%s %s -out:%s %s", _g.program, ifelse(flags, flags, ""), binaryfile, objectfile)
-- remove files
os.rm(objectfile)
diff --git a/xmake/tools/ml.lua b/xmake/tools/ml.lua
index d8ddaee29..709f81d58 100644
--- a/xmake/tools/ml.lua
+++ b/xmake/tools/ml.lua
@@ -23,16 +23,16 @@
--
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- save name
- _g.shellname = shellname or "ml.exe"
+ _g.program = program or "ml.exe"
-- save kind
_g.kind = kind
-- init asflags
- if _g.shellname:find("64") then
+ if _g.program:find("64") then
_g.asflags = { "-nologo"}
else
_g.asflags = { "-nologo", "-Gd"}
@@ -114,7 +114,7 @@ end
function _compcmd1(sourcefile, objectfile, flags)
-- make it
- return format("%s -c %s -Fo%s %s", _g.shellname, flags, objectfile, sourcefile)
+ return format("%s -c %s -Fo%s %s", _g.program, flags, objectfile, sourcefile)
end
-- complie the source file
@@ -155,7 +155,7 @@ function check(flags)
io.writefile(sourcefile, "end")
-- check it
- os.run("%s -c %s -Fo%s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
+ os.run("%s -c %s -Fo%s %s", _g.program, ifelse(flags, flags, ""), objectfile, sourcefile)
-- remove files
os.rm(objectfile)
diff --git a/xmake/tools/ml64.lua b/xmake/tools/ml64.lua
index be4bb0dc8..f21e5466e 100644
--- a/xmake/tools/ml64.lua
+++ b/xmake/tools/ml64.lua
@@ -26,7 +26,7 @@
inherit("ml")
-- init it
-function init(shellname, kind)
- _super.init(shellname or "ml64", kind)
+function init(program, kind)
+ _super.init(program or "ml64", kind)
end
diff --git a/xmake/tools/rc.lua b/xmake/tools/rc.lua
index eb2d5fa05..f64651d8c 100644
--- a/xmake/tools/rc.lua
+++ b/xmake/tools/rc.lua
@@ -27,10 +27,10 @@ import("core.base.option")
import("core.project.project")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- save the shell name
- _g.shellname = shellname or "rc.exe"
+ _g.program = program or "rc.exe"
-- save kind
_g.kind = kind
@@ -74,7 +74,7 @@ end
function _compcmd1(sourcefile, objectfile, flags)
-- make it
- return format("%s %s -Fo%s %s", _g.shellname, flags, objectfile, sourcefile)
+ return format("%s %s -Fo%s %s", _g.program, flags, objectfile, sourcefile)
end
-- complie the source file
@@ -140,7 +140,7 @@ function check(flags)
io.writefile(sourcefile, "#define RESID 1")
-- check it
- os.run("%s -fo%s %s", _g.shellname, objectfile, sourcefile)
+ os.run("%s -fo%s %s", _g.program, objectfile, sourcefile)
-- remove files
os.rm(objectfile)
diff --git a/xmake/tools/rustc.lua b/xmake/tools/rustc.lua
index 44e117d3f..df261545a 100644
--- a/xmake/tools/rustc.lua
+++ b/xmake/tools/rustc.lua
@@ -23,16 +23,15 @@
--
-- imports
-import("core.tool.tool")
import("core.base.option")
import("core.project.config")
import("core.project.project")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- save the shell name
- _g.shellname = shellname or "rustc"
+ _g.program = program or "rustc"
-- save the kind
_g.kind = kind
@@ -110,7 +109,7 @@ end
function buildcmd(sourcefiles, targetkind, targetfile, flags)
-- make it
- return format("%s %s -o %s %s", _g.shellname, flags, targetfile, table.concat(sourcefiles, " "))
+ return format("%s %s -o %s %s", _g.program, flags, targetfile, table.concat(sourcefiles, " "))
end
-- build the target file
@@ -127,7 +126,7 @@ end
function compcmd(sourcefiles, objectfile, flags)
-- make it
- return format("%s --emit obj %s -o %s %s", _g.shellname, flags, objectfile, table.concat(table.wrap(sourcefiles), " "))
+ return format("%s --emit obj %s -o %s %s", _g.program, flags, objectfile, table.concat(table.wrap(sourcefiles), " "))
end
-- complie the source file
@@ -151,7 +150,7 @@ function check(flags)
io.writefile(sourcefile, "fn main() {\n}")
-- check it
- os.run("%s --emit obj %s -o %s %s", _g.shellname, ifelse(flags, flags, ""), objectfile, sourcefile)
+ os.run("%s --emit obj %s -o %s %s", _g.program, ifelse(flags, flags, ""), objectfile, sourcefile)
-- remove files
os.rm(objectfile)
diff --git a/xmake/tools/swiftc.lua b/xmake/tools/swiftc.lua
index ebae6b28f..b740a49a9 100644
--- a/xmake/tools/swiftc.lua
+++ b/xmake/tools/swiftc.lua
@@ -23,15 +23,14 @@
--
-- imports
-import("core.tool.tool")
import("core.project.config")
import("detect.tools.find_ccache")
-- init it
-function init(shellname, kind)
+function init(program, kind)
-- save the shell name
- _g.shellname = shellname or "swiftc"
+ _g.program = program or "swiftc"
-- init kind
_g.kind = kind
@@ -205,7 +204,7 @@ end
function linkcmd(objectfiles, targetkind, targetfile, flags)
-- make it
- return format("%s -o %s %s %s", _g.shellname, targetfile, objectfiles, flags)
+ return format("%s -o %s %s %s", _g.program, targetfile, objectfiles, flags)
end
-- link the target file
@@ -228,7 +227,7 @@ function _compcmd1(sourcefile, objectfile, flags)
end
-- make it
- local command = format("%s -c %s -o %s %s", _g.shellname, flags, objectfile, sourcefile)
+ local command = format("%s -c %s -o %s %s", _g.program, flags, objectfile, sourcefile)
if ccache then
command = ccache:append(command, " ")
end
@@ -271,5 +270,5 @@ end
function check(flags)
-- check it
- os.run("%s -h", _g.shellname)
+ os.run("%s -h", _g.program)
end