summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-07-11 12:51:14 +0800
committerruki <[email protected]>2016-07-11 12:51:14 +0800
commit7df92ed3a7a1414bf68abc7486c26f59edb79b67 (patch)
tree1af179ae2f3c2714f7f4ab839f498bfd502677c3
parent7973f797156b124f258a9f112649fde1ba5bb9e8 (diff)
add os.mclock for sandbox
-rwxr-xr-xxmake/actions/build/kinds/object.lua34
-rw-r--r--xmake/core/sandbox/modules/os.lua1
-rwxr-xr-xxmake/tools/cl.lua3
3 files changed, 32 insertions, 6 deletions
diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua
index 2f6721b51..e38a92b6c 100755
--- a/xmake/actions/build/kinds/object.lua
+++ b/xmake/actions/build/kinds/object.lua
@@ -91,23 +91,45 @@ function _build(target, g, index)
end
table.insert(depfiles, sourcefile)
+ -- get config header
+ local configheader = target:get("config_h")
+ if configheader then
+ configheader = path.absolute(configheader)
+ end
+
-- check the dependent files are modified?
- local modified = false
+ local modified = false
+ _g.depfile_mtimes = _g.depfile_mtimes or {}
for _, depfile in ipairs(depfiles) do
+
+ -- cache the mtimes for depfiles
+ local depfile_mtime = _g.depfile_mtimes[depfile]
+ if not depfile_mtime then
+ depfile_mtime = os.mtime(depfile)
+ _g.depfile_mtimes[depfile] = depfile_mtime
+ end
+
+ -- source and header files have been modified?
if os.mtime(depfile) > os.mtime(objectfile) then
- modified = true
- break
+
+ -- ignore the config header, because it always changed with build version.
+ -- and other config content will not be changed when building each time(without reconfig or rebuild)
+ --
+ if path.absolute(depfile) ~= configheader then
+ modified = true
+ break
+ end
end
end
+ -- trace
+ print("[%02d%%]: %s%s.$(mode) %s", percent, ifelse(config.get("ccache"), "ccache ", ""), ifelse(modified, "compiling", "passing"), sourcefile)
+
-- we need not rebuild it if the files are not modified
if not modified then
return
end
- -- trace
- print("[%02d%%]: %scompiling.$(mode) %s", percent, ifelse(config.get("ccache"), "ccache ", ""), sourcefile)
-
-- trace verbose info
if option.get("verbose") then
print(compiler.compcmd(sourcefile, objectfile, target))
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 7486e5d25..ab61d0866 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -34,6 +34,7 @@ local sandbox_os = sandbox_os or {}
sandbox_os.date = os.date
sandbox_os.time = os.time
sandbox_os.mtime = os.mtime
+sandbox_os.mclock = os.mclock
-- copy file or directory
function sandbox_os.cp(src, dst)
diff --git a/xmake/tools/cl.lua b/xmake/tools/cl.lua
index 9ebc52560..dc1c3331b 100755
--- a/xmake/tools/cl.lua
+++ b/xmake/tools/cl.lua
@@ -20,6 +20,9 @@
-- @file cl.lua
--
+-- imports
+import("core.project.project")
+
-- init it
function init(shellname)