forked from riscv/riscv-debug-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·64 lines (47 loc) · 1.91 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
CC=$(RISCV)/bin/riscv64-unknown-elf-gcc
NAME=riscv-debug-spec
REGISTERS_TEX = jtag_registers.tex
REGISTERS_TEX += core_registers.tex
REGISTERS_TEX += hwbp_registers.tex
REGISTERS_TEX += dm_registers.tex
REGISTERS_TEX += trace_registers.tex
REGISTERS_TEX += sample_registers.tex
REGISTERS_TEX += abstract_commands.tex
REGISTERS_TEX += sw_registers.tex
REGISTERS_CHISEL += dm_registers.scala
REGISTERS_CHISEL += abstract_commands.scala
FIGURES = fig/*
all: $(NAME).pdf debug_defines.h
$(NAME).pdf: $(NAME).tex $(REGISTERS_TEX) $(FIGURES) vc.tex changelog.tex
pdflatex -shell-escape $< && pdflatex -shell-escape $<
publish: $(NAME).pdf
cp $< $(NAME)-`git rev-parse --abbrev-ref HEAD`.`git rev-parse --short HEAD`.pdf
vc.tex: .git/logs/HEAD
# https://thorehusfeldt.net/2011/05/13/including-git-revision-identifiers-in-latex/
echo "%%% This file is generated by Makefile." > vc.tex
echo "%%% Do not edit this file!\n%%%" >> vc.tex
git log -1 --format="format:\
\\gdef\\GITHash{%H}\
\\gdef\\GITAbrHash{%h}\
\\gdef\\GITAuthorDate{%ad}\
\\gdef\\GITAuthorName{%an}" >> vc.tex
changelog.tex: .git/logs/HEAD Makefile
echo "%%% This file is generated by Makefile." > changelog.tex
echo "%%% Do not edit this file!\n%%%" >> changelog.tex
git log --date=short --pretty="format:\\vhEntry{%h}{%ad}{%an}{%s}" | \
sed s,_,\\\\_,g | sed "s,#,\\\\#,g" >> changelog.tex
debug_defines.h: $(REGISTERS_TEX:.tex=.h)
cat $^ > $@
%.eps: %.dot
dot -Teps $< -o $@
%.tex %.h: xml/%.xml registers.py
./registers.py --custom --definitions $@.inc --cheader $(basename $@).h $< > $@
%.scala: xml/%.xml registers.py
./registers.py --chisel $(basename $@).scala $< > /dev/null
%.o: %.S
$(CC) -c $<
chisel: $(REGISTERS_CHISEL)
clean:
rm -f $(NAME).pdf *.aux $(NAME).toc $(NAME).log $(REGISTERS_TEX) \
$(REGISTERS_TEX:=.inc) *.o *_no128.S *.h $(NAME).lof $(NAME).lot $(NAME).out \
$(NAME).hst $(NAME).pyg debug_defines.h *.scala