forked from riscv-non-isa/riscv-sbi-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
88 lines (78 loc) · 2.43 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#
# Build usable documents
#
ASCIIDOCTOR = asciidoctor
ASCIIDOCTOR_PDF = $(ASCIIDOCTOR)-pdf
OPTIONS := --trace \
-a toc \
-a compress \
-a mathematical-format=svg \
-a pdf-fontsdir=docs-resources/fonts \
-a pdf-theme=docs-resources/themes/riscv-pdf.yml \
--failure-level=ERROR
REQUIRES := --require=asciidoctor-bibtex \
--require=asciidoctor-diagram \
--require=asciidoctor-mathematical
DITAA = ditaa
DEPS = src/contributors.adoc
DEPS += src/changelog.adoc
DEPS += src/intro.adoc
DEPS += src/terms.adoc
DEPS += src/binary-encoding.adoc
DEPS += src/ext-base.adoc
DEPS += src/ext-legacy.adoc
DEPS += src/ext-time.adoc
DEPS += src/ext-ipi.adoc
DEPS += src/ext-rfence.adoc
DEPS += src/ext-hsm.adoc
DEPS += src/ext-sys-reset.adoc
DEPS += src/ext-pmu.adoc
DEPS += src/ext-debug-console.adoc
DEPS += src/ext-sys-suspend.adoc
DEPS += src/ext-cppc.adoc
DEPS += src/ext-nested-acceleration.adoc
DEPS += src/ext-steal-time.adoc
DEPS += src/ext-sse.adoc
DEPS += src/ext-firmware-features.adoc
DEPS += src/ext-debug-triggers.adoc
DEPS += src/ext-experimental.adoc
DEPS += src/ext-vendor.adoc
DEPS += src/ext-firmware.adoc
DEPS += src/references.adoc
DEPS += src/references.bib
IMAGES = images/riscv-sbi-intro1.png
IMAGES += images/riscv-sbi-intro2.png
IMAGES += images/riscv-sbi-hsm.png
IMAGES += images/riscv-sbi-sse-sm.png
REVSNIP = $(SPEC)/autogenerated/revision.adoc-snippet
TARGETS = riscv-sbi.pdf
TARGETS += riscv-sbi.html
TARGETS += $(REVSNIP)
COMMITDATE=$(shell git show -s --format=%ci | cut -d ' ' -f 1)
GITVERSION=$(shell git describe --tag)
SPEC=$(shell pwd)
.PHONY: all
all: $(IMAGES) $(TARGETS)
images/%.png: src/%.ditaa
rm -f $@
$(DITAA) $< $@
%.html: %.adoc $(IMAGES) $(REVSNIP) $(DEPS)
$(ASCIIDOCTOR) -d book -b html $<
%.pdf: %.adoc $(IMAGES) docs-resources/themes/riscv-pdf.yml $(REVSNIP) $(DEPS)
$(ASCIIDOCTOR_PDF) $(OPTIONS) $(REQUIRES) --out-file=$@ $<
$(SPEC)/autogenerated:
-mkdir $@
$(SPEC)/autogenerated/revision.adoc-snippet: Makefile $(SPEC)/autogenerated
echo ":revdate: ${COMMITDATE}" > $@-tmp
echo ":revnumber: ${GITVERSION}" >> $@-tmp
(test -f $@ && diff $@ $@-tmp) || mv $@-tmp $@
.PHONY: clean
clean:
rm -f $(TARGETS)
rm -rf $(SPEC)/autogenerated
.PHONY: install-debs
install-debs:
sudo apt-get install pandoc asciidoctor ditaa ruby-asciidoctor-pdf
.PHONY: install-rpms
install-rpms:
sudo dnf install ditaa pandoc rubygem-asciidoctor rubygem-asciidoctor-pdf