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 | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 11 | MKDIR=mkdir -p |
| 12 | ASCIIDOC=asciidoctor |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 13 | ASPELL=aspell |
Eric Kunze | a1ba656 | 2022-03-31 09:53:16 -0700 | [diff] [blame] | 14 | SHELL=/bin/bash -o pipefail |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 15 | XMLLINT = xmllint |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 16 | |
| 17 | HTMLDIR=out/html |
| 18 | PDFDIR=out/pdf |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 19 | GENDIR=out/gen |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 20 | |
Kevin Petit | 36f2d64 | 2022-12-06 11:56:15 +0000 | [diff] [blame] | 21 | COMMON_ARGS= -a generated="$(abspath $(GENDIR))" |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 22 | |
| 23 | SPECSRC := tosa_spec.adoc |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 24 | ADOCFILES = $(wildcard chapters/[A-Za-z]*.adoc) $(wildcard $(GENDIR)/*/*.adoc) |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 25 | SPECFILES = $(ADOCFILES) tosa.css |
Eric Kunze | 44a1347 | 2021-08-12 11:01:14 -0700 | [diff] [blame] | 26 | FIGURES = $(wildcard figures/*.svg) |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 27 | SPECXML := tosa.xml |
| 28 | SPECSCHEMA := tosa.xsd |
| 29 | GENSCRIPTS := tools/tosa.py tools/genspec.py |
| 30 | |
| 31 | GEN := $(GENDIR)/gen.stamp |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 32 | |
| 33 | .DELETE_ON_ERROR: |
| 34 | |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 35 | .PHONY: all html pdf clean spell copy_html_figures lint |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 36 | |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 37 | all: spell html pdf |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 38 | |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 39 | html: lint copy_html_figures $(HTMLDIR)/tosa_spec.html |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 40 | |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 41 | pdf: lint $(PDFDIR)/tosa_spec.pdf |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 42 | |
| 43 | clean: |
| 44 | $(RM) $(HTMLDIR)/tosa_spec.html |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 45 | $(RM) -rf $(HTMLDIR)/figures |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 46 | $(RM) $(PDFDIR)/tosa_spec.pdf |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 47 | $(RM) -r $(GENDIR) |
| 48 | $(RM) out/lint.txt |
| 49 | |
| 50 | lint: out/lint.txt |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 51 | |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 52 | spell: out/spell.txt |
| 53 | |
Eric Kunze | 44a1347 | 2021-08-12 11:01:14 -0700 | [diff] [blame] | 54 | copy_html_figures: $(FIGURES) |
| 55 | $(MKDIR) -p $(HTMLDIR)/figures |
| 56 | cp $(FIGURES) $(HTMLDIR)/figures |
| 57 | |
Eric Kunze | a1ba656 | 2022-03-31 09:53:16 -0700 | [diff] [blame] | 58 | .PRECIOUS: out/spell.txt |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 59 | out/spell.txt: $(ADOCFILES) FORCE |
| 60 | @echo Running spell check |
| 61 | @mkdir -p $(@D) |
| 62 | @tools/get_descriptions.py $(ADOCFILES) \ |
| 63 | | $(ASPELL) list -v -l en-US --encoding=UTF-8 --add-extra-dicts=./tools/dictionary.dic\ |
| 64 | | sort -u > $@ |
Eric Kunze | a1ba656 | 2022-03-31 09:53:16 -0700 | [diff] [blame] | 65 | @if [ -s $@ ] ; then \ |
| 66 | echo Spelling errors detected, check $@; exit 1; \ |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 67 | else echo No spelling errors found ; \ |
| 68 | fi |
| 69 | |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 70 | .PRECIOUS: out/lint.txt |
| 71 | out/lint.txt: $(SPECXML) $(SPECSCHEMA) |
| 72 | echo Linting XML |
| 73 | $(XMLLINT) --noout --schema $(SPECSCHEMA) $(SPECXML) |
| 74 | |
| 75 | $(GEN): $(SPECXML) $(GENSCRIPTS) |
| 76 | tools/genspec.py --xml $(SPECXML) --outdir $(GENDIR) |
| 77 | @touch $@ |
| 78 | |
| 79 | $(HTMLDIR)/tosa_spec.html: $(SPECSRC) $(SPECFILES) $(GEN) |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 80 | $(MKDIR) $(HTMLDIR) |
| 81 | $(ASCIIDOC) -b html5 -a stylesheet=tosa.css $(COMMON_ARGS) -o $@ $< |
| 82 | |
Eric Kunze | 58098a7 | 2022-08-05 15:40:12 -0700 | [diff] [blame] | 83 | $(PDFDIR)/tosa_spec.pdf: $(SPECSRC) $(SPECFILES) $(GEN) |
Eric Kunze | 3309a53 | 2020-10-01 18:50:46 -0700 | [diff] [blame] | 84 | $(MKDIR) $(PDFDIR) |
| 85 | $(ASCIIDOC) -r asciidoctor-pdf -b pdf $(COMMON_ARGS) -o $@ $(SPECSRC) |
Eric Kunze | a3eded0 | 2021-12-13 15:40:04 -0800 | [diff] [blame] | 86 | |
| 87 | .PHONY: FORCE |
| 88 | FORCE: |