2016-09-20 22:43:10 +00:00
|
|
|
include("first/yacc.lua")
|
|
|
|
|
|
|
|
flex {
|
|
|
|
name = "flex",
|
|
|
|
srcs = { "./*.l" },
|
|
|
|
}
|
|
|
|
|
|
|
|
yacc {
|
|
|
|
name = "yacc",
|
|
|
|
srcs = { "./*.y" },
|
|
|
|
}
|
|
|
|
|
2016-09-24 16:31:35 +00:00
|
|
|
normalrule {
|
|
|
|
name = "ircodes",
|
|
|
|
outleaves = { "ircodes.h", "ircodes.c" },
|
|
|
|
ins = {
|
|
|
|
"./ircodes.sh",
|
|
|
|
"./ir.dat"
|
|
|
|
},
|
|
|
|
commands = {
|
|
|
|
"%{ins[1]} %{ins[2]} %{outs[1]} %{outs[2]}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
clibrary {
|
|
|
|
name = "lib",
|
|
|
|
srcs = {
|
|
|
|
matching(filenamesof("+ircodes"), "%.c$")
|
|
|
|
},
|
|
|
|
hdrs = {
|
2016-09-24 20:46:08 +00:00
|
|
|
matching(filenamesof("+ircodes"), "%.h$"),
|
|
|
|
"./mcgg.h"
|
2016-09-24 16:31:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-20 22:43:10 +00:00
|
|
|
cprogram {
|
|
|
|
name = "mcgg",
|
|
|
|
srcs = {
|
|
|
|
"./*.c",
|
|
|
|
matching(filenamesof("+flex"), "%.c$"),
|
|
|
|
matching(filenamesof("+yacc"), "%.c$")
|
|
|
|
},
|
|
|
|
deps = {
|
2016-09-24 20:46:08 +00:00
|
|
|
"./iburg.h",
|
2016-09-24 16:31:35 +00:00
|
|
|
"+lib",
|
2016-09-20 22:43:10 +00:00
|
|
|
"+yacc"
|
|
|
|
}
|
|
|
|
}
|
2016-09-24 15:20:40 +00:00
|
|
|
|
|
|
|
definerule("mcgg",
|
|
|
|
{
|
|
|
|
srcs = { type="targets" }
|
|
|
|
},
|
|
|
|
function(e)
|
|
|
|
-- Remember this is executed from the caller's directory; local
|
|
|
|
-- target names will resolve there
|
|
|
|
if (#e.srcs ~= 1) then
|
|
|
|
error("you must supply exactly one input file")
|
|
|
|
end
|
|
|
|
|
|
|
|
return normalrule {
|
|
|
|
name = e.name,
|
|
|
|
cwd = e.cwd,
|
|
|
|
outleaves = {
|
|
|
|
"tables.c",
|
|
|
|
},
|
|
|
|
ins = {
|
|
|
|
"util/mcgg+mcgg",
|
2016-09-25 09:49:51 +00:00
|
|
|
e.srcs[1]
|
2016-09-24 15:20:40 +00:00
|
|
|
},
|
|
|
|
commands = {
|
2016-09-24 16:31:35 +00:00
|
|
|
"%{ins[1]} -i %{ins[2]} -o %{outs}",
|
2016-09-24 15:20:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
)
|
2016-09-20 22:43:10 +00:00
|
|
|
|