From 83295bd3a1b27f844759aeadbbdc23f51e2f2d89 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 4 Jun 2015 15:23:45 +0800 Subject: move clang compiler and linker to tools --- xmake/scripts/base/makefile.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'xmake/scripts/base/makefile.lua') diff --git a/xmake/scripts/base/makefile.lua b/xmake/scripts/base/makefile.lua index 17ec4aeda..c3af02d05 100644 --- a/xmake/scripts/base/makefile.lua +++ b/xmake/scripts/base/makefile.lua @@ -31,8 +31,9 @@ local path = require("base/path") local utils = require("base/utils") local config = require("base/config") local project = require("base/project") +local linker = require("base/linker") +local compiler = require("base/compiler") local tools = require("tools/tools") -local platform = require("platform/platform") -- make the object to the makefile function makefile._make_object(file, target, srcfile, objfile) @@ -40,8 +41,8 @@ function makefile._make_object(file, target, srcfile, objfile) -- check assert(file and target and srcfile and objfile) - -- get the compiler and filetype - local c, filetype = platform.compiler(srcfile); + -- get the compiler + local c = compiler.get(srcfile); if not c then -- error utils.error("unknown source file: %s", srcfile) @@ -55,7 +56,7 @@ function makefile._make_object(file, target, srcfile, objfile) file:write(string.format(" %s\n", srcfile)) -- make body - local cmd = c:make(target, filetype, srcfile, objfile) + local cmd = compiler.make(c, target, srcfile, objfile) file:write(string.format("\t@echo [%s]: compiling %s\n", config.get("mode"), srcfile)) file:write(string.format("\t@xmake l $(VERBOSE) verbose \"%s\"\n", cmd:gsub("%s", "%%20"))) file:write(string.format("\t@xmake l mkdir %s\n", path.directory(objfile))) @@ -106,8 +107,8 @@ function makefile._make_target(file, name, target) local targetfile = rule.targetfile(name, target) assert(targetfile) - -- the linker - local l = platform.linker(target.kind) + -- get the linker from the given kind + local l = linker.get(target.kind) assert(l) -- make head @@ -130,7 +131,7 @@ function makefile._make_target(file, name, target) file:write("\n") -- make body - local cmd = l:make(target, objfiles, targetfile) + local cmd = linker.make(l, target, objfiles, targetfile) file:write(string.format("\t@echo [%s]: linking %s\n", config.get("mode"), path.filename(targetfile))) file:write(string.format("\t@xmake l $(VERBOSE) verbose \"%s\"\n", cmd:gsub("%s", "%%20"))) file:write(string.format("\t@xmake l mkdir %s\n", path.directory(targetfile))) -- cgit v1.3.1