-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
48 lines (36 loc) · 2.01 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
# Compute a version to use for the specification based on the latest tag.
VERSION=$(shell git describe --tags --dirty --match 'v*.*.*' | sed 's/^v//')
IMG_SRCS=$(shell find include/img_src/ -type f -name '*.dot')
IMG_EPSS=$(IMG_SRCS:include/img_src/%.dot=build/%.eps)
IMG_PNG=$(IMG_SRCS:include/img_src/%.dot=build/%.png)
.PHONY: all clean format images test
.PRECIOUS: build/ build/img/
all: build/spec.pdf build/abi.pdf
clean:
rm -rf build
format:
find . -type f -name '*.md' -exec ./scripts/format.sh {} ';'
images: $(IMG_EPSS) $(IMG_PNGS)
test: build/spec.pdf build/abi.pdf | build/
find build/ -type f -name '*.fir' | sort | xargs -n1 firtool -parse-only -disable-annotation-unknown -o /dev/null
find build/ -type f -name '*.v' | sort | xargs -n1 verilator --default-language 1364-2005 -Wall -Wno-DECLFILENAME -Wno-UNDRIVEN -Wno-UNUSEDSIGNAL -Wno-UNUSEDPARAM -Wno-MULTITOP --lint-only -o /dev/null
find build/ -type f -name '*.sv' | sort | xargs -n1 verilator --default-language 1800-2017 -Wall -Wno-DECLFILENAME -Wno-UNDRIVEN -Wno-UNUSEDSIGNAL -Wno-UNUSEDPARAM -Wno-MULTITOP --lint-only -o /dev/null
PANDOC_FLAGS=\
--pdf-engine=latexmk \
--pdf-engine-opt=-logfilewarninglist \
--pdf-engine-opt=-Werror \
--template include/spec-template.tex \
--syntax-definition include/firrtl.xml \
--syntax-definition include/ebnf.xml \
-r markdown+table_captions+inline_code_attributes+gfm_auto_identifiers \
--filter pandoc-crossref \
--lua-filter scripts/extract-firrtl-code.lua \
--metadata version:$(VERSION)
build/%.pdf: %.md %.yaml revision-history.yaml include/contributors.json include/common.yaml include/spec-template.tex include/firrtl.xml include/ebnf.xml scripts/extract-firrtl-code.lua $(IMG_EPSS) | build/
pandoc $< --metadata-file $*.yaml --metadata-file=revision-history.yaml --metadata-file=include/contributors.json --metadata-file=include/common.yaml $(PANDOC_FLAGS) -o $@
build/%.eps: include/img_src/%.dot | build/
dot -Teps $< -o $@
build/%.png: include/img_src/%.dot | build/
dot -Tpng $< -o $@
build/:
mkdir -p $@