From c573b9bce21dfb1a7add4c0acc2752c03486c76e Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 18 Jul 2022 16:48:14 +0200 Subject: [PATCH] Split aal arguments properly. --- plat/build.lua | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/plat/build.lua b/plat/build.lua index a6f9e7a59..e0519dc1a 100644 --- a/plat/build.lua +++ b/plat/build.lua @@ -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 )