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