]> pere.pagekite.me Git - text-free-culture-lessig.git/blob - Makefile
Save one translation term.
[text-free-culture-lessig.git] / Makefile
1 #
2 # configuration here:
3 #
4
5 url = http://www.sslug.dk/~chlor/lessig/freeculture.sgml.2004-04-01.gz
6
7 # PDF rule
8 # Valid book options are a4paper, a5paper, b5paper, letterpaper,
9 # legalpaper, landscape, 11pt, 12pt, oneside, twocolumn, notitlepage,
10 # titlepage, openany, draft, fleqn, leqno
11 DBLATEX = dblatex \
12 -P latex.class.options=a5paper \
13 -T db2latex \
14 --backend=xetex \
15 --param lingua=nb \
16 --xsl-user=data/user_param.xsl \
17 --xsl-user=data/xetex_param.xsl \
18 -p data/pdf.xsl
19
20 DBTOEPUB = dbtoepub
21
22 IMAGES = images/cc.png
23
24 XSLTS = \
25 data/user_param.xsl
26
27 DB_XSLT = \
28 data/xetex_param.xsl
29
30 HTML_XSLT = \
31 $(XSLT) \
32 data/html.xsl \
33 data/stylesheet-html.xsl
34
35 PDF_XSLT = \
36 $(XSLT) \
37 data/lulu.xsl \
38 data/pdf.xsl \
39 data/stylesheet-fo.xsl
40
41
42 all: lint lint.nb html epub pdf
43
44 freeculture.nb.po: freeculture.pot
45 po4a --no-translations --msgmerge-opt --no-location po4a.cfg
46
47 freeculture.nb.xml: freeculture.nb.po freeculture.xml
48 po4a --translate-only freeculture.nb.xml po4a.cfg
49
50 pdf: freeculture.nb.pdf freeculture.pdf
51 epub: freeculture.nb.epub
52 html: freeculture.html freeculture.nb.html
53
54 %.pdf: %.xml $(IMAGES) $(PDF_XSLTS)
55 # $(DBLATEX) $<
56
57 # Alternative processing path to dblatex is to use xmlto using fop to
58 # create PDF like this. The PDF output (visual design) is better, but
59 # the footnote handling is worse and images are missing.
60 # xmlto --noautosize \
61 # -x data/stylesheet-fo.xsl \
62 # --with-fop pdf $<
63
64 # Third alternative is to use xsltproc and fop directly, as
65 # recommended by <URL: http://www.sagehill.net/docbookxsl/index.html > .
66 # This include images, but the index refs and footnote handling is
67 # broken.
68 xsltproc \
69 --output myfile.fo \
70 data/stylesheet-fo.xsl \
71 $<
72 fop -c data/fop-params.xconf -fo myfile.fo -pdf $@
73
74 %.html: %.xml $(IMAGES) $(HTML_XSLT)
75 xmlto \
76 -x data/stylesheet-html.xsl \
77 html-nochunks \
78 $<
79
80 %.txt: %.xml $(IMAGES)
81 xmlto txt $<
82
83 %.epub: %.xml $(IMAGES)
84 $(DBTOEPUB) $<
85
86 freeculture.xml:
87 GET $(url) | gunzip > freeculture.xml
88
89 freeculture.pot: freeculture.xml
90 po4a-gettextize -f docbook -m $^ > $@.new && mv $@.new $@
91
92 stats: update-stats progress.png
93 update-stats: freeculture.nb.po
94 ( \
95 printf "%s " $$(date +"%Y-%m-%dT%H%M") ; \
96 msgfmt -o /dev/null --statistics freeculture.nb.po 2>&1 \
97 ) | tee -a stats.txt
98 progress.png: stats.txt progress.gnuplot
99 awk '{print $$1, $$2, $$5, $$8}' < stats.txt > stats.csv
100 gnuplot progress.gnuplot
101 rm stats.csv
102
103 # Have to disable --postvalid, when using xref with xrefstyle.
104 # See <URL: http://bugs.debian.org/682944 > for the bug report.
105 XMLLINTOPTS = --nonet --noout --xinclude --postvalid
106 lint: freeculture.xml
107 xmllint $(XMLLINTOPTS) freeculture.xml
108
109 lint.nb: freeculture.nb.xml
110 xmllint $(XMLLINTOPTS) freeculture.nb.xml
111
112 images/cc.svg:
113 wget -O $@ http://upload.wikimedia.org/wikipedia/commons/9/97/CC_some_rights_reserved_new_2.svg
114
115 images/cc.png: images/cc.svg
116 inkscape -z -D --export-height=200 -D --export-png=$(shell pwd)/$@ $^