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