Makefile 1.39 KB
Newer Older
1
2
BASENAME = demo

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
BUILDDIR = build
TARGETS  = $(BASENAME)-presentation.pdf \
           $(BASENAME)-handout.pdf      \
           $(BASENAME)-notes.pdf

# Environment
TEXDIRS = resources/latex/:resources/latex-sty/:resources/images/:resources/listings/
BIBDIR  = resources/latex/
BSTDIR  = resources/latex-bst/

.EXPORT_ALL_VARIABLES:
TEXINPUTS := :.:$(TEXDIRS)
# bibtex invoked from BUILDDIR, thus prepend './../'
BSTINPUTS := ./../$(BSTDIR)
BIBINPUTS := :.:./../$(BIBDIR)

# cf. latexmkrc
LATEXMK   = latexmk -deps -jobname="$(basename $1)" $2
LATEXMKF  = export TARGET=$1 && export TYPE=$2 && $(call LATEXMK,$1,$(BASENAME))
LATEXMKC  = export TARGET=$1 && export TYPE="" && $(call LATEXMK,$1,$2)
23
24
25

all: build/ $(TARGETS)

Alija Sabic's avatar
Alija Sabic committed
26
presentation:  $(BUILDDIR)/ $(BASENAME)-presentation.pdf
27
28
handout: $(BUILDDIR)/ $(BASENAME)-handout.pdf
notes:   $(BUILDDIR)/ $(BASENAME)-notes.pdf
29
30

$(BASENAME)-presentation.pdf: .FORCE | $(BUILDDIR)
31
	$(call LATEXMKF,$@,presentation)
32
33

$(BASENAME)-handout.pdf: .FORCE | $(BUILDDIR)
34
	$(call LATEXMKF,$@,handout)
35
36

$(BASENAME)-notes.pdf: .FORCE | $(BUILDDIR)
37
	$(call LATEXMKF,$@,notes)
38
39

clean:
40
	$(foreach t,$(TARGETS), $(call LATEXMKC,$(t),-c);)
41
42

distclean:
43
	$(foreach t,$(TARGETS), $(call LATEXMKC,$(t),-C);)
44
45
46
47

%/:
	mkdir -p $@

Alija Sabic's avatar
Alija Sabic committed
48
.PHONY: all presentation handout notes clean distclean .FORCE
49
50
51
52

# Disable implicit suffix and built-in rules (for performance and profit)
.SUFFIXES:
MAKEFLAGS += --no-builtin-rules