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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2021-12-06 10:33:52 +10:30
parent 426ff0abff
commit 405239e353

View File

@ -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))