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