summaryrefslogtreecommitdiff
path: root/xmake/scripts/base/config.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-05-18 13:05:14 +0800
committerruki <[email protected]>2015-05-18 13:05:14 +0800
commitf1de3034b9afbb88f83501730bf27c31078818ed (patch)
tree88a2c43f6521628df368071d44c861eb826636f4 /xmake/scripts/base/config.lua
parent3f53e1ea0f6c9deff5295e689df141feba9cce4c (diff)
build makefile
Diffstat (limited to 'xmake/scripts/base/config.lua')
-rw-r--r--xmake/scripts/base/config.lua28
1 files changed, 19 insertions, 9 deletions
diff --git a/xmake/scripts/base/config.lua b/xmake/scripts/base/config.lua
index 31fb4dd81..6ea64b372 100644
--- a/xmake/scripts/base/config.lua
+++ b/xmake/scripts/base/config.lua
@@ -140,13 +140,9 @@ function config._save(file, object)
return config._save_with_level(file, object, 0)
end
--- get the current target scope
-function config.getarget()
-
- -- check
- local configs = config._CONFIGS
- assert(configs)
-
+-- get the current target name
+function config.target_name()
+
-- the options
local options = xmake._OPTIONS
assert(options)
@@ -155,6 +151,20 @@ function config.getarget()
local name = options.target or options._DEFAULTS.target
assert(name and type(name) == "string")
+ -- ok
+ return name
+end
+
+-- get the current target scope
+function config.target()
+
+ -- check
+ local configs = config._CONFIGS
+ assert(configs)
+
+ -- the target name
+ local name = config.target_name()
+
-- for all targets?
if name == "all" then
return configs
@@ -232,7 +242,7 @@ function config.loadxconf()
config._CONFIGS = newenv._CONFIGS
-- clear configs if the host environment has been changed
- local target = config.getarget()
+ local target = config.target()
if target and target.host ~= xmake._HOST then
config._CONFIGS = {}
end
@@ -257,7 +267,7 @@ function config.loadxconf()
end
-- get the current target scope
- local target = config.getarget()
+ local target = config.target()
assert(target and type(target) == "table")
-- merge xmake._OPTIONS to target