Split aal arguments properly.

This commit is contained in:
David Given 2022-07-18 16:48:14 +02:00
parent 01c2342e18
commit c573b9bce2

View file

@ -49,25 +49,25 @@ definerule("acklibrary",
function (e) function (e)
local em = (e.vars.plat or ""):find("^em") local em = (e.vars.plat or ""):find("^em")
local function splitter(srcs, num, cmd)
local commands = { local commands = {
"rm -f %{outs[1]}",
} }
local t = {} local t = {}
local function flush() local function flush()
commands[#commands+1] = commands[#commands+1] = cmd:gsub("%%%%", asstring(t))
"ACKDIR=$(INSDIR) $(INSDIR)/bin/aal qc %{outs[1]} "..
asstring(t)
t = {} t = {}
end end
for _, target in ipairs(filenamesof(e.srcs)) do for _, target in ipairs(srcs) do
t[#t+1] = target t[#t+1] = target
if #t == 100 then if #t == num then
flush() flush()
end end
end end
if #t ~= 0 then if #t ~= 0 then
flush() flush()
end end
return table.concat(commands, " && ")
end
return clibrary { return clibrary {
name = e.name, name = e.name,
@ -77,9 +77,15 @@ definerule("acklibrary",
"util/arch+pkg", "util/arch+pkg",
e.deps e.deps
}, },
vars = {
splitter = splitter
},
_cfile = ackfile, _cfile = ackfile,
suffix = em and ".m" or ".o", suffix = em and ".m" or ".o",
commands = commands commands = {
"rm -f %{outs[1]}",
"%{splitter(ins, 100, 'ACKDIR=$(INSDIR) $(INSDIR)/bin/aal qc '..tostring(outs[1])..' %%')}"
}
} }
end end
) )