summaryrefslogtreecommitdiff
path: root/Makefile
blob: 16715236a2388a1d5212e67d125798f324269005 (plain)
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
TEX := $(wildcard *.tex)
NAMES := $(TEX:.tex=.pdf)

# Target that matches all possible generated PDFs
all: $(NAMES)
$(NAMES): $(%:.pdf=.tex)

# Rule that builds the tex file in a temp directory and copies it
%.pdf: %.tex
	$(eval TMP := $(shell mktemp -d --suffix=-sts-build))
	@cp -r * $(TMP)/
	cd $(TMP)/; \
		xelatex $<;
	@cp $(TMP)/$@ $@
	@rm -rf $(TMP)

# Rule that cleans all previous content
clean:
	@rm *.pdf
	@rm -r /tmp/*-sts-build

watch: watch.sh
	./watch.sh

.PHONY: all clean watch