forked from riscv-non-isa/riscv-sbi-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (45 loc) · 1.28 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
#
# Build usable documents
#
ASCIIDOCTOR = asciidoctor
ASCIIDOCTOR_PDF = $(ASCIIDOCTOR)-pdf
DITAA = ditaa
IMAGES = riscv-sbi-intro1.png
IMAGES += riscv-sbi-intro2.png
IMAGES += riscv-sbi-hsm.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)
%.png: %.ditaa
rm -f $@
$(DITAA) $<
%.html: %.adoc $(IMAGES) $(REVSNIP)
$(ASCIIDOCTOR) -d book -b html $<
%.pdf: %.adoc $(IMAGES) docs-resources/themes/riscv-pdf.yml $(REVSNIP)
$(ASCIIDOCTOR_PDF) \
-a toc \
-a compress \
-a pdf-style=docs-resources/themes/riscv-pdf.yml \
-a pdf-fontsdir=docs-resources/fonts \
-o $@ $<
$(SPEC)/autogenerated:
-mkdir $@
$(SPEC)/autogenerated/revision.adoc-snippet: Makefile $(SPEC)/autogenerated
echo ":revdate: ${COMMITDATE}" > $@-tmp
echo ":revnumber: ${VERSION}-${GITVERSION}" >> $@-tmp
diff $@ $@-tmp || mv $@-tmp $@
.PHONY: clean
clean:
rm -f $(TARGETS)
.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