diff --git a/build.lua b/build.lua index 8c59429d0..45bd06717 100644 --- a/build.lua +++ b/build.lua @@ -1,7 +1,8 @@ installable { name = "ack", map = { - "util/ack+ack-pkg" + "util/ack+ack-pkg", + "util/amisc+aelflod-pkg", } } diff --git a/first/ackbuilder.lua b/first/ackbuilder.lua index 2d198974b..e919a8d90 100644 --- a/first/ackbuilder.lua +++ b/first/ackbuilder.lua @@ -394,20 +394,25 @@ end -- DEFAULT RULES -- ----------------------------------------------------------------------------- -function environment:rule(ins, outs) - local firstout = outs[1] - for i = 2, #outs do - emit(outs[i]..":", outs[1], "\n") - end +function environment:rule(name, ins, outs) + emit(".INTERMEDIATE:", name, "\n") for i = 1, #ins do - emit(firstout..":", ins[i], "\n") + emit(name..":", ins[i], "\n") + end + for i = 1, #outs do + emit(outs[i]..":", name, "\n") + end + emit(name..":\n") + + local dirs = uniquify(dirname(outs)) + if (#dirs > 0) then + emit("\t@mkdir -p", dirs, "\n") end - emit(firstout..":\n") end -function environment:phony(ins, outs) - emit(".PHONY:", outs, "\n") - self:rule(ins, outs) +function environment:phony(name, ins, outs) + emit(".PHONY:", name, "\n") + self:rule(name, ins, outs) end function environment:label(...) @@ -415,13 +420,6 @@ function environment:label(...) emit("\t@echo", s, "\n") end -function environment:mkdirs(dirs) - dirs = uniquify(dirs) - if (#dirs > 0) then - emit("\t@mkdir -p", dirs, "\n") - end -end - function environment:exec(commands) for _, s in ipairs(commands) do emit("\t$(hide)", s, "\n") @@ -441,9 +439,8 @@ definerule("simplerule", vars = { type="table", default={} }, }, function (e) - e.environment:rule(filenamesof(e.ins), e.outs) + e.environment:rule(e.fullname, filenamesof(e.ins), e.outs) e.environment:label(e.fullname, " ", e.label or "") - e.environment:mkdirs(dirname(e.outs)) local vars = inherit(e.vars, { ins = e.ins, @@ -482,24 +479,17 @@ definerule("installable", error("installable can only cope with targets emitting single files") end - srcs[#srcs+1] = src + deps[#deps+1] = src dests[#dests+1] = dest commands[#commands+1] = "cp "..f[1].." "..dest - deps[#deps+1] = dest end end - if (#dests > 0) then - e.environment:rule(srcs, dests) - e.environment:label(e.fullname, " ", e.label or "") - if (#commands > 0) then - e.environment:mkdirs(dirname(dests)) - e.environment:exec(commands) - end - e.environment:endrule() + e.environment:rule(e.fullname, deps, dests) + e.environment:label(e.fullname, " ", e.label or "") + if (#commands > 0) then + e.environment:exec(commands) end - - e.environment:phony(deps, {cwd.."+"..e.name}) e.environment:endrule() end ) diff --git a/first/build.lua b/first/build.lua index 35821b484..354848704 100644 --- a/first/build.lua +++ b/first/build.lua @@ -119,7 +119,7 @@ definerule("clibrary", type="strings", default={ "rm -f %{outs}", - "$(AR) qs %{outs} %{ins}" + "$(AR) cqs %{outs} %{ins}" }, } }, diff --git a/h/build.lua b/h/build.lua index aca6a8fd4..2c9c3886a 100644 --- a/h/build.lua +++ b/h/build.lua @@ -13,6 +13,7 @@ bundle { name = "emheaders", srcs = { "./em_*.h", + "./out.h", "+em_path", } } diff --git a/util/amisc/build.lua b/util/amisc/build.lua new file mode 100644 index 000000000..9e9fad4cc --- /dev/null +++ b/util/amisc/build.lua @@ -0,0 +1,16 @@ +cprogram { + name = "aelflod", + srcs = { "./aelflod.c" }, + deps = { + "h+emheaders" + } +} + +installable { + name = "aelflod-pkg", + map = { + ["$(INSDIR)/bin/aelflod"] = "+aelflod", + ["$(PLATIND)/man/man1/aelflod.1"] = "./aelflod.1", + } +} +