2016-07-28 22:22:49 +00:00
|
|
|
include("util/cmisc/build.lua")
|
2016-08-13 23:39:40 +00:00
|
|
|
include("util/LLgen/build.lua")
|
2016-07-28 22:22:49 +00:00
|
|
|
|
2016-08-04 22:01:55 +00:00
|
|
|
local allocd_header = definerule(nil,
|
2016-07-28 22:22:49 +00:00
|
|
|
{
|
|
|
|
srcs = { type="targets" }
|
|
|
|
},
|
|
|
|
function (e)
|
|
|
|
return normalrule {
|
|
|
|
name = e.name,
|
|
|
|
ins = {
|
|
|
|
"./make.allocd",
|
2016-08-04 21:51:19 +00:00
|
|
|
e.srcs
|
2016-07-28 22:22:49 +00:00
|
|
|
},
|
2016-08-04 21:51:19 +00:00
|
|
|
outleaves = basename(filenamesof(e.srcs)[1]):gsub("%.str$", ".h"),
|
2016-07-28 22:22:49 +00:00
|
|
|
commands = {
|
|
|
|
"%{ins[1]} < %{ins[2]} > %{outs}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
)
|
|
|
|
|
|
|
|
allocd_header {
|
|
|
|
name = "macro_h",
|
|
|
|
srcs = { "./macro.str" }
|
|
|
|
}
|
|
|
|
|
|
|
|
allocd_header {
|
|
|
|
name = "replace_h",
|
|
|
|
srcs = { "./replace.str" }
|
|
|
|
}
|
|
|
|
|
|
|
|
normalrule {
|
|
|
|
name = "tokenfile_g",
|
|
|
|
ins = {
|
|
|
|
"./make.tokfile",
|
|
|
|
"./tokenname.c",
|
|
|
|
},
|
|
|
|
outleaves = { "tokenfile.g" },
|
|
|
|
commands = {
|
|
|
|
"sh %{ins[1]} < %{ins[2]} > %{outs}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
normalrule {
|
|
|
|
name = "symbol2str_c",
|
|
|
|
ins = {
|
|
|
|
"./make.tokcase",
|
|
|
|
"./tokenname.c",
|
|
|
|
},
|
|
|
|
outleaves = { "symbol2str.c" },
|
|
|
|
commands = {
|
|
|
|
"sh %{ins[1]} < %{ins[2]} > %{outs}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
normalrule {
|
|
|
|
name = "next_c",
|
|
|
|
ins = {
|
|
|
|
"./make.next",
|
|
|
|
"./*.str",
|
|
|
|
},
|
|
|
|
outleaves = { "next.c" },
|
|
|
|
commands = {
|
|
|
|
"sh %{ins} > %{outs}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-29 22:39:22 +00:00
|
|
|
local llgen = llgen {
|
2016-07-28 22:22:49 +00:00
|
|
|
name = "llgen",
|
|
|
|
srcs = {
|
|
|
|
"+tokenfile_g",
|
|
|
|
"./expression.g"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tabgen {
|
|
|
|
name = "tabgen_c",
|
|
|
|
srcs = { "./char.tab" }
|
|
|
|
}
|
|
|
|
|
|
|
|
cprogram {
|
|
|
|
name = "cpp",
|
2016-07-29 22:39:22 +00:00
|
|
|
srcs = concat(
|
2016-07-28 22:22:49 +00:00
|
|
|
"./*.c",
|
2016-08-04 21:51:19 +00:00
|
|
|
matching(filenamesof(llgen), "%.c$"),
|
2016-07-28 22:22:49 +00:00
|
|
|
"+next_c",
|
|
|
|
"+symbol2str_c",
|
2016-07-29 22:39:22 +00:00
|
|
|
"+tabgen_c"
|
|
|
|
),
|
2016-07-28 22:22:49 +00:00
|
|
|
deps = {
|
|
|
|
"+llgen",
|
|
|
|
"+macro_h",
|
|
|
|
"+replace_h",
|
|
|
|
"modules+headers",
|
|
|
|
"modules/src/alloc+lib",
|
|
|
|
"modules/src/idf+lib",
|
|
|
|
"modules/src/input+lib",
|
|
|
|
"modules/src/print+lib",
|
|
|
|
"modules/src/string+lib",
|
|
|
|
"modules/src/system+lib",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
installable {
|
|
|
|
name = "pkg",
|
|
|
|
map = {
|
|
|
|
["$(PLATDEP)/cpp.ansi"] = "+cpp"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|