-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (41 loc) · 1.59 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
PROJECT=eventbook
TRANSIFEXPROJECT=eventbook.master
IGNOREFORTRANSLATION=preamble
REPO=.
SRCDIR=$(REPO)/src
OUTDIR=$(REPO)/out
PODIR=$(REPO)/po
SRCFILES=$(shell find $(SRCDIR) -type f)
OLDCOMMIT=HEAD~1
NEWCOMMIT=master
DIFFNAME=$(PROJECT)-diff-$(OLDCOMMIT)-$(NEWCOMMIT)
PO4ACHARSETS=-M Utf-8 -L Utf-8
LATEXARGS= -output-directory=$(OUTDIR) -interaction=nonstopmode -file-line-error
.DELETE_ON_ERROR:
pdf: $(OUTDIR)/$(PROJECT).pdf
$(OUTDIR)/%.pdf $(OUTDIR)/%.aux $(OUTDIR)/%.idx: $(SRCDIR)/%.tex $(SRCFILES) | $(OUTDIR)
TEXDIR=$(SRCDIR); \
TEXINPUTS=$$TEXDIR: pdflatex $(LATEXARGS) -draftmode $< 2>&1 | tee $(OUTDIR)/`basename $<`.log && \
TEXINPUTS=$$TEXDIR: pdflatex $(LATEXARGS) $< 2>&1 | tee $(OUTDIR)/`basename $<`.log; \
diff: | $(OUTDIR)
rcs-latexdiff -vo $(SRCDIR)/$(DIFFNAME).tex src/$(PROJECT).tex $(OLDCOMMIT) $(NEWCOMMIT)
$(MAKE) $(OUTDIR)/$(DIFFNAME).pdf
translated: update-translation | $(OUTDIR)
for file in `find $(SRCDIR)/$(PROJECT)-*.tex`; do \
$(MAKE) $(OUTDIR)/`basename $$file | sed 's/\.tex$$/\.pdf/'`; \
done
update-translation: $(PODIR)/template.pot
tx set --auto-local -t PO -r $(TRANSIFEXPROJECT) --execute
tx push -s
tx pull -a
TEXINPUTS=$(SRCDIR): po4a --variable repo=$(REPO) $(PO4ACHARSETS) $(REPO)/po4a.cfg
$(PODIR)/template.pot: $(SRCFILES) po4a.cfg | $(PODIR)
TEXINPUTS=$(SRCDIR): po4a-gettextize -f latex -m $(SRCDIR)/$(PROJECT).tex $(PO4ACHARSETS) -o 'exclude_include=$(IGNOREFORTRANSLATION)' -p $(PODIR)/template.pot
$(OUTDIR):
mkdir -p $(OUTDIR)
$(PODIR):
mkdir -p $(PODIR)
clean:
rm -rf $(OUTDIR)
rm -rf $(PODIR)
rm -rf $(SRCDIR)/$(PROJECT)-*