-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathmakefile
More file actions
69 lines (55 loc) · 1.76 KB
/
makefile
File metadata and controls
69 lines (55 loc) · 1.76 KB
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
65
66
67
68
69
.PHONY: help
help: makefile
@tail -n +4 makefile | grep ".PHONY"
.PHONY: build
build:
cd rust && make build
cd godot && make build
cd sqlite && make build
cd wolfram-language && make build
cd lua && make build
cd c && make build
cards-combined.md: rust/cards.md godot/cards.md sqlite/cards.md wolfram-language/cards.md lua/cards.md c/cards.md
printf -- '---\nname: Coding Flashcards\n---\n' > $@
for f in $^; do \
dir=$$(dirname "$$f"); \
awk -v dir="$$dir" 'BEGIN{seen=0; deck=""} \
/^name:/ && seen<2 {sub(/^name: */,""); deck=$$0; next} \
/^---$$/ && seen<2 {seen++; next} \
seen<2 {next} \
/^-{3,}$$/ {gsub(/\.\/images\//, "images/"); gsub(/images\//, dir "/images/"); print; print ""; print "`<small style=\"color:#888\">" deck "</small>`{=html}`{\\small\\color{gray} " deck "}`{=latex}"; next} \
{gsub(/\.\/images\//, "images/"); gsub(/images\//, dir "/images/"); print}' \
"$$f" >> $@; \
done
cards-combined.apkg: cards-combined.md
anki-panky $<
cards-combined.pdf: cards-combined.md
pandoc \
--pdf-engine tectonic \
--variable "geometry:papersize={130mm,130mm}" \
--variable "fontsize: 10pt" \
--variable "monofont:Hasklug Nerd Font Mono" \
--variable "monofontoptions:Scale=0.7, FontFace={weight=700}" \
--to beamer \
--output $@ \
$<
.PHONY: build-combined
build-combined: cards-combined.apkg cards-combined.pdf
.PHONY: test
test:
nix flake check
cd rust && make test
cd godot && make test
cd sqlite && make test
cd wolfram-language && make test
cd lua && make test
cd c && make test
.PHONY: clean
clean:
rm -f cards-combined.md cards-combined.apkg cards-combined.pdf
cd rust && make clean
cd godot && make clean
cd sqlite && make clean
cd wolfram-language && make clean
cd lua && make clean
cd c && make clean