]> pere.pagekite.me Git - text-free-culture-lessig.git/blob - Makefile
Add rule to make text version.
[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 --xsl-user=data/user_param.xsl \
16 --xsl-user=data/xetex_param.xsl \
17 -p data/pdf.xsl \
18 --param=lingua=nb
19
20 DBTOEPUB = dbtoepub
21
22 IMAGES = images/cc.png
23
24 all: lint lint.nb html epub pdf
25
26 freeculture.nb.po: freeculture.pot
27 po4a --no-translations --msgmerge-opt --no-location po4a.cfg
28
29 freeculture.nb.xml: freeculture.nb.po freeculture.xml
30 po4a --translate-only freeculture.nb.xml po4a.cfg
31
32 pdf: freeculture.nb.pdf freeculture.pdf
33 epub: freeculture.nb.epub
34 html: freeculture.html freeculture.nb.html
35
36 %.pdf: %.xml $(IMAGES)
37 $(DBLATEX) $< --param=lingua=nb
38
39 # Alternative processing path to dblatex is to use xmlto using fop to
40 # create PDF like this. The PDF output (visual design) is better, but
41 # the PDF index and footnote handling is worse and images are missing.
42 # xmlto --noautosize -m xmlto-pdf.xsl --with-fop pdf $^
43
44 %.html: %.xml $(IMAGES)
45 xmlto html-nochunks $<
46
47 %.txt: %.xml $(IMAGES)
48 xmlto txt $<
49
50 %.epub: %.xml, $(IMAGES)
51 $(DBTOEPUB) $^ $<
52
53 freeculture.xml:
54 GET $(url) | gunzip > freeculture.xml
55
56 freeculture.pot: freeculture.xml
57 po4a-gettextize -f docbook -m $^ > $@.new && mv $@.new $@
58
59 stats: update-stats progress.png
60 update-stats:
61 ( \
62 printf "%s " $$(date +"%Y-%m-%dT%H%M") ; \
63 msgfmt -o /dev/null --statistics freeculture.nb.po 2>&1 \
64 ) | tee -a stats.txt
65 progress.png: stats.txt progress.gnuplot
66 awk '{print $$1, $$2, $$5, $$8}' < stats.txt > stats.csv
67 gnuplot progress.gnuplot
68 rm stats.csv
69
70 # Have to disable --postvalid, when using xref with xrefstyle.
71 # See <URL: http://bugs.debian.org/682944 > for the bug report.
72 XMLLINTOPTS = --nonet --noout --xinclude --postvalid
73 lint: freeculture.xml
74 xmllint $(XMLLINTOPTS) freeculture.xml
75
76 lint.nb: freeculture.nb.xml
77 xmllint $(XMLLINTOPTS) freeculture.nb.xml
78
79 images/cc.svg:
80 wget -O $@ http://upload.wikimedia.org/wikipedia/commons/9/97/CC_some_rights_reserved_new_2.svg
81
82 images/cc.png: images/cc.svg
83 inkscape -z -D --export-height=200 -D --export-png=$(shell pwd)/$@ $^