Skip to content

Commit 8a4e42c

Browse files
committed
parse depsfile
1 parent 1f59ab2 commit 8a4e42c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

xmake/modules/core/tools/cl6x.lua

+14-1
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,14 @@ end
139139
-- compile the source file
140140
function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
141141
os.mkdir(path.directory(objectfile))
142+
local depfile = dependinfo and os.tmpfile() or nil
142143
try
143144
{
144145
function ()
145-
146146
local compflags = flags
147+
if depfile then
148+
compflags = table.join(compflags, "-ppd=" .. depfile)
149+
end
147150
local outdata, errdata = os.iorunv(compargv(self, sourcefile, objectfile, compflags))
148151
return (outdata or "") .. (errdata or "")
149152
end,
@@ -185,6 +188,16 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt)
185188
end
186189
cprint("${color.warning}%s", table.concat(table.slice(warnings:split('\n'), 1, 8), '\n'))
187190
end
191+
192+
-- generate the dependent includes
193+
if depfile and os.isfile(depfile) then
194+
if dependinfo then
195+
dependinfo.depfiles_gcc = io.readfile(depfile, {continuation = "\\"})
196+
end
197+
198+
-- remove the temporary dependent file
199+
os.tryrm(depfile)
200+
end
188201
end
189202
}
190203
}

0 commit comments

Comments
 (0)