summaryrefslogtreecommitdiff
path: root/xmake/scripts/base/makefile.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-12-05 10:04:47 +0800
committerruki <[email protected]>2015-12-05 10:04:47 +0800
commitb753c9e182813b395dd4910476ff4fb3c5e26fd9 (patch)
treee9233083762f24c2f988f4d31d7cec846d55bfb2 /xmake/scripts/base/makefile.lua
parent98a12249aff0eed41c11f31da54205dc876379bf (diff)
encode and decode string
Diffstat (limited to 'xmake/scripts/base/makefile.lua')
-rw-r--r--xmake/scripts/base/makefile.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/xmake/scripts/base/makefile.lua b/xmake/scripts/base/makefile.lua
index ec5557c23..3304d95f7 100644
--- a/xmake/scripts/base/makefile.lua
+++ b/xmake/scripts/base/makefile.lua
@@ -67,7 +67,7 @@ function makefile._make_object_for_object(file, target, srcfile, objfile)
-- make body
file:write(string.format("\t@echo inserting%s %s\n", mode, srcfile))
- file:write(string.format("\t@xmake l $(VERBOSE) verbose \"%s\"\n", cmd:gsub("[%s=\"]", function (w) return string.format("%%%x", w:byte()) end)))
+ file:write(string.format("\t@xmake l $(VERBOSE) verbose \"%s\"\n", cmd:encode()))
file:write(string.format("\t@%s\n", cmd))
-- make tail
@@ -112,7 +112,8 @@ function makefile._make_object_for_static(file, target, srcfile, objfile)
end
-- make command
- local cmd = string.format("xmake l dispatcher \"%s\" \"%s\" extract %s %s > %s 2>&1", toolname, toolpath, srcfile, objfile, makefile._LOGFILE)
+ local cmd = string.format("xmake l dispatcher %s %s extract %s %s > %s 2>&1", toolname:encode(), toolpath:encode(), srcfile:encode(), objfile:encode(), makefile._LOGFILE)
+-- local cmd = string.format("xmake l dispatcher %s %s extract %s %s", toolname:encode(), toolpath:encode(), srcfile:encode(), objfile:encode())
-- make head
file:write(string.format("%s:", objfile))
@@ -122,7 +123,7 @@ function makefile._make_object_for_static(file, target, srcfile, objfile)
-- make body
file:write(string.format("\t@echo inserting%s %s\n", mode, srcfile))
- file:write(string.format("\t@xmake l $(VERBOSE) verbose \"%s\"\n", cmd:gsub("[%s=\"]", function (w) return string.format("%%%x", w:byte()) end)))
+ file:write(string.format("\t@xmake l $(VERBOSE) verbose \"%s\"\n", cmd:encode()))
file:write(string.format("\t@xmake l rmdir %s\n", path.directory(objfile)))
file:write(string.format("\t@%s\n", cmd))
@@ -178,7 +179,7 @@ function makefile._make_object(file, target, srcfile, objfile)
-- make body
file:write(string.format("\t@echo %scompiling%s %s\n", utils.ifelse(ccache, "ccache ", ""), mode, srcfile))
- file:write(string.format("\t@xmake l $(VERBOSE) verbose \"%s\"\n", cmd:gsub("[%s=\"]", function (w) return string.format("%%%x", w:byte()) end)))
+ file:write(string.format("\t@xmake l $(VERBOSE) verbose \"%s\"\n", cmd:encode()))
file:write(string.format("\t@xmake l mkdir %s\n", path.directory(objfile)))
file:write(string.format("\t@%s\n", cmd))
@@ -287,11 +288,11 @@ function makefile._make_target(file, name, target)
local cmd = linker.make(l, target, objfiles, targetfile, makefile._LOGFILE)
-- the verbose
- local verbose = cmd:gsub("[%s=\"<]", function (w) return string.format("%%%x", w:byte()) end)
+ local verbose = cmd:encode()
-- too long?
if verbose and #verbose > 256 then
verbose = linker.make(l, target, {rule.filename("*", "object")}, targetfile)
- verbose = verbose:gsub("[%s=\"<]", function (w) return string.format("%%%x", w:byte()) end)
+ verbose = verbose:encode()
end
-- make body