summaryrefslogtreecommitdiff
path: root/xmake/modules/core/project/depend.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-03-01 16:53:14 +0800
committerruki <[email protected]>2020-03-01 16:53:14 +0800
commit99461db2fae34632c83417667c8955c3361e7751 (patch)
treea4c1e3fe4d6363599180bdb59f429e5ef9123a93 /xmake/modules/core/project/depend.lua
parentc6b2d02e47b82b06f856593bbde71d544a134b9c (diff)
improve to save depfiles for gcc
Diffstat (limited to 'xmake/modules/core/project/depend.lua')
-rw-r--r--xmake/modules/core/project/depend.lua23
1 files changed, 22 insertions, 1 deletions
diff --git a/xmake/modules/core/project/depend.lua b/xmake/modules/core/project/depend.lua
index 54023b669..aaa2c13a7 100644
--- a/xmake/modules/core/project/depend.lua
+++ b/xmake/modules/core/project/depend.lua
@@ -18,11 +18,32 @@
-- @file depend.lua
--
+-- imports
+import("private.tools.gcc.parse_deps")
+
-- load dependent info from the given file (.d)
function load(dependfile)
if os.isfile(dependfile) then
+
-- may be the depend file has been incomplete when if the compilation process is abnormally interrupted
- return try { function() return io.load(dependfile) end }
+ local dependinfo = try { function() return io.load(dependfile) end }
+ if dependinfo then
+
+ -- parse depfiles for gcc
+ local depfiles_gcc = dependinfo.depfiles_gcc
+ if depfiles_gcc then
+ local depfiles = parse_deps.from_str(depfiles_gcc)
+ if depfiles then
+ if dependinfo.files then
+ table.join2(dependinfo.files, depfiles)
+ else
+ dependinfo.files = depfiles
+ end
+ end
+ dependinfo.depfiles_gcc = nil
+ end
+ return dependinfo
+ end
end
end