2016-11-11 19:17:10 +00:00
|
|
|
clibrary {
|
|
|
|
name = "headers",
|
|
|
|
hdrs = { "./src/*.h" }
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
srcs = { "./src/*.c" },
|
2016-11-11 19:17:10 +00:00
|
|
|
deps = { "+headers" },
|
2016-07-26 22:10:15 +00:00
|
|
|
vars = {
|
|
|
|
["+cflags"] = {
|
|
|
|
"-DLIBDIR=\\\""..posix.getcwd().."/"..cwd().."/lib\\\"",
|
|
|
|
"-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
|
|
|
},
|
|
|
|
commands = {
|
2017-11-15 18:41:39 +00:00
|
|
|
"cd %{dir} && rm -f %{outs} && %{abspath(ins)}"
|
2016-07-14 21:54:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
)
|