]> pere.pagekite.me Git - text-destroy-surveillance.git/blob - Makefile
Added translation using Weblate (German)
[text-destroy-surveillance.git] / Makefile
1 SOURCE=how-to-destroy-surveillance-capitalism
2 GENERATED = $(SOURCE).xml $(SOURCE).pdf $(SOURCE).html $(SOURCE).epub \
3 $(SOURCE).nb.xml $(SOURCE).nb.pdf $(SOURCE).nb.html $(SOURCE).nb.epub \
4 $(SOURCE).pl.xml $(SOURCE).pl.pdf $(SOURCE).pl.html $(SOURCE).pl.epub
5
6 PANDOC_OPTS = \
7 -t docbook4
8
9 DBLATEX_OPTS = \
10 -p pdf.xsl
11
12 all: $(GENERATED)
13
14 # Workaround for missing titles
15 $(SOURCE).xml: $(SOURCE)-body.xml Makefile book.xml bookinfo.xml
16 xmllint --nonet --xinclude --postvalid book.xml > $@.new && \
17 mv $@.new $@
18
19 $(SOURCE).pdf: $(SOURCE).xml Makefile pdf.xsl
20 dblatex $(DBLATEX_OPTS) $(SOURCE).xml -o $@
21
22 $(SOURCE)-body.xml: $(SOURCE)-body.rst Makefile
23 pandoc -s -o $@ $(PANDOC_OPTS) $(SOURCE)-body.rst
24 sed -i \
25 -e 's%“%<quote>%g' \
26 -e 's%”%</quote>%g' $@
27
28 po/$(SOURCE).pot: $(SOURCE).xml
29 po4a-gettextize -f docbook -m $(SOURCE).xml \
30 -M UTF-8 -L UTF-8 \
31 --package-name "How to Destroy Surveillance Capitalism" \
32 --copyright-holder "Cory Doctorow" \
33 --package-version "n/a" \
34 | sed 's/CHARSET/UTF-8/' > $@.new && mv $@.new $@
35 po/$(SOURCE).%.po: po/$(SOURCE).pot
36 po4a --no-translations --msgmerge-opt --no-location po4a.cfg
37
38 $(SOURCE).nb.xml: po/$(SOURCE).nb.po $(SOURCE).xml
39 po4a --translate-only $(SOURCE).nb.xml po4a.cfg
40 $(SOURCE).nb.pdf: $(SOURCE).nb.xml Makefile pdf.xsl
41 dblatex $(DBLATEX_OPTS) $(SOURCE).nb.xml -o $@
42
43 $(SOURCE).pl.xml: po/$(SOURCE).pl.po $(SOURCE).xml
44 po4a --translate-only $(SOURCE).pl.xml po4a.cfg
45 $(SOURCE).pl.pdf: $(SOURCE).pl.xml Makefile pdf.xsl
46 dblatex $(DBLATEX_OPTS) $(SOURCE).pl.xml -o $@
47
48 .xml.epub:
49 dbtoepub -s epub.xsl $^ -o $@
50
51 .xml.html:
52 xmlto -x docbook-utf8.xsl -m pdf.xsl html-nochunks $^
53
54 XMLLINTOPTS = --nonet --noout --xinclude --postvalid
55 lint: book.xml
56 xmllint $(XMLLINTOPTS) $^
57
58 clean:
59 $(RM) *~ $(GENERATED) $(SOURCE).xml
60
61 distclean: clean
62
63 stats:
64 for f in po/*.po; do printf "$$f "; msgfmt --output /dev/null --statistics $$f; done
65
66 .SUFFIXES: .xml .html .pdf .epub