blob: 63acd97826ce98544c91b6ec1bfd3f7ebc7745e3 [file] [log] [blame]
Eric Kunze3309a532020-10-01 18:50:46 -07001#
2# This confidential and proprietary software may be used only as
3# authorised by a licensing agreement from ARM Limited
Eric Kunzea3eded02021-12-13 15:40:04 -08004# (C) COPYRIGHT 2020-2022 ARM Limited
Eric Kunze3309a532020-10-01 18:50:46 -07005# ALL RIGHTS RESERVED
6# The entire notice above must be reproduced on all authorised
7# copies and copies may only be made to the extent permitted
8# by a licensing agreement from ARM Limited.
9#
10
Eric Kunzed5fcd0d2022-08-29 16:22:18 -070011TOSAREVISION=0.40.0
Eric Kunze3309a532020-10-01 18:50:46 -070012MKDIR=mkdir -p
13ASCIIDOC=asciidoctor
Eric Kunzea3eded02021-12-13 15:40:04 -080014ASPELL=aspell
Eric Kunzea1ba6562022-03-31 09:53:16 -070015SHELL=/bin/bash -o pipefail
Eric Kunze58098a72022-08-05 15:40:12 -070016XMLLINT = xmllint
Eric Kunze3309a532020-10-01 18:50:46 -070017
18HTMLDIR=out/html
19PDFDIR=out/pdf
Eric Kunze58098a72022-08-05 15:40:12 -070020GENDIR=out/gen
Eric Kunze3309a532020-10-01 18:50:46 -070021
Eric Kunze58098a72022-08-05 15:40:12 -070022COMMON_ARGS= -a revnumber="$(TOSAREVISION)" -a generated="$(abspath $(GENDIR))"
Eric Kunze3309a532020-10-01 18:50:46 -070023
24SPECSRC := tosa_spec.adoc
Eric Kunze58098a72022-08-05 15:40:12 -070025ADOCFILES = $(wildcard chapters/[A-Za-z]*.adoc) $(wildcard $(GENDIR)/*/*.adoc)
Eric Kunzea3eded02021-12-13 15:40:04 -080026SPECFILES = $(ADOCFILES) tosa.css
Eric Kunze44a13472021-08-12 11:01:14 -070027FIGURES = $(wildcard figures/*.svg)
Eric Kunze58098a72022-08-05 15:40:12 -070028SPECXML := tosa.xml
29SPECSCHEMA := tosa.xsd
30GENSCRIPTS := tools/tosa.py tools/genspec.py
31
32GEN := $(GENDIR)/gen.stamp
Eric Kunze3309a532020-10-01 18:50:46 -070033
34.DELETE_ON_ERROR:
35
Eric Kunze58098a72022-08-05 15:40:12 -070036.PHONY: all html pdf clean spell copy_html_figures lint
Eric Kunze3309a532020-10-01 18:50:46 -070037
Eric Kunzea3eded02021-12-13 15:40:04 -080038all: spell html pdf
Eric Kunze3309a532020-10-01 18:50:46 -070039
Eric Kunze58098a72022-08-05 15:40:12 -070040html: lint copy_html_figures $(HTMLDIR)/tosa_spec.html
Eric Kunze3309a532020-10-01 18:50:46 -070041
Eric Kunze58098a72022-08-05 15:40:12 -070042pdf: lint $(PDFDIR)/tosa_spec.pdf
Eric Kunze3309a532020-10-01 18:50:46 -070043
44clean:
45 $(RM) $(HTMLDIR)/tosa_spec.html
Eric Kunze58098a72022-08-05 15:40:12 -070046 $(RM) -rf $(HTMLDIR)/figures
Eric Kunze3309a532020-10-01 18:50:46 -070047 $(RM) $(PDFDIR)/tosa_spec.pdf
Eric Kunze58098a72022-08-05 15:40:12 -070048 $(RM) -r $(GENDIR)
49 $(RM) out/lint.txt
50
51lint: out/lint.txt
Eric Kunze3309a532020-10-01 18:50:46 -070052
Eric Kunzea3eded02021-12-13 15:40:04 -080053spell: out/spell.txt
54
Eric Kunze44a13472021-08-12 11:01:14 -070055copy_html_figures: $(FIGURES)
56 $(MKDIR) -p $(HTMLDIR)/figures
57 cp $(FIGURES) $(HTMLDIR)/figures
58
Eric Kunzea1ba6562022-03-31 09:53:16 -070059.PRECIOUS: out/spell.txt
Eric Kunzea3eded02021-12-13 15:40:04 -080060out/spell.txt: $(ADOCFILES) FORCE
61 @echo Running spell check
62 @mkdir -p $(@D)
63 @tools/get_descriptions.py $(ADOCFILES) \
64 | $(ASPELL) list -v -l en-US --encoding=UTF-8 --add-extra-dicts=./tools/dictionary.dic\
65 | sort -u > $@
Eric Kunzea1ba6562022-03-31 09:53:16 -070066 @if [ -s $@ ] ; then \
67 echo Spelling errors detected, check $@; exit 1; \
Eric Kunzea3eded02021-12-13 15:40:04 -080068 else echo No spelling errors found ; \
69 fi
70
Eric Kunze58098a72022-08-05 15:40:12 -070071.PRECIOUS: out/lint.txt
72out/lint.txt: $(SPECXML) $(SPECSCHEMA)
73 echo Linting XML
74 $(XMLLINT) --noout --schema $(SPECSCHEMA) $(SPECXML)
75
76$(GEN): $(SPECXML) $(GENSCRIPTS)
77 tools/genspec.py --xml $(SPECXML) --outdir $(GENDIR)
78 @touch $@
79
80$(HTMLDIR)/tosa_spec.html: $(SPECSRC) $(SPECFILES) $(GEN)
Eric Kunze3309a532020-10-01 18:50:46 -070081 $(MKDIR) $(HTMLDIR)
82 $(ASCIIDOC) -b html5 -a stylesheet=tosa.css $(COMMON_ARGS) -o $@ $<
83
Eric Kunze58098a72022-08-05 15:40:12 -070084$(PDFDIR)/tosa_spec.pdf: $(SPECSRC) $(SPECFILES) $(GEN)
Eric Kunze3309a532020-10-01 18:50:46 -070085 $(MKDIR) $(PDFDIR)
86 $(ASCIIDOC) -r asciidoctor-pdf -b pdf $(COMMON_ARGS) -o $@ $(SPECSRC)
Eric Kunzea3eded02021-12-13 15:40:04 -080087
88.PHONY: FORCE
89FORCE: