summaryrefslogtreecommitdiff
path: root/xmake/plugins/makefile/makefile.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-05-11 11:23:10 +0800
committerruki <[email protected]>2016-05-11 11:23:10 +0800
commit4b32ac0799e14663522b8b6c42c4343041342183 (patch)
tree72e71305480ff2717a6abc7794b759b936d708ee /xmake/plugins/makefile/makefile.lua
parente89130661686f0f3faf4ac87c989865b5fcc4823 (diff)
add environment
Diffstat (limited to 'xmake/plugins/makefile/makefile.lua')
-rwxr-xr-xxmake/plugins/makefile/makefile.lua27
1 files changed, 9 insertions, 18 deletions
diff --git a/xmake/plugins/makefile/makefile.lua b/xmake/plugins/makefile/makefile.lua
index 691d50816..2fe7ffd93 100755
--- a/xmake/plugins/makefile/makefile.lua
+++ b/xmake/plugins/makefile/makefile.lua
@@ -22,6 +22,8 @@
-- imports
import("core.tool.tool")
+import("core.tool.linker")
+import("core.tool.compiler")
import("core.project.project")
-- get log makefile
@@ -76,10 +78,9 @@ function _make_object(makefile, target, srcfile, objfile)
-- make command
local ccache = tool.shellname("ccache")
- local compiler = target:compiler(srcfile)
- local cmd = compiler:command(target, srcfile, objfile, _logfile())
+ local command = compiler.command(target, srcfile, objfile)
if ccache then
- cmd = ccache:append(cmd, " ")
+ command = ccache:append(command, " ")
end
-- make head
@@ -90,13 +91,12 @@ function _make_object(makefile, target, srcfile, objfile)
-- make body
makefile:print("\t@echo %scompiling.$(mode) %s", ifelse(ccache, "ccache ", ""), srcfile)
- makefile:print("\t@xmake l %$(VERBOSE) verbose \"%s\"", cmd:encode())
+ makefile:print("\t@xmake l %$(VERBOSE) verbose \"%s\"", command:encode())
makefile:print("\t@xmake l mkdir %s", path.directory(objfile))
- makefile:print("\t@%s", cmd)
+ makefile:print("\t@%s > %s 2>&1", command, _logfile())
-- make tail
makefile:print("")
-
end
-- make all objects of the given target
@@ -140,21 +140,13 @@ function _make_target(makefile, target)
makefile:print("")
-- make the command
- local linker = target:linker()
- local cmd = linker:command(target, objfiles, targetfile, _logfile())
-
- -- make the verbose info
- local verbose = cmd:encode()
- if verbose and #verbose > 256 then
- verbose = linker:command(target, target.filename("*", "object"), targetfile)
- verbose = verbose:encode()
- end
+ local command = linker.command(target)
-- make body
makefile:print("\t@echo linking.$(mode) %s", path.filename(targetfile))
- makefile:print("\t@xmake l %$(VERBOSE) verbose \"%s\"", verbose)
+ makefile:print("\t@xmake l %$(VERBOSE) verbose \"%s\"", command:encode())
makefile:print("\t@xmake l mkdir %s", path.directory(targetfile))
- makefile:print("\t@%s", cmd)
+ makefile:print("\t@%s > %s 2>&1", command, _logfile())
-- make headers
local srcheaders, dstheaders = target:headerfiles()
@@ -174,7 +166,6 @@ function _make_target(makefile, target)
-- make objects for this target
_make_objects(makefile, target, target:sourcefiles(), objfiles)
-
end
-- make all