First draft at installables; not very satisfactory. make bugs with multiple
output targets and parallelism?
This commit is contained in:
parent
09554cb324
commit
2af8568cc3
|
@ -1,7 +1,8 @@
|
||||||
installable {
|
installable {
|
||||||
name = "ack",
|
name = "ack",
|
||||||
map = {
|
map = {
|
||||||
"util/ack+ack-pkg"
|
"util/ack+ack-pkg",
|
||||||
|
"util/amisc+aelflod-pkg",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -394,20 +394,25 @@ end
|
||||||
-- DEFAULT RULES --
|
-- DEFAULT RULES --
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
function environment:rule(ins, outs)
|
function environment:rule(name, ins, outs)
|
||||||
local firstout = outs[1]
|
emit(".INTERMEDIATE:", name, "\n")
|
||||||
for i = 2, #outs do
|
|
||||||
emit(outs[i]..":", outs[1], "\n")
|
|
||||||
end
|
|
||||||
for i = 1, #ins do
|
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
|
end
|
||||||
emit(firstout..":\n")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function environment:phony(ins, outs)
|
function environment:phony(name, ins, outs)
|
||||||
emit(".PHONY:", outs, "\n")
|
emit(".PHONY:", name, "\n")
|
||||||
self:rule(ins, outs)
|
self:rule(name, ins, outs)
|
||||||
end
|
end
|
||||||
|
|
||||||
function environment:label(...)
|
function environment:label(...)
|
||||||
|
@ -415,13 +420,6 @@ function environment:label(...)
|
||||||
emit("\t@echo", s, "\n")
|
emit("\t@echo", s, "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
function environment:mkdirs(dirs)
|
|
||||||
dirs = uniquify(dirs)
|
|
||||||
if (#dirs > 0) then
|
|
||||||
emit("\t@mkdir -p", dirs, "\n")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function environment:exec(commands)
|
function environment:exec(commands)
|
||||||
for _, s in ipairs(commands) do
|
for _, s in ipairs(commands) do
|
||||||
emit("\t$(hide)", s, "\n")
|
emit("\t$(hide)", s, "\n")
|
||||||
|
@ -441,9 +439,8 @@ definerule("simplerule",
|
||||||
vars = { type="table", default={} },
|
vars = { type="table", default={} },
|
||||||
},
|
},
|
||||||
function (e)
|
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:label(e.fullname, " ", e.label or "")
|
||||||
e.environment:mkdirs(dirname(e.outs))
|
|
||||||
|
|
||||||
local vars = inherit(e.vars, {
|
local vars = inherit(e.vars, {
|
||||||
ins = e.ins,
|
ins = e.ins,
|
||||||
|
@ -482,26 +479,19 @@ definerule("installable",
|
||||||
error("installable can only cope with targets emitting single files")
|
error("installable can only cope with targets emitting single files")
|
||||||
end
|
end
|
||||||
|
|
||||||
srcs[#srcs+1] = src
|
deps[#deps+1] = src
|
||||||
dests[#dests+1] = dest
|
dests[#dests+1] = dest
|
||||||
commands[#commands+1] = "cp "..f[1].." "..dest
|
commands[#commands+1] = "cp "..f[1].." "..dest
|
||||||
deps[#deps+1] = dest
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if (#dests > 0) then
|
e.environment:rule(e.fullname, deps, dests)
|
||||||
e.environment:rule(srcs, dests)
|
|
||||||
e.environment:label(e.fullname, " ", e.label or "")
|
e.environment:label(e.fullname, " ", e.label or "")
|
||||||
if (#commands > 0) then
|
if (#commands > 0) then
|
||||||
e.environment:mkdirs(dirname(dests))
|
|
||||||
e.environment:exec(commands)
|
e.environment:exec(commands)
|
||||||
end
|
end
|
||||||
e.environment:endrule()
|
e.environment:endrule()
|
||||||
end
|
end
|
||||||
|
|
||||||
e.environment:phony(deps, {cwd.."+"..e.name})
|
|
||||||
e.environment:endrule()
|
|
||||||
end
|
|
||||||
)
|
)
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -119,7 +119,7 @@ definerule("clibrary",
|
||||||
type="strings",
|
type="strings",
|
||||||
default={
|
default={
|
||||||
"rm -f %{outs}",
|
"rm -f %{outs}",
|
||||||
"$(AR) qs %{outs} %{ins}"
|
"$(AR) cqs %{outs} %{ins}"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,6 +13,7 @@ bundle {
|
||||||
name = "emheaders",
|
name = "emheaders",
|
||||||
srcs = {
|
srcs = {
|
||||||
"./em_*.h",
|
"./em_*.h",
|
||||||
|
"./out.h",
|
||||||
"+em_path",
|
"+em_path",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
util/amisc/build.lua
Normal file
16
util/amisc/build.lua
Normal file
|
@ -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",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue