]> pere.pagekite.me Git - text-free-culture-lessig.git/blob - Makefile
Make sure html.xsl is used when building HTML 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 --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 \
48 # -x data/stylesheet-fo.xsl \
49 # --with-fop pdf $<
50
51 # Third alternative is to use xsltproc and fop directly, as
52 # recommended by <URL: http://www.sagehill.net/docbookxsl/index.html > .
53 # This include images, but the index refs and footnote handling is
54 # broken.
55 xsltproc \
56 --output myfile.fo \
57 data/stylesheet-fo.xsl \
58 $<
59 fop -c data/fop-params.xconf -fo myfile.fo -pdf $@
60
61 %.html: %.xml $(IMAGES)
62 xmlto \
63 -x data/stylesheet-html.xsl \
64 html-nochunks \
65 $<
66
67 %.txt: %.xml $(IMAGES)
68 xmlto txt $<
69
70 %.epub: %.xml $(IMAGES)
71 $(DBTOEPUB) $<
72
73 freeculture.xml:
74 GET $(url) | gunzip > freeculture.xml
75
76 freeculture.pot: freeculture.xml
77 po4a-gettextize -f docbook -m $^ > $@.new && mv $@.new $@
78
79 stats: update-stats progress.png
80 update-stats: freeculture.nb.po
81 ( \
82 printf "%s " $$(date +"%Y-%m-%dT%H%M") ; \
83 msgfmt -o /dev/null --statistics freeculture.nb.po 2>&1 \
84 ) | tee -a stats.txt
85 progress.png: stats.txt progress.gnuplot
86 awk '{print $$1, $$2, $$5, $$8}' < stats.txt > stats.csv
87 gnuplot progress.gnuplot
88 rm stats.csv
89
90 # Have to disable --postvalid, when using xref with xrefstyle.
91 # See <URL: http://bugs.debian.org/682944 > for the bug report.
92 XMLLINTOPTS = --nonet --noout --xinclude --postvalid
93 lint: freeculture.xml
94 xmllint $(XMLLINTOPTS) freeculture.xml
95
96 lint.nb: freeculture.nb.xml
97 xmllint $(XMLLINTOPTS) freeculture.nb.xml
98
99 images/cc.svg:
100 wget -O $@ http://upload.wikimedia.org/wikipedia/commons/9/97/CC_some_rights_reserved_new_2.svg
101
102 images/cc.png: images/cc.svg
103 inkscape -z -D --export-height=200 -D --export-png=$(shell pwd)/$@ $^