Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 1 | # |
| 2 | # This confidential and proprietary software may be used only as |
| 3 | # authorised by a licensing agreement from ARM Limited |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 4 | # (C) COPYRIGHT 2020-2022 ARM Limited |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 5 | # 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 Kunze | d19f7ff | 2022-12-05 14:55:32 -0800 | [diff] [blame^] | 11 | TOSAREVISION=0.50.0 |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 12 | MKDIR=mkdir -p |
| 13 | ASCIIDOC=asciidoctor |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 14 | ASPELL=aspell |
Eric Kunze | a1ba656 | 2022-03-31 09:53:16 -0700 | [diff] [blame] | 15 | SHELL=/bin/bash -o pipefail |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 16 | XMLLINT = xmllint |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 17 | |
| 18 | HTMLDIR=out/html |
| 19 | PDFDIR=out/pdf |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 20 | GENDIR=out/gen |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 21 | |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 22 | COMMON_ARGS= -a revnumber="$(TOSAREVISION)" -a generated="$(abspath $(GENDIR))" |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 23 | |
| 24 | SPECSRC := tosa_spec.adoc |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 25 | ADOCFILES = $(wildcard chapters/[A-Za-z]*.adoc) $(wildcard $(GENDIR)/*/*.adoc) |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 26 | SPECFILES = $(ADOCFILES) tosa.css |
Eric Kunze | 44a1347 | 2021-08-12 11:01:14 -0700 | [diff] [blame] | 27 | FIGURES = $(wildcard figures/*.svg) |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 28 | SPECXML := tosa.xml |
| 29 | SPECSCHEMA := tosa.xsd |
| 30 | GENSCRIPTS := tools/tosa.py tools/genspec.py |
| 31 | |
| 32 | GEN := $(GENDIR)/gen.stamp |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 33 | |
| 34 | .DELETE_ON_ERROR: |
| 35 | |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 36 | .PHONY: all html pdf clean spell copy_html_figures lint |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 37 | |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 38 | all: spell html pdf |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 39 | |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 40 | html: lint copy_html_figures $(HTMLDIR)/tosa_spec.html |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 41 | |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 42 | pdf: lint $(PDFDIR)/tosa_spec.pdf |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 43 | |
| 44 | clean: |
| 45 | $(RM) $(HTMLDIR)/tosa_spec.html |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 46 | $(RM) -rf $(HTMLDIR)/figures |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 47 | $(RM) $(PDFDIR)/tosa_spec.pdf |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 48 | $(RM) -r $(GENDIR) |
| 49 | $(RM) out/lint.txt |
| 50 | |
| 51 | lint: out/lint.txt |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 52 | |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 53 | spell: out/spell.txt |
| 54 | |
Eric Kunze | 44a1347 | 2021-08-12 11:01:14 -0700 | [diff] [blame] | 55 | copy_html_figures: $(FIGURES) |
| 56 | $(MKDIR) -p $(HTMLDIR)/figures |
| 57 | cp $(FIGURES) $(HTMLDIR)/figures |
| 58 | |
Eric Kunze | a1ba656 | 2022-03-31 09:53:16 -0700 | [diff] [blame] | 59 | .PRECIOUS: out/spell.txt |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 60 | out/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 Kunze | a1ba656 | 2022-03-31 09:53:16 -0700 | [diff] [blame] | 66 | @if [ -s $@ ] ; then \ |
| 67 | echo Spelling errors detected, check $@; exit 1; \ |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 68 | else echo No spelling errors found ; \ |
| 69 | fi |
| 70 | |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 71 | .PRECIOUS: out/lint.txt |
| 72 | out/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 Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 81 | $(MKDIR) $(HTMLDIR) |
| 82 | $(ASCIIDOC) -b html5 -a stylesheet=tosa.css $(COMMON_ARGS) -o $@ $< |
| 83 | |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 84 | $(PDFDIR)/tosa_spec.pdf: $(SPECSRC) $(SPECFILES) $(GEN) |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 85 | $(MKDIR) $(PDFDIR) |
| 86 | $(ASCIIDOC) -r asciidoctor-pdf -b pdf $(COMMON_ARGS) -o $@ $(SPECSRC) |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 87 | |
| 88 | .PHONY: FORCE |
| 89 | FORCE: |