From eb520a343d003d6d65e2648706a3c1bbc028c9df Mon Sep 17 00:00:00 2001 From: George Koehler Date: Mon, 21 Oct 2019 18:15:52 -0400 Subject: [PATCH] Add ACK target util/LLgen+bootstrap The ACK builds an internal LLgen without installing it. The new target would rebuild LLgen's own parser using the ACK's internal LLgen. Keep bootstrap.sh, which uses an installed LLgen. The new target is more convenient for those who build the ACK but don't build and install a separate LLgen. --- util/LLgen/build.lua | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/util/LLgen/build.lua b/util/LLgen/build.lua index 36e796fee..9152760b3 100644 --- a/util/LLgen/build.lua +++ b/util/LLgen/build.lua @@ -6,9 +6,9 @@ clibrary { cprogram { name = "llgen", - -- These use pre-LLgen'd versions of LLgen.c, Lpars.c and tokens.c. If - -- LLgen.g gets updated, they need rebuilding. Use the bootstrap script to - -- do this. + -- 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. srcs = { "./src/*.c" }, deps = { "+headers" }, @@ -20,6 +20,20 @@ cprogram { } } +-- 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.", + } +} + definerule("llgen", { srcs = { type="targets" },