-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (31 loc) · 1.03 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
DOCKER=docker run -v "$$(pwd):/srv" -w=/srv nowox/latex:2.0
SRC=$(wildcard assets/*.c)
EXECS=$(SRC:.c=.out)
CFLAGS=-Wall -Wextra -Werror -std=c11 -pedantic -O3 -g
TEXSRC=$(wildcard *.tex)
BUILDDIR=build
LATEXMK=TEXMFHOME=$(shell pwd)/texmf texfot latexmk
all: exam.pdf solution.pdf
$(BUILDDIR)/config.tex: config.yml | tools/config.m.tex tools/parse-yml.py $(BUILDDIR)
./tools/parse-yml.py $< > $@ < tools/config.m.tex
exam.pdf: exam.tex FORCE | $(BUILDDIR)/config.tex code $(TEXSRC) $(BUILDDIR)
$(LATEXMK) -jobname=$(basename $@) $<
solution.pdf: exam.tex FORCE | $(BUILDDIR)/config.tex code $(TEXSRC) $(BUILDDIR)
$(LATEXMK) -jobname=$(basename $@) -pdflatex='xelatex %O "\PassOptionsToClass{answers}{exam}\input{%S}"' $<
%.out: %.c
cc $(CFLAGS) -o $@ $<
code: $(EXECS)
$(BUILDDIR):
mkdir -p $@
clean:
$(RM) -rf $(BUILDDIR)
$(RM) config.tex
latexmk -C
$(RM) *.aux *.fdb_latexmk *.fls *.log
$(RM) solution.pdf
$(RM) *.pdf
$(RM) *.pgf *.stderr *.stdout *.sh
$(RM) *.dpth *.md5 *.auxlock
$(RM) -rf release
FORCE:
.PHONY: clean all