2022-07-17 12:53:48 +00:00
|
|
|
include("first/bison.lua")
|
2016-07-26 21:35:30 +00:00
|
|
|
|
2022-07-17 12:53:48 +00:00
|
|
|
local cggparser = bison {
|
2016-07-26 21:35:30 +00:00
|
|
|
name = "cggparser",
|
|
|
|
srcs = { "./cgg.y" }
|
|
|
|
}
|
|
|
|
|
2016-07-29 22:39:22 +00:00
|
|
|
local cgglexer = flex {
|
2016-07-26 21:35:30 +00:00
|
|
|
name = "cgglexer",
|
|
|
|
srcs = { "./scan.l" }
|
|
|
|
}
|
|
|
|
|
|
|
|
normalrule {
|
|
|
|
name = "keywords",
|
2016-08-04 21:51:19 +00:00
|
|
|
ins = {
|
2022-07-17 16:15:09 +00:00
|
|
|
"./make_enterkeyw_c.lua",
|
2016-07-26 21:35:30 +00:00
|
|
|
"./keywords",
|
2016-08-04 21:51:19 +00:00
|
|
|
},
|
2016-07-26 21:35:30 +00:00
|
|
|
outleaves = { "enterkeyw.c" },
|
|
|
|
commands = {
|
2022-12-30 18:50:16 +00:00
|
|
|
"$(LUA) %{ins[1]} < %{ins[2]} > %{outs[1]}"
|
2016-07-26 21:35:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cprogram {
|
|
|
|
name = "ncgg",
|
2016-07-29 22:39:22 +00:00
|
|
|
srcs = concat(
|
2022-07-14 21:57:54 +00:00
|
|
|
"./coerc.c",
|
|
|
|
"./emlookup.c",
|
|
|
|
"./error.c",
|
|
|
|
"./expr.c",
|
|
|
|
"./hall.c",
|
|
|
|
"./instruct.c",
|
|
|
|
"./iocc.c",
|
|
|
|
"./lookup.c",
|
|
|
|
"./main.c",
|
|
|
|
"./output.c",
|
|
|
|
"./set.c",
|
|
|
|
"./strlookup.c",
|
|
|
|
"./subr.c",
|
|
|
|
"./var.c",
|
2016-08-04 21:51:19 +00:00
|
|
|
matching(filenamesof(cggparser), "%.c$"),
|
|
|
|
matching(filenamesof(cgglexer), "%.c$"),
|
2016-07-29 22:39:22 +00:00
|
|
|
"+keywords"
|
|
|
|
),
|
2016-07-26 21:35:30 +00:00
|
|
|
deps = {
|
2017-11-10 03:22:13 +00:00
|
|
|
"./cost.h", "./expr.h", "./extern.h", "./instruct.h",
|
|
|
|
"./iocc.h", "./lookup.h", "./param.h", "./property.h",
|
|
|
|
"./pseudo.h", "./reg.h", "./regvar.h", "./set.h",
|
|
|
|
"./token.h", "./varinfo.h",
|
2016-07-26 21:35:30 +00:00
|
|
|
"+cggparser", -- for .h file
|
|
|
|
"+cgglexer", -- for .h file
|
|
|
|
"h+emheaders",
|
2016-08-14 12:09:38 +00:00
|
|
|
"modules/src/em_data+lib",
|
2016-07-26 21:35:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
definerule("ncgg",
|
|
|
|
{
|
|
|
|
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
|
|
|
|
|
|
|
|
local cpptable = cppfile {
|
|
|
|
name = e.name.."/cpptable",
|
|
|
|
outleaf = "cpptable",
|
|
|
|
srcs = e.srcs
|
|
|
|
}
|
|
|
|
|
|
|
|
return normalrule {
|
|
|
|
name = e.name,
|
|
|
|
cwd = e.cwd,
|
|
|
|
outleaves = {
|
|
|
|
"tables.c",
|
|
|
|
"tables.h",
|
|
|
|
},
|
|
|
|
ins = {
|
|
|
|
"util/ncgg+ncgg",
|
|
|
|
cpptable
|
|
|
|
},
|
|
|
|
commands = {
|
|
|
|
"cd %{dir} && %{ins}",
|
|
|
|
"mv %{dir}/tables.H %{dir}/tables.h"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
)
|