summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2015-07-14 18:24:36 +0800
committerruki <[email protected]>2015-07-14 18:24:36 +0800
commit928101a35f7ef42aa96ad76564b1e120066cbb14 (patch)
treef26503d6c2251dd65118e0503eabef4644e0a1e7
parent48b22f27376341ba8ad8e585bb5b257b50bde048 (diff)
fix mapping flags for compiler and linker
-rw-r--r--xmake/scripts/base/compiler.lua2
-rw-r--r--xmake/scripts/base/linker.lua2
-rw-r--r--xmake/scripts/platform/windows/tools/link.lua2
-rw-r--r--xmake/scripts/tools/gcc.lua6
4 files changed, 8 insertions, 4 deletions
diff --git a/xmake/scripts/base/compiler.lua b/xmake/scripts/base/compiler.lua
index 64b385a5c..5fa96b93e 100644
--- a/xmake/scripts/base/compiler.lua
+++ b/xmake/scripts/base/compiler.lua
@@ -48,7 +48,7 @@ function compiler._mapflag(module, flag)
-- find and replace it using pattern
for k, v in pairs(module.mapflags) do
- local flag_mapped, count = flag:gsub(k, function (w)
+ local flag_mapped, count = flag:gsub("^" .. k .. "$", function (w)
if type(v) == "function" then
return v(module, w)
else
diff --git a/xmake/scripts/base/linker.lua b/xmake/scripts/base/linker.lua
index 0f9ae1887..f8d2c81a8 100644
--- a/xmake/scripts/base/linker.lua
+++ b/xmake/scripts/base/linker.lua
@@ -45,7 +45,7 @@ function linker._mapflag(module, flag)
-- find and replace it using pattern
for k, v in pairs(module.mapflags) do
- local flag_mapped, count = flag:gsub(k, function (w)
+ local flag_mapped, count = flag:gsub("^" .. k .. "$", function (w)
if type(v) == "function" then
return v(module, w)
else
diff --git a/xmake/scripts/platform/windows/tools/link.lua b/xmake/scripts/platform/windows/tools/link.lua
index fe06721f2..84df08694 100644
--- a/xmake/scripts/platform/windows/tools/link.lua
+++ b/xmake/scripts/platform/windows/tools/link.lua
@@ -63,8 +63,6 @@ function link.init(self, name)
-- strip
["-s"] = ""
, ["-S"] = ""
- , ["--strip-all"] = ""
- , ["--strip-debug"] = ""
-- others
, ["-ftrapv"] = ""
diff --git a/xmake/scripts/tools/gcc.lua b/xmake/scripts/tools/gcc.lua
index 164dfae12..6f96e2f8b 100644
--- a/xmake/scripts/tools/gcc.lua
+++ b/xmake/scripts/tools/gcc.lua
@@ -77,7 +77,9 @@ function gcc.init(self, name)
end
-- suppress warning for the clang
+ local isclang = false
if name:find("clang") then
+ isclang = true
self.cxflags = self.cxflags or {}
self.mxflags = self.mxflags or {}
self.asflags = self.asflags or {}
@@ -104,6 +106,10 @@ function gcc.init(self, name)
, ["-W2"] = "-Wall"
, ["-W3"] = "-Wall"
+ -- strip
+ , ["-s"] = utils.ifelse(isclang, "-S", "-s")
+ , ["-S"] = "-S"
+
-- others
, ["-ftrapv"] = self._check
, ["-fsanitize=address"] = self._check