From ff9bf5b08abbd96c380c0e98c7eafa4af4c402f4 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 3 Sep 2016 00:20:11 +0200 Subject: [PATCH] Makefiles are now slightly less inaccurate. Does actually seem to do sensible incremental builds now. I loathe make. --- first/ackbuilder.lua | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/first/ackbuilder.lua b/first/ackbuilder.lua index 25bfd02c0..282e6f185 100644 --- a/first/ackbuilder.lua +++ b/first/ackbuilder.lua @@ -609,15 +609,28 @@ local function install_make_emitter() end function emitter:rule(name, ins, outs) + if (#outs == 0) then + local n = name.."-IMAGINARY-OUT" + emit(".INTERMEDIATE:", n, "\n") + outs = {n} + end + + local impl = name.."-IMPL" emit(".INTERMEDIATE:", name, "\n") - for i = 1, #ins do - emit(name..":", ins[i], "\n") + emit(".INTERMEDIATE:", impl, "\n") + + for i = 1, #outs do + emit(name..":", outs[i], "\n") end for i = 1, #outs do - emit(outs[i]..":", name, ";\n") + emit(outs[i]..":", impl, ";\n") end - emit(name..":\n") + for i = 1, #ins do + emit(impl..":", ins[i], "\n") + end + + emit(impl..":", "\n") local dirs = uniquify(dirname(outs)) if (#dirs > 0) then emit("\t@mkdir -p", dirs, "\n")