aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEric Kunze <eric.kunze@arm.com>2022-08-05 15:40:12 -0700
committerEric Kunze <eric.kunze@arm.com>2022-08-19 14:19:28 -0700
commit58098a7b1ffcf41da759f862deb753c82fe5b4b0 (patch)
tree75b61a482e23293b8af85adf6210f2d3e4e5695d /Makefile
parent6361d1664c7b82ecc3afdd0eb87e96afea430f89 (diff)
downloadspecification-58098a7b1ffcf41da759f862deb753c82fe5b4b0.tar.gz
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 <eric.kunze@arm.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile36
1 files changed, 28 insertions, 8 deletions
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)