summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/sdcc.lua
diff options
context:
space:
mode:
authorÂngelo Andrade Cirino <[email protected]>2022-01-10 10:23:17 -0300
committerÂngelo Andrade Cirino <[email protected]>2022-01-10 10:23:17 -0300
commited0c0c5e0249aa966ea7061b30710abdd0b09d87 (patch)
tree2a51c869a3aea1a093ed569e749bdf0465634a6c /xmake/modules/core/tools/sdcc.lua
parent885d00da8caf74aeed758d030b9a1b50d9078e1f (diff)
parent2431dd7e6142ff98b55741cfd4de4d2e69f4f8b5 (diff)
Merged from upstream/master
Diffstat (limited to 'xmake/modules/core/tools/sdcc.lua')
-rw-r--r--xmake/modules/core/tools/sdcc.lua33
1 files changed, 16 insertions, 17 deletions
diff --git a/xmake/modules/core/tools/sdcc.lua b/xmake/modules/core/tools/sdcc.lua
index 00e081384..4605f12f8 100644
--- a/xmake/modules/core/tools/sdcc.lua
+++ b/xmake/modules/core/tools/sdcc.lua
@@ -21,7 +21,7 @@
-- imports
import("core.base.option")
import("core.base.global")
-import("private.utils.progress")
+import("utils.progress")
-- init it
function init(self)
@@ -68,23 +68,17 @@ end
-- make the warning flag
function nf_warning(self, level)
-
- -- the maps
local maps =
{
none = "--less-pedantic"
, less = "--less-pedantic"
, error = "-Werror"
}
-
- -- make it
return maps[level]
end
-- make the optimize flag
function nf_optimize(self, level)
-
- -- the maps
local maps =
{
none = ""
@@ -94,19 +88,14 @@ function nf_optimize(self, level)
, smallest = "--opt-code-size"
, aggressive = "--opt-code-speed"
}
-
- -- make it
return maps[level]
end
-- make the language flag
function nf_language(self, stdname)
-
- -- the stdc maps
if _g.cmaps == nil then
_g.cmaps =
{
- -- stdc
ansi = "--std-c89"
, c89 = "--std-c89"
, gnu89 = "--std-sdcc89"
@@ -116,9 +105,23 @@ function nf_language(self, stdname)
, gnu11 = "--std-sdcc11"
, c20 = "--std-c2x"
, gnu20 = "--std-sdcc2x"
+ , clatest = {"--std-c2x", "--std-c11", "--std-c99", "--std-c89"}
+ , gnulatest = {"--std-sdcc2x", "--std-sdcc11", "--std-sdcc99", "--std-sdcc89"}
}
end
- return _g.cmaps[stdname]
+ local maps = _g.cmaps
+ local result = maps[stdname]
+ if type(result) == "table" then
+ for _, v in ipairs(result) do
+ if self:has_flags(v, "cxflags") then
+ result = v
+ maps[stdname] = result
+ return result
+ end
+ end
+ else
+ return result
+ end
end
-- make the define flag
@@ -163,11 +166,7 @@ end
-- link the target file
function link(self, objectfiles, targetkind, targetfile, flags)
-
- -- ensure the target directory
os.mkdir(path.directory(targetfile))
-
- -- link it
os.runv(linkargv(self, objectfiles, targetkind, targetfile, flags))
end