diff options
| author | ruki <[email protected]> | 2017-07-11 14:51:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-07-11 14:51:52 +0800 |
| commit | 410a36dad68dc1f0b2ac9c12d861af7ab8d0b1d6 (patch) | |
| tree | e33e94caea84d3a170f6dd86c36ac2e4adbd6687 /xmake/modules/core/tools | |
| parent | 03420ca44581f299a48935ca60af4824575cd9c1 (diff) | |
rename has_flag to has_flags
Diffstat (limited to 'xmake/modules/core/tools')
| -rw-r--r-- | xmake/modules/core/tools/ar.lua | 10 | ||||
| -rw-r--r-- | xmake/modules/core/tools/cl.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/clang.lua | 8 | ||||
| -rw-r--r-- | xmake/modules/core/tools/dmd.lua | 28 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 68 | ||||
| -rw-r--r-- | xmake/modules/core/tools/go.lua | 26 | ||||
| -rw-r--r-- | xmake/modules/core/tools/lib.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/ml.lua | 14 | ||||
| -rw-r--r-- | xmake/modules/core/tools/rc.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/rustc.lua | 21 | ||||
| -rw-r--r-- | xmake/modules/core/tools/swiftc.lua | 8 |
11 files changed, 87 insertions, 102 deletions
diff --git a/xmake/modules/core/tools/ar.lua b/xmake/modules/core/tools/ar.lua index 9d7ddabeb..bce088fc3 100644 --- a/xmake/modules/core/tools/ar.lua +++ b/xmake/modules/core/tools/ar.lua @@ -27,15 +27,11 @@ import("core.tool.compiler") -- init it function init(self) - - -- init arflags _g.arflags = { "-cr" } end -- get the property function get(self, name) - - -- get it return _g[name] end @@ -45,12 +41,12 @@ function strip(self, level) -- the maps local maps = { - debug = "-S" - , all = "-s" + debug = "-S" + , all = "-s" } -- make it - return maps[level] or "" + return maps[level] end -- make the link command diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index b55948ecd..a28e08589 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -188,7 +188,7 @@ end -- make the define flag function nf_define(self, macro) - return "-D" .. macro:gsub("\"", "\\\"") + return "-D" .. macro end -- make the undefine flag diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index f391b101e..7da8dd858 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -48,12 +48,12 @@ end function nf_strip(self, level) -- the maps - local maps = + local maps = { - debug = "-Wl,-S" - , all = "-Wl,-S" + debug = "-Wl,-S" + , all = "-Wl,-S" } -- make it - return maps[level] or "" + return maps[level] end diff --git a/xmake/modules/core/tools/dmd.lua b/xmake/modules/core/tools/dmd.lua index 02178577e..45f915afc 100644 --- a/xmake/modules/core/tools/dmd.lua +++ b/xmake/modules/core/tools/dmd.lua @@ -58,16 +58,15 @@ function nf_optimize(self, level) -- the maps local maps = { - none = "" - , fast = "-O" - , faster = "-O -release" - , fastest = "-O -release -inline -boundscheck=off" - , smallest = "-O -release -boundscheck=off" - , aggressive = "-O -release -inline -boundscheck=off" + , fast = {"-O"} + , faster = {"-O", "-release"} + , fastest = {"-O", "-release", "-inline", "-boundscheck=off"} + , smallest = {"-O", "-release", "-boundscheck=off"} + , aggressive = {"-O", "-release", "-inline", "-boundscheck=off"} } -- make it - return maps[level] or "" + return maps[level] end -- make the strip flag @@ -81,7 +80,7 @@ function nf_strip(self, level) } -- make it - return maps[level] or "" + return maps[level] end -- make the symbol flag @@ -90,12 +89,11 @@ function nf_symbol(self, level) -- the maps local maps = { - debug = "-g -debug" - , hidden = "" + debug = {"-g", "-debug"} } -- make it - return maps[level] or "" + return maps[level] end -- make the warning flag @@ -106,13 +104,13 @@ function nf_warning(self, level) { none = "-d" , less = "-w" - , more = "-w -wi" - , all = "-w -wi" + , more = {"-w", "-wi"} + , all = {"-w", "-wi"} , error = "-de" } -- make it - return maps[level] or "" + return maps[level] end -- make the vector extension flag @@ -126,7 +124,7 @@ function nf_vectorext(self, extension) } -- make it - return maps[extension] or "" + return maps[extension] end -- make the includedir flag diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 1bfcb6db9..62d41abc3 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -35,9 +35,9 @@ function init(self) _g.mxflags = { "-fmessage-length=0" , "-pipe" , "-fpascal-strings" - , "\"-DIBOutlet=__attribute__((iboutlet))\"" - , "\"-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))\"" - , "\"-DIBAction=void)__attribute__((ibaction)\""} + , "-DIBOutlet=__attribute__((iboutlet))" + , "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" + , "-DIBAction=void)__attribute__((ibaction)"} -- init shflags _g.shflags = { "-shared", "-fPIC" } @@ -86,12 +86,12 @@ function nf_strip(self, level) -- the maps local maps = { - debug = "-S" - , all = "-s" + debug = "-S" + , all = "-s" } -- make it - return maps[level] or "" + return maps[level] end -- make the symbol flag @@ -100,12 +100,12 @@ function nf_symbol(self, level) -- the maps local maps = { - debug = "-g" - , hidden = "-fvisibility=hidden" + debug = "-g" + , hidden = "-fvisibility=hidden" } -- make it - return maps[level] or "" + return maps[level] end -- make the warning flag @@ -114,15 +114,15 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-w" - , less = "-W1" - , more = "-W3" - , all = "-Wall" - , error = "-Werror" + none = "-w" + , less = "-W1" + , more = "-W3" + , all = "-Wall" + , error = "-Werror" } -- make it - return maps[level] or "" + return maps[level] end -- make the optimize flag @@ -131,16 +131,16 @@ function nf_optimize(self, level) -- the maps local maps = { - none = "-O0" - , fast = "-O1" - , faster = "-O2" - , fastest = "-O3" - , smallest = "-Os" - , aggressive = "-Ofast" + none = "-O0" + , fast = "-O1" + , faster = "-O2" + , fastest = "-O3" + , smallest = "-Os" + , aggressive = "-Ofast" } -- make it - return maps[level] or "" + return maps[level] end -- make the vector extension flag @@ -149,18 +149,18 @@ function nf_vectorext(self, extension) -- the maps local maps = { - mmx = "-mmmx" - , sse = "-msse" - , sse2 = "-msse2" - , sse3 = "-msse3" - , ssse3 = "-mssse3" - , avx = "-mavx" - , avx2 = "-mavx2" - , neon = "-mfpu=neon" + mmx = "-mmmx" + , sse = "-msse" + , sse2 = "-msse2" + , sse3 = "-msse3" + , ssse3 = "-mssse3" + , avx = "-mavx" + , avx2 = "-mavx2" + , neon = "-mfpu=neon" } -- make it - return maps[extension] or "" + return maps[extension] end -- make the language flag @@ -203,12 +203,12 @@ function nf_language(self, stdname) end -- make it - return maps[stdname] or "" + return maps[stdname] end -- make the define flag function nf_define(self, macro) - return "-D" .. macro:gsub("\"", "\\\"") + return "-D" .. macro end -- make the undefine flag @@ -240,7 +240,7 @@ end -- make the framework flag function nf_framework(self, framework) - return "-framework " .. framework + return {"-framework", framework} end -- make the link command diff --git a/xmake/modules/core/tools/go.lua b/xmake/modules/core/tools/go.lua index a3b49c8c4..46b434e58 100644 --- a/xmake/modules/core/tools/go.lua +++ b/xmake/modules/core/tools/go.lua @@ -55,16 +55,11 @@ function nf_optimize(self, level) -- the maps local maps = { - none = "-N" - , fast = "" - , faster = "" - , fastest = "" - , smallest = "" - , aggressive = "" + none = "-N" } -- make it - return maps[level] or "" + return maps[level] end -- make the symbol flag @@ -72,18 +67,17 @@ function nf_symbol(self, level, target, mapkind) -- only for compiler if mapkind ~= "object" then - return "" + return end -- the maps local maps = { - debug = "-E" - , hidden = "" + debug = "-E" } -- make it - return maps[level] or "" + return maps[level] end -- make the strip flag @@ -92,22 +86,22 @@ function nf_strip(self, level) -- the maps local maps = { - debug = "-s" - , all = "-s" + debug = "-s" + , all = "-s" } -- make it - return maps[level] or "" + return maps[level] end -- make the includedir flag function nf_includedir(self, dir) - return "-I " .. dir + return {"-I", dir} end -- make the linkdir flag function nf_linkdir(self, dir) - return "-L " .. dir + return {"-L", dir} end -- make the link command diff --git a/xmake/modules/core/tools/lib.lua b/xmake/modules/core/tools/lib.lua index a193b8788..b7d18b024 100644 --- a/xmake/modules/core/tools/lib.lua +++ b/xmake/modules/core/tools/lib.lua @@ -24,8 +24,6 @@ -- get the property function get(self, name) - - -- get it return _g[name] end diff --git a/xmake/modules/core/tools/ml.lua b/xmake/modules/core/tools/ml.lua index 74a8fc364..27343320e 100644 --- a/xmake/modules/core/tools/ml.lua +++ b/xmake/modules/core/tools/ml.lua @@ -70,20 +70,20 @@ function nf_warning(self, level) -- the maps local maps = { - none = "-w" - , less = "-W1" - , more = "-W3" - , all = "-W3" - , error = "-WX" + none = "-w" + , less = "-W1" + , more = "-W3" + , all = "-W3" + , error = "-WX" } -- make it - return maps[level] or "" + return maps[level] end -- make the define flag function nf_define(self, macro) - return "-D" .. macro:gsub("\"", "\\\"") + return "-D" .. macro end -- make the undefine flag diff --git a/xmake/modules/core/tools/rc.lua b/xmake/modules/core/tools/rc.lua index a76d7493d..75a679ddd 100644 --- a/xmake/modules/core/tools/rc.lua +++ b/xmake/modules/core/tools/rc.lua @@ -43,7 +43,7 @@ end -- make the define flag function nf_define(self, macro) - return "-d" .. macro:gsub("\"", "\\\"") + return "-d" .. macro end -- make the undefine flag diff --git a/xmake/modules/core/tools/rustc.lua b/xmake/modules/core/tools/rustc.lua index e480624d9..635d94e9c 100644 --- a/xmake/modules/core/tools/rustc.lua +++ b/xmake/modules/core/tools/rustc.lua @@ -64,16 +64,16 @@ function nf_optimize(self, level) -- the maps local maps = { - none = "-C opt-level=0" - , fast = "-C opt-level=1" - , faster = "-C opt-level=2" - , fastest = "-C opt-level=3" - , smallest = "-C opt-level=s" - , aggressive = "-C opt-level=z" + none = {"-C", "opt-level=0"} + , fast = {"-C", "opt-level=1"} + , faster = {"-C", "opt-level=2"} + , fastest = {"-C", "opt-level=3"} + , smallest = {"-C", "opt-level=s"} + , aggressive = {"-C", "opt-level=z"} } -- make it - return maps[level] or "" + return maps[level] end -- make the symbol flag @@ -82,17 +82,16 @@ function nf_symbol(self, level) -- the maps local maps = { - debug = "-C debuginfo=2" - , hidden = "" + debug = {"-C", "debuginfo=2"} } -- make it - return maps[level] or "" + return maps[level] end -- make the linkdir flag function nf_linkdir(self, dir) - return "-L " .. dir + return {"-L", dir} end -- make the build command diff --git a/xmake/modules/core/tools/swiftc.lua b/xmake/modules/core/tools/swiftc.lua index e1c18934e..c1b9aad93 100644 --- a/xmake/modules/core/tools/swiftc.lua +++ b/xmake/modules/core/tools/swiftc.lua @@ -152,22 +152,22 @@ end -- make the includedir flag function nf_includedir(self, dir) - return "-Xcc -I" .. dir + return {"-Xcc", "-I" .. dir} end -- make the define flag function nf_define(self, macro) - return "-Xcc -D" .. macro:gsub("\"", "\\\"") + return {"-Xcc", "-D" .. macro} end -- make the undefine flag function nf_undefine(self, macro) - return "-Xcc -U" .. macro + return {"-Xcc", "-U" .. macro} end -- make the framework flag function nf_framework(self, framework) - return "-framework" .. framework + return {"-framework", framework} end -- make the link flag |
