Baby steps towards building a platform --- make the assembler work.

Add ackbuilder support for C preprocessor files and yacc.
This commit is contained in:
David Given
2016-07-24 00:50:02 +02:00
parent 2770a83837
commit bff5c4019c
8 changed files with 214 additions and 5 deletions

View File

@@ -62,10 +62,6 @@ definerule("cfile",
end
hdrpaths = uniquify(hdrpaths)
for _, f in pairs(filenamesof(hdeps)) do
hsrcs[#hsrcs+1] = f
end
local outleaf = basename(csrcs[1]):gsub("%.c$", ".o")
return normalrule {
@@ -84,6 +80,46 @@ definerule("cfile",
end
)
definerule("cppfile",
{
srcs = { type="targets" },
deps = { type="targets", default={} },
outleaf = { type="string" },
cflags = { type="strings", default={} },
commands = {
type="strings",
default={
"$(CC) -E -P -o %{outs[1]} %{hdrpaths} %{cflags} -x c %{ins}"
}
},
},
function (e)
if (#e.srcs ~= 1) then
error("you must have exactly one input file")
end
local hdrpaths = {}
for _, t in pairs(e.deps) do
hdrpaths[#hdrpaths+1] = "-I"..t.dir
end
hdrpaths = uniquify(hdrpaths)
return normalrule {
name = e.name,
cwd = e.cwd,
ins = e.srcs,
deps = e.deps,
outleaves = {e.outleaf},
label = e.label,
commands = e.commands,
vars = {
hdrpaths = hdrpaths,
cflags = e.cflags,
}
}
end
)
definerule("bundle",
{
srcs = { type="targets" },