forked from riscvarchive/riscv-platform-specs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (43 loc) · 1.34 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
#
# Build usable docs
#
ASCIIDOCTOR = asciidoctor
ASCIIDOCTOR_PDF = $(ASCIIDOCTOR)-pdf
DITAA = ditaa
IMAGES = pcie-topology.png
PLATFORM_SPEC = riscv-platform-spec
RISCV_DIR = docs-resources
RISCV_YML = $(RISCV_DIR)/themes/riscv-pdf.yml
RISCV_FONTS = $(RISCV_DIR)/fonts/
PANDOC = pandoc
PARTS = changelog.adoc contributors.adoc introduction.adoc licensing.adoc
# Build the platform spec in several formats
all: $(IMAGES) $(PLATFORM_SPEC).md $(PLATFORM_SPEC).pdf $(PLATFORM_SPEC).html
%.png: %.ditaa
rm -f $@
$(DITAA) $<
$(PLATFORM_SPEC).md: $(PLATFORM_SPEC).xml
$(PANDOC) -f docbook -t markdown_strict $< -o $@
$(PLATFORM_SPEC).xml: $(PLATFORM_SPEC).adoc
$(ASCIIDOCTOR) -d book -b docbook $<
$(PLATFORM_SPEC).pdf: $(PLATFORM_SPEC).adoc $(IMAGES) $(RISCV_YML)
$(ASCIIDOCTOR_PDF) \
-a toc \
-a compress \
-a pdf-style=$(RISCV_YML) \
-a pdf-fontsdir=$(RISCV_FONTS) \
-o $@ $<
$(PLATFORM_SPEC).html: $(PLATFORM_SPEC).adoc $(IMAGES)
$(ASCIIDOCTOR) -d book -b html $<
$(PLATFORM_SPEC).adoc: $(PARTS)
touch $@
clean:
rm -f $(PLATFORM_SPEC).xml
rm -f $(PLATFORM_SPEC).md
rm -f $(PLATFORM_SPEC).pdf
rm -f $(PLATFORM_SPEC).html
# handy shortcuts for installing necessary packages: YMMV
install-debs:
sudo apt-get install pandoc asciidoctor ditaa ruby-asciidoctor-pdf
install-rpms:
sudo dnf install ditaa pandoc rubygem-asciidoctor rubygem-asciidoctor-pdf