Makefile 868 Bytes
Newer Older
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
42
43
44
45
46
BASENAME = demo

BUILDDIR = build
TARGET  = $(BASENAME).pdf

# Environment
TEXDIRS = resources/tex:resources/latex-sty:resources/listings:resources/latex:resources/images:resources/tables:resources/latex
BIBDIRS = resources/latex/
BSTDIR = resources/latex-bst/

# cf. latexmkrc
LATEXMK = latexmk $1
VIEWER = xdg-open

all: $(TARGET)

$(TARGET): .FORCE | $(BUILDDIR)/
	$(call LATEXMK,)

pv:
	$(call LATEXMK,-pv)

pvc:
	$(call LATEXMK,-pvc)

clean:
	$(call LATEXMK,-c)

distclean:
	$(call LATEXMK,-C)

%/:
	mkdir -p $@

.PHONY: all clean distclean .FORCE

# Export all variables by default
.EXPORT_ALL_VARIABLES:
TEXINPUTS := :.:$(TEXDIRS)
# bibtex invoked from BUILDDIR, thus prepend './../'
BSTINPUTS := ./../$(BSTDIR)
BIBINPUTS := :.:./../$(BIBDIRS)

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