From 58098a7b1ffcf41da759f862deb753c82fe5b4b0 Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Fri, 5 Aug 2022 15:40:12 -0700 Subject: Machine parsable specification This converts portions of the asciidoc specification into an xml document and schema. For the html and pdf outputs, the xml is converted to asciidoc files that are included into the existing specification. The xml allows future automated uses of the tosa specification while maintaining rough compatibility with the existing document. No significant functional changes are included in this change. Change-Id: I7f1f95c527638e270c157d58fcdec6a3510daea5 Signed-off-by: Eric Kunze --- Makefile | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index fa6274d..9fbaeab 100644 --- a/Makefile +++ b/Makefile @@ -13,31 +13,42 @@ MKDIR=mkdir -p ASCIIDOC=asciidoctor ASPELL=aspell SHELL=/bin/bash -o pipefail +XMLLINT = xmllint HTMLDIR=out/html PDFDIR=out/pdf +GENDIR=out/gen -COMMON_ARGS= -a revnumber="$(TOSAREVISION)" +COMMON_ARGS= -a revnumber="$(TOSAREVISION)" -a generated="$(abspath $(GENDIR))" SPECSRC := tosa_spec.adoc -ADOCFILES = $(wildcard chapters/[A-Za-z]*.adoc) +ADOCFILES = $(wildcard chapters/[A-Za-z]*.adoc) $(wildcard $(GENDIR)/*/*.adoc) SPECFILES = $(ADOCFILES) tosa.css FIGURES = $(wildcard figures/*.svg) +SPECXML := tosa.xml +SPECSCHEMA := tosa.xsd +GENSCRIPTS := tools/tosa.py tools/genspec.py + +GEN := $(GENDIR)/gen.stamp .DELETE_ON_ERROR: -.PHONY: all html pdf clean spell copy_html_figures +.PHONY: all html pdf clean spell copy_html_figures lint all: spell html pdf -html: copy_html_figures $(HTMLDIR)/tosa_spec.html +html: lint copy_html_figures $(HTMLDIR)/tosa_spec.html -pdf: $(PDFDIR)/tosa_spec.pdf +pdf: lint $(PDFDIR)/tosa_spec.pdf clean: $(RM) $(HTMLDIR)/tosa_spec.html - rm -rf $(HTMLDIR)/figures + $(RM) -rf $(HTMLDIR)/figures $(RM) $(PDFDIR)/tosa_spec.pdf + $(RM) -r $(GENDIR) + $(RM) out/lint.txt + +lint: out/lint.txt spell: out/spell.txt @@ -57,11 +68,20 @@ out/spell.txt: $(ADOCFILES) FORCE else echo No spelling errors found ; \ fi -$(HTMLDIR)/tosa_spec.html: $(SPECSRC) $(SPECFILES) +.PRECIOUS: out/lint.txt +out/lint.txt: $(SPECXML) $(SPECSCHEMA) + echo Linting XML + $(XMLLINT) --noout --schema $(SPECSCHEMA) $(SPECXML) + +$(GEN): $(SPECXML) $(GENSCRIPTS) + tools/genspec.py --xml $(SPECXML) --outdir $(GENDIR) + @touch $@ + +$(HTMLDIR)/tosa_spec.html: $(SPECSRC) $(SPECFILES) $(GEN) $(MKDIR) $(HTMLDIR) $(ASCIIDOC) -b html5 -a stylesheet=tosa.css $(COMMON_ARGS) -o $@ $< -$(PDFDIR)/tosa_spec.pdf: $(SPECSRC) $(SPECFILES) +$(PDFDIR)/tosa_spec.pdf: $(SPECSRC) $(SPECFILES) $(GEN) $(MKDIR) $(PDFDIR) $(ASCIIDOC) -r asciidoctor-pdf -b pdf $(COMMON_ARGS) -o $@ $(SPECSRC) -- cgit v1.2.1