diff options
| author | ruki <[email protected]> | 2015-06-03 18:04:18 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-03 18:04:18 +0800 |
| commit | 795001d9b03960d9a8fc290e6f6f9710f49c86bc (patch) | |
| tree | cff700e27fc2e754b3a686d8d23f6b58a1792e6a /xmake/scripts | |
| parent | 81970742272dc8b6f406f91f216374777786d256 (diff) | |
impl verbose output for building
Diffstat (limited to 'xmake/scripts')
| -rw-r--r-- | xmake/scripts/base/makefile.lua | 8 | ||||
| -rw-r--r-- | xmake/scripts/platform/platform.lua | 7 | ||||
| -rw-r--r-- | xmake/scripts/platform/windows/_maker.lua | 7 | ||||
| -rw-r--r-- | xmake/scripts/tool/echo.lua | 2 | ||||
| -rw-r--r-- | xmake/scripts/tool/verbose.lua | 32 |
5 files changed, 49 insertions, 7 deletions
diff --git a/xmake/scripts/base/makefile.lua b/xmake/scripts/base/makefile.lua index 1c2261629..3c18cfb87 100644 --- a/xmake/scripts/base/makefile.lua +++ b/xmake/scripts/base/makefile.lua @@ -54,9 +54,11 @@ 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) 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))) - file:write(string.format("\t@%s > %s 2>&1\n", c:make(target, filetype, srcfile, objfile), makefile._LOGFILE)) + file:write(string.format("\t@%s > %s 2>&1\n", cmd, makefile._LOGFILE)) -- make tail file:write("\n") @@ -127,9 +129,11 @@ function makefile._make_target(file, name, target) file:write("\n") -- make body + local cmd = l:make(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))) - file:write(string.format("\t@%s > %s 2>&1\n", l:make(target, objfiles, targetfile), makefile._LOGFILE)) + file:write(string.format("\t@%s > %s 2>&1\n", cmd, makefile._LOGFILE)) -- make tail file:write("\n") diff --git a/xmake/scripts/platform/platform.lua b/xmake/scripts/platform/platform.lua index 3748fa218..07a973dcd 100644 --- a/xmake/scripts/platform/platform.lua +++ b/xmake/scripts/platform/platform.lua @@ -298,12 +298,15 @@ function platform.build(mkfile, target) return p._MAKER.done(mkfile, target) end + -- is verbose? + local verbose = utils.ifelse(xmake._OPTIONS.verbose, "-v", "") + -- make command local cmd = nil if mkfile and os.isfile(mkfile) then - cmd = string.format("make -j4 -f %s %s", mkfile, target or "") + cmd = string.format("make -j4 -f %s %s VERBOSE=%s", mkfile, target or "", verbose) else - cmd = string.format("make -j4 %s", target or "") + cmd = string.format("make -j4 %s VERBOSE=%s", target or "", verbose) end -- done diff --git a/xmake/scripts/platform/windows/_maker.lua b/xmake/scripts/platform/windows/_maker.lua index 40df24e17..81e8fd5de 100644 --- a/xmake/scripts/platform/windows/_maker.lua +++ b/xmake/scripts/platform/windows/_maker.lua @@ -76,12 +76,15 @@ function _maker.done(mkfile, target) local includes = _maker._enter("include") local libpathes = _maker._enter("libpath") + -- is verbose? + local verbose = utils.ifelse(xmake._OPTIONS.verbose, "-v", "") + -- make command local cmd = nil if mkfile and os.isfile(mkfile) then - cmd = string.format("nmake /f %s %s 2> nul", mkfile, target or "") + cmd = string.format("nmake /f %s %s VERBOSE=%s 2> nul", mkfile, target or "", verbose) else - cmd = string.format("nmake %s 2> nul", target or "") + cmd = string.format("nmake %s VERBOSE=%s 2> nul", target or "", verbose) end -- done diff --git a/xmake/scripts/tool/echo.lua b/xmake/scripts/tool/echo.lua index eb6cff396..2180ce0d4 100644 --- a/xmake/scripts/tool/echo.lua +++ b/xmake/scripts/tool/echo.lua @@ -22,7 +22,7 @@ -- echo all for _, v in ipairs(...) do - io.write(string.format("%s ", v)) + io.write(string.format("%s ", v:gsub("%%20", " "))) end io.write("\n") diff --git a/xmake/scripts/tool/verbose.lua b/xmake/scripts/tool/verbose.lua new file mode 100644 index 000000000..0054ba620 --- /dev/null +++ b/xmake/scripts/tool/verbose.lua @@ -0,0 +1,32 @@ +--!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) 2009 - 2015, ruki All rights reserved. +-- +-- @author ruki +-- @file verbose.lua +-- + +-- verbose all +if xmake._OPTIONS.verbose then + for _, v in ipairs(...) do + io.write(string.format("%s ", v:gsub("%%20", " "))) + end + io.write("\n") +end + +-- ok +return true |
