summaryrefslogtreecommitdiff
path: root/Makefile
blob: ab5803bd2cfbdc8bf4bf6711f78a9d88a5dc721a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
.PHONY: all clean