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