forked from riscvarchive/riscv-time-compare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (45 loc) · 1.32 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
SPEC=Sstc
VERSION=1.0.0
STAGE=Ratified
COMMITDATE=$(shell git show -s --format=%ci | cut -d ' ' -f 1)
GITVERSION=$(shell git describe --tags --always --dirty)
GENDIR=autogenerated
SPEC_PDF=$(GENDIR)/$(SPEC).pdf
all: $(SPEC_PDF)
REVISION_SRC=$(GENDIR)/revision.adoc
HEADER_SRC=book_header.adoc
COMMON_SRCS= \
bibliography.adoc \
colophon.adoc \
index.adoc \
$(HEADER_SRC) \
$(REVISION_SRC)
SPEC_SRCS=content.adoc
$(GENDIR):
-mkdir $@
# Always perform this, but the rule is implemented so as to not touch the
# output if it needn't change.
.PHONY: $(REVISION_SRC)
$(REVISION_SRC): Makefile $(GENDIR)
echo ":revdate: ${COMMITDATE}" > $@-tmp
echo ":revnumber: ${VERSION}-${GITVERSION}" >> $@-tmp
echo ":revremark: ${STAGE}" >> $@-tmp
diff $@ $@-tmp || mv $@-tmp $@
# In order to remove the PHONY, this needs dependencies on all the input data,
# adocs, images/, resources/, etc.
.PHONY: $(SPEC_PDF)
$(SPEC_PDF): $(COMMON_SRCS) $(SPEC_SRCS) $(GENDIR)
asciidoctor-pdf \
--attribute=mathematical-format=svg \
--attribute=pdf-fontsdir=resources/fonts \
--attribute=pdf-style=resources/themes/risc-v_spec-pdf.yml \
--failure-level=ERROR \
--out-file=$@ \
--require=asciidoctor-bibtex \
--require=asciidoctor-diagram \
--require=asciidoctor-mathematical \
--trace \
--verbose \
$(HEADER_SRC)
clean:
$(RM) -r $(GENDIR)