forked from mavam/stat-cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (41 loc) · 1.31 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
CFG := config.tex
DOC := cookbook.tex
DIST := stat-cookbook.tar.gz
THIS := $(shell basename $(CURDIR))
EN := $(DOC:.tex=-en.tex)
ES := $(DOC:.tex=-es.tex)
DE := $(DOC:.tex=-de.tex)
RERUN := "(undefined references|Rerun to get (cross-references|the bars|point totals) right|Table widths have changed. Rerun LaTeX.|Linenumber reference failed)"
RERUNBIB := "No file.*\.bbl|Citation.*undefined"
TEXINPUTS := $(TEXINPUTS):translations:
.PHONY: all figs en es english spanish purge clean dist
all: figs en
figs:
@$(MAKE) -C $@
en: $(DOC)
@echo '\uselanguage{english}' > $(CFG)
@test -e $(EN) && diff -q $< $(EN) > /dev/null || cp $(DOC) $(EN)
@make english
es: $(DOC)
@echo '\uselanguage{spanish}' > $(CFG)
@test -e $(ES) && diff -q $< $(ES) > /dev/null || cp $(DOC) $(ES)
@make spanish
english: $(EN:.tex=.pdf)
spanish: $(ES:.tex=.pdf)
%.pdf: %.tex
pdflatex $<
@egrep -q $(RERUNBIB) $*.log && bibtex $* && pdflatex $<; true
@egrep -q $(RERUN) $*.log && pdflatex $<; true
@egrep -q $(RERUN) $*.log && pdflatex $<; true
purge:
-rm -f $(DIST) $(DOC:.tex=-*) \
*.{aux,dvi,log,bbl,blg,brf,toc,thm,out,fdb_latexmk}
clean: purge
$(MAKE) -C figs $@
-rm -f $(CFG) $(EN) $(EN:.tex=.pdf)
dist: clean
@git submodule update
@echo $(THIS)
@cd .. && \
tar cLzf $(DIST) --exclude literature $(THIS) && \
mv $(DIST) $(THIS)