From 405239e353730bf80e8919547cdc9ce64c18a113 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 6 Dec 2021 10:33:52 +1030 Subject: [PATCH] doc/Makefile: speed up schema check, only do on check-doc. Don't do this on every build, it takes 4 seconds. And split it into individual targets, so make can parallelize (1.6 seconds here). Signed-off-by: Rusty Russell --- doc/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index d193d8aa4..0c90b195e 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -89,15 +89,15 @@ MANPAGES := doc/lightning-cli.1 \ doc/lightning-help.7 \ doc/lightning-getlog.7 -doc-all: fmt-schema $(MANPAGES) doc/index.rst +doc-all: $(MANPAGES) doc/index.rst -#FIXME(vincenzopalazzo) we don't need to change a file if it is well format, -#so we can use diff to check difference in the real json and in the .fmt -fmt-schema: - @echo "Checking schema fmt!" - @for f in $$(find doc/schemas -type f -name '*.json'); do cat "$$f" | jq . > "$$f.fmt" ; mv "$$f.fmt" "$$f" ; done +SCHEMAS := $(wildcard doc/schemas/*.json) +check-fmt-schemas: $(SCHEMAS:%=check-fmt-schema/%) -check-doc: check-config-docs check-manpages +check-fmt-schema/%: % + @jq . < "$*" > "$*".fmt && diff -u "$*" "$*.fmt" && rm "$*.fmt" + +check-doc: check-config-docs check-manpages check-fmt-schemas # Some manpages use a schema, so need that added. MARKDOWN_WITH_SCHEMA := $(shell grep -l GENERATE-FROM-SCHEMA $(MANPAGES:=.md))