summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-03-18 20:05:25 +0800
committerruki <[email protected]>2016-03-18 20:05:25 +0800
commit7a67767e0df44d9ef02daab981f7e300c627b95d (patch)
tree0b85d57e2658a84d36910270f0023249d38cf6bf
parent7ff5704f835df20b79db4f672204df9a562058aa (diff)
add target
-rw-r--r--xmake/core/project/project.lua6
-rw-r--r--xmake/core/project/target.lua43
2 files changed, 46 insertions, 3 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 0f7898594..c6aa99f42 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -32,7 +32,7 @@ local table = require("base/table")
local option = require("base/option")
local filter = require("base/filter")
local interpreter = require("base/interpreter")
-local rule = require("project/rule")
+local target = require("project/target")
local config = require("project/config")
local deprecated_project = require("project/deprecated/project")
local linker = require("platform/linker")
@@ -686,10 +686,10 @@ function project._make_options(options)
local cxxfile = os.tmpdir() .. "/__checking.cpp"
-- the object file path
- local objectfile = os.tmpdir() .. "/" .. rule.filename("__checking", "object")
+ local objectfile = os.tmpdir() .. "/" .. target.filename("__checking", "object")
-- the target file path
- local targetfile = os.tmpdir() .. "/" .. rule.filename("__checking", "binary")
+ local targetfile = os.tmpdir() .. "/" .. target.filename("__checking", "binary")
-- make all options
for k, v in pairs(options) do
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
new file mode 100644
index 000000000..a1fcda511
--- /dev/null
+++ b/xmake/core/project/target.lua
@@ -0,0 +1,43 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2015 - 2016, ruki All rights reserved.
+--
+-- @author ruki
+-- @file target.lua
+--
+
+-- define module
+local target = target or {}
+
+-- load modules
+local platform = require("platform/platform")
+
+-- get the filename from the given name and kind
+function target.filename(name, kind)
+
+ -- check
+ assert(name and kind)
+
+ -- get format
+ local format = platform.format(kind) or {"", ""}
+
+ -- make it
+ return format[1] .. name .. format[2]
+end
+
+-- return module
+return target