forked from Viplav04/Master-Thesis-Latex-RWU
/
Makefile
103 lines (88 loc) · 3 KB
/
Makefile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
XELATEX?=xelatex
KPSEWHICH?=kpsewhich
MKTEXLSR?=mktexlsr
INSTALL?=install
PDFVIEWER?=xdg-open
EXAMPLES=examples/thesis.pdf
#examples/article.pdf\
# examples/report-twoside.pdf\
# examples/book.pdf\
# examples/test-quote.pdf\
# examples/test-csquotes.pdf\
RWUSTYLEFILES=rwustyle/rwubase.sty\
rwustyle/rwudefs.sty\
rwustyle/rwufont.sty\
rwustyle/rwukoma.sty\
rwustyle/rwulogo.eps
# If this is changed, also update the cleanup part of the examples/%.pdf rule!
CLEANFILES=examples/*.aux \
examples/*.lof \
examples/*.log \
examples/*.lot \
examples/*.nav \
examples/*.out \
examples/*.snm \
examples/*.toc \
examples/*.vrb
.PHONY: examples
examples: $(EXAMPLES)
.PHONY: .doinstall
.doinstall:
@if [ -z $(TEXMFDIR) ]; then \
echo "Could not determine installation directory." >&2 ; \
echo "Please specify TEXMFDIR when invoking make, e.g.:" >&2 ; \
echo " make install TEXMFDIR=\"$$HOME/texmf\"" >&2 ; \
exit 1 ; \
fi
for i in $(RWUSTYLEFILES); do \
$(INSTALL) -m 644 -D -t "$(TEXMFDIR)/tex/latex/rwustyle" "$$i" ; \
done
.PHONY: install-home
install-home: TEXMFDIR?=$(shell $(KPSEWHICH) -var-value=TEXMFHOME)
install-home: .doinstall
.PHONY: install
install: TEXMFDIR?=$(shell $(KPSEWHICH) -var-value=TEXMFLOCAL)
install: .doinstall
$(MKTEXLSR) $(TEXMFDIR)
.PHONY: .douninstall
.douninstall:
@if [ -z $(TEXMFDIR) ]; then \
echo "Could not determine installation directory." >&2 ; \
echo "Please specify TEXMFDIR when invoking make, e.g.:" >&2 ; \
echo " make uninstall TEXMFDIR=\"$$HOME/texmf\"" >&2 ; \
exit 1 ; \
fi
for i in $(RWUSTYLEFILES); do \
rm -f "$(TEXMFDIR)/tex/latex/$$i" ; \
done
.PHONY: uninstall-home
uninstall-home: TEXMFDIR?=$(shell $(KPSEWHICH) -var-value=TEXMFHOME)
uninstall-home: .douninstall
.PHONY: uninstall
uninstall: TEXMFDIR?=$(shell $(KPSEWHICH) -var-value=TEXMFLOCAL)
uninstall: .douninstall
$(MKTEXLSR) $(TEXMFDIR)
.PHONY: clean
clean:
for i in $(CLEANFILES); do [ -f "$$i" ] && rm -f "$$i"; done; exit 0
.PHONY: mrproper
mrproper: clean
for i in $(EXAMPLES); do [ -f "$$i" ] && rm -f "$$i"; done; exit 0
# FIXME: Find a way that is less clumsy than repeating all the file extensions
# from CLEANFILES!
examples/%.pdf: examples/%.tex $(RWUSTYLEFILES)
@echo "Cleaning up first ..."
rm -f "$(patsubst %.tex,%.aux,$<)"
rm -f "$(patsubst %.tex,%.lof,$<)"
rm -f "$(patsubst %.tex,%.log,$<)"
rm -f "$(patsubst %.tex,%.lot,$<)"
rm -f "$(patsubst %.tex,%.nav,$<)"
rm -f "$(patsubst %.tex,%.out,$<)"
rm -f "$(patsubst %.tex,%.snm,$<)"
rm -f "$(patsubst %.tex,%.snm,$<)"
rm -f "$(patsubst %.tex,%.toc,$<)"
rm -f "$(patsubst %.tex,%.vrb,$<)"
@echo "Running $(XELATEX) three times for $< ..."
cd examples && env TEXINPUTS=../rwustyle:: $(XELATEX) -interaction nonstopmode -halt-on-error $(notdir $<)
cd examples && env TEXINPUTS=../rwustyle:: $(XELATEX) -interaction nonstopmode -halt-on-error $(notdir $<)
cd examples && env TEXINPUTS=../rwustyle:: $(XELATEX) -interaction nonstopmode -halt-on-error $(notdir $<)