From 7a67767e0df44d9ef02daab981f7e300c627b95d Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 18 Mar 2016 20:05:25 +0800 Subject: add target --- xmake/core/project/project.lua | 6 +++--- xmake/core/project/target.lua | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 xmake/core/project/target.lua 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 http://www.gnu.org/licenses/ +-- +-- 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 -- cgit v1.3.1