summaryrefslogtreecommitdiff
path: root/xmake/core
diff options
context:
space:
mode:
authorruki <[email protected]>2017-02-21 23:32:31 +0800
committerruki <[email protected]>2017-02-21 23:32:31 +0800
commitc3d883feee28fd29cfdde759f7a5252049bc6d1e (patch)
treec1b4e3a1768533c346d4b4a6b9ab08fa5324b5ec /xmake/core
parentfb6033c52082b69041783dc23a8d5b07f9bf007a (diff)
modify flags
Diffstat (limited to 'xmake/core')
-rw-r--r--xmake/core/tool/builder.lua4
-rw-r--r--xmake/core/tool/linker.lua9
2 files changed, 10 insertions, 3 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index f1335df68..9fdb76ce1 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -156,8 +156,10 @@ end
function builder:_addflags_from_platform(flags)
-- add flags
+ local toolkind = self:get("kind")
for _, flagkind in ipairs(self:_flagkinds()) do
- table.join2(flags, platform.get(flagkind))
+ -- attempt to add special lanugage flags first, .e.g go-ldflags, dc-arflags
+ table.join2(flags, platform.get(toolkind .. 'flags') or platform.get(flagkind))
end
end
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua
index d438eb54a..7b9afdbbe 100644
--- a/xmake/core/tool/linker.lua
+++ b/xmake/core/tool/linker.lua
@@ -45,13 +45,15 @@ function linker:_addflags_from_compiler(flags, sourcekinds)
-- make flags
local flags_of_compiler = {}
+ local toolkind = self:get("kind")
for _, sourcekind in ipairs(table.wrap(sourcekinds)) do
-- load compiler
local instance, errors = compiler.load(sourcekind)
if instance then
for _, flagkind in ipairs(self:_flagkinds()) do
- table.join2(flags_of_compiler, instance:get(flagkind))
+ -- attempt to add special lanugage flags first, .e.g go-ldflags, dc-arflags
+ table.join2(flags_of_compiler, instance:get(toolkind .. 'flags') or instance:get(flagkind))
end
end
end
@@ -64,8 +66,11 @@ end
function linker:_addflags_from_linker(flags)
-- add flags
+ local toolkind = self:get("kind")
for _, flagkind in ipairs(self:_flagkinds()) do
- table.join2(flags, self:get(flagkind))
+
+ -- attempt to add special lanugage flags first, .e.g go-ldflags, dc-arflags
+ table.join2(flags, self:get(toolkind .. 'flags') or self:get(flagkind))
end
end