Makefile 1.13 KB
Newer Older
Andreas Beckmann's avatar
Andreas Beckmann committed
1 2
# This Makefile intentionally rebuilds everytime everything.

3 4 5
PDFLATEX		?= pdflatex
XELATEX			?= xelatex
LUALATEX		?= lualatex
Andreas Beckmann's avatar
Andreas Beckmann committed
6
LATEX_FLAGS		?= -halt-on-error -interaction=nonstopmode
7

8
export TEXINPUTS	:= $(CURDIR)/src//:$(TEXINPUTS)
9

Andreas Beckmann's avatar
Andreas Beckmann committed
10 11 12
cmd%pdflatex		 = $(PDFLATEX) $(LATEX_FLAGS)
cmd%xelatex		 = $(XELATEX) $(LATEX_FLAGS)
cmd%lualatex		 = $(LUALATEX) $(LATEX_FLAGS)
13 14

engines			 = pdflatex xelatex lualatex
15 16
targets			 = minimal minimal_handout tutorial $(other)
other			:= $(patsubst %.tex,%,$(wildcard *.tex))
17

18
%/minimal: src
19
	@mkdir -p $(@D)
Andreas Beckmann's avatar
Andreas Beckmann committed
20
	cd $(@D) && $(cmd%$*) ../../tutorial/minimal.tex
21

22
%/minimal_handout: src
23
	@mkdir -p $(@D)
Andreas Beckmann's avatar
Andreas Beckmann committed
24
	cd $(@D) && $(cmd%$*) ../../tutorial/minimal_handout.tex
25

26
%/tutorial: src %/minimal %/minimal_handout
27
	@mkdir -p $(@D)
Andreas Beckmann's avatar
Andreas Beckmann committed
28
	cd $(@D) && $(cmd%$*) ../../tutorial/tutorial.tex
29

30 31 32 33 34 35
define other-target
%/$1: src
	@mkdir -p $$(@D)
	cd $$(@D) && $$(cmd%$$*) ../$1.tex
endef
$(foreach o,$(other),$(eval $(call other-target,$o)))
36 37 38 39 40

all: $(engines)

$(foreach engine,$(engines),$(eval $(engine): $(patsubst %,$(engine)/%,$(targets))))

41 42 43
src:
	mkdir -p $@
	cd $@ && ln -s ../../*.sty ../../*.pdf .
44 45

clean:
46
	$(RM) -r src
47
	$(RM) -r $(engines)