2016-11-11 19:17:10 +00:00
|
|
|
clibrary {
|
|
|
|
name = "headers",
|
2022-07-13 23:15:29 +00:00
|
|
|
hdrs = {
|
|
|
|
"./src/cclass.h",
|
|
|
|
"./src/extern.h",
|
|
|
|
"./src/io.h",
|
|
|
|
"./src/Lpars.h",
|
|
|
|
"./src/sets.h",
|
|
|
|
"./src/types.h",
|
|
|
|
}
|
2016-11-11 19:17:10 +00:00
|
|
|
}
|
|
|
|
|
2016-07-14 21:54:13 +00:00
|
|
|
cprogram {
|
|
|
|
name = "llgen",
|
|
|
|
|
2019-10-21 22:15:52 +00:00
|
|
|
-- These use pre-LLgen'd versions of LLgen.c, Lpars.c, Lpars.h, and
|
|
|
|
-- tokens.c. If LLgen.g or tokens.g gets updated, they need
|
|
|
|
-- rebuilding. Use the bootstrap target to do this.
|
2016-07-14 21:54:13 +00:00
|
|
|
|
2022-07-13 23:15:29 +00:00
|
|
|
srcs = {
|
|
|
|
"./src/LLgen.c",
|
|
|
|
"./src/Lpars.c",
|
|
|
|
"./src/alloc.c",
|
|
|
|
"./src/cclass.c",
|
|
|
|
"./src/check.c",
|
|
|
|
"./src/compute.c",
|
|
|
|
"./src/gencode.c",
|
|
|
|
"./src/global.c",
|
|
|
|
"./src/machdep.c",
|
|
|
|
"./src/main.c",
|
|
|
|
"./src/name.c",
|
|
|
|
"./src/reach.c",
|
|
|
|
"./src/savegram.c",
|
|
|
|
"./src/sets.c",
|
|
|
|
"./src/tokens.c",
|
|
|
|
"./src/utils.c",
|
|
|
|
},
|
2016-11-11 19:17:10 +00:00
|
|
|
deps = { "+headers" },
|
2016-07-26 22:10:15 +00:00
|
|
|
vars = {
|
|
|
|
["+cflags"] = {
|
2022-07-13 23:15:29 +00:00
|
|
|
"-DLIBDIR=\\\""..cwd().."/lib\\\"",
|
2016-07-26 22:10:15 +00:00
|
|
|
"-DNON_CORRECTING"
|
|
|
|
},
|
|
|
|
}
|
2016-07-14 21:54:13 +00:00
|
|
|
}
|
|
|
|
|
2019-10-21 22:15:52 +00:00
|
|
|
-- This bootstrap target rebuilds LLgen's own parser with LLgen.
|
|
|
|
-- It acts like ./bootstrap.sh but without installing LLgen in PATH.
|
|
|
|
normalrule {
|
|
|
|
name = "bootstrap",
|
|
|
|
ins = "+llgen",
|
|
|
|
outleaves = { "phony" },
|
|
|
|
commands = {
|
|
|
|
"cd %{abspath(cwd()..\"/src\")}",
|
|
|
|
"%{abspath(ins)} -vvv -x tokens.g LLgen.g",
|
|
|
|
"echo",
|
|
|
|
"echo You should now be able to rebuild LLgen with the new parser.",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-14 21:54:13 +00:00
|
|
|
definerule("llgen",
|
|
|
|
{
|
|
|
|
srcs = { type="targets" },
|
|
|
|
},
|
|
|
|
function(e)
|
|
|
|
-- Remember this is executed from the caller's directory; local
|
|
|
|
-- target names will resolve there
|
2016-08-04 21:51:19 +00:00
|
|
|
local fs = replace(basename(filenamesof(e.srcs)), "%.g$", "")
|
2016-07-14 21:54:13 +00:00
|
|
|
|
|
|
|
return normalrule {
|
|
|
|
name = e.name,
|
|
|
|
cwd = e.cwd,
|
|
|
|
outleaves = {
|
|
|
|
"Lpars.c",
|
|
|
|
"Lpars.h",
|
2016-08-04 21:51:19 +00:00
|
|
|
replace(fs, "$", ".c")
|
2016-07-14 21:54:13 +00:00
|
|
|
},
|
|
|
|
ins = {
|
|
|
|
"util/LLgen+llgen",
|
2016-08-04 21:51:19 +00:00
|
|
|
e.srcs,
|
2016-07-14 21:54:13 +00:00
|
|
|
},
|
2022-07-13 23:15:29 +00:00
|
|
|
vars = {
|
|
|
|
srcs = e.srcs
|
|
|
|
},
|
2016-07-14 21:54:13 +00:00
|
|
|
commands = {
|
2022-07-13 23:15:29 +00:00
|
|
|
"rm -f %{outs} && %{ins[1]} -o%{dirname(outs[1])} %{srcs}"
|
2016-07-14 21:54:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
)
|