]> pere.pagekite.me Git - text-free-culture-lessig.git/blob - Makefile
Review: add some translated images.
[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 DBLATEX_OPTS = \
14 -T simple \
15 -b xetex \
16 -r data/dblatex-postprocess \
17 --indexstyle=myindexstyle.ist \
18 --xsl-user=data/user_param.xsl \
19 --xsl-user=data/xetex_param.xsl \
20 -V \
21 -P latex.index.tool=xindy \
22 -p data/pdf.xsl
23
24
25 DBTOEPUB = dbtoepub
26
27 IMAGES = \
28 images/cc.png \
29 images/pattern-modern-media-ownership.png \
30 images/tom-the-dancing-bug.png \
31 images/cover-front-10dpi.png \
32 images/cover-front-72dpi.png \
33 images/fr/cover-front-10dpi.png \
34 images/fr/cover-front-72dpi.png \
35 images/nb/cover-front-10dpi.png \
36 images/nb/cover-front-72dpi.png
37
38 XSLT = \
39 data/user_param.xsl
40
41 DB_XSLT = \
42 data/xetex_param.xsl
43
44 HTML_XSLT = \
45 $(XSLT) \
46 data/html.xsl \
47 data/stylesheet-html.xsl
48
49 EPUB_XSLT = \
50 $(XSLT) \
51 data/html.xsl \
52 data/stylesheet-epub.xsl
53
54 PDF_XSLT = \
55 $(DB_XSLT) \
56 $(XSLT) \
57 data/lulu.xsl \
58 data/licentia.xsl \
59 data/pdf.xsl \
60 data/stylesheet-fo.xsl
61
62
63 all: lint lint.nb lint.fr html epub pdf mobi
64
65 freeculture.nb.po freeculture.fr.po freeculture.da.po: freeculture.pot
66 po4a --no-translations --msgmerge-opt --no-location po4a.cfg
67
68 freeculture.nb.xml: freeculture.nb.po freeculture.xml
69 po4a --translate-only freeculture.nb.xml po4a.cfg
70
71 freeculture.fr.xml: freeculture.fr.po freeculture.xml
72 po4a --translate-only freeculture.fr.xml po4a.cfg
73
74 freeculture.da.xml: freeculture.da.po freeculture.xml
75 po4a --translate-only freeculture.da.xml po4a.cfg
76
77 pdf: freeculture.nb.pdf freeculture.fr.pdf freeculture.pdf
78 epub: freeculture.nb.epub freeculture.fr.epub freeculture.epub
79 mobi: freeculture.nb.mobi freeculture.fr.mobi freeculture.mobi
80 html: freeculture.nb.html freeculture.fr.html freeculture.html
81
82 %.pdf: %.xml $(IMAGES) $(PDF_XSLT) Makefile myclass.cls data/dblatex-postprocess
83 # Possible pipelines:
84 #
85 # dblatex:
86 # This converts the docbook content to latex and leave it to latex
87 # to format it. Index ranges are broken in oldstable, fixed in jessie.
88 #
89 # xmlto:
90 # Alternative processing path to dblatex is to use xmlto using fop
91 # to create PDF like this. The PDF output (visual design) is
92 # better, but the footnote handling is worse and images are missing.
93 #
94 # docbook-xsl:
95 # Third alternative is to use xsltproc and fop directly, as
96 # recommended by <URL: http://www.sagehill.net/docbookxsl/index.html >.
97 # This include images, but the index refs and footnote/endnote handling
98 # is broken.
99
100 pipeline=dblatex; \
101 echo "Using $$pipeline pipeline" ; \
102 case "$$pipeline" in \
103 dblatex) \
104 PATH=$(PWD)/bin:$$PATH $(DBLATEX) $(DBLATEX_OPTS) $< ; \
105 ;; \
106 xmlto) \
107 xmlto --noautosize \
108 -x data/stylesheet-fo.xsl \
109 --with-fop pdf $< ; \
110 ;; \
111 docbook-xsl) \
112 xsltproc \
113 --output $(subst .pdf,.fo,$@) \
114 data/stylesheet-fo.xsl \
115 $< ; \
116 fop -c data/fop-params.xconf -fo $(subst .pdf,.fo,$@) -pdf $@ ; \
117 ;; \
118 esac
119
120 pdf-compare: freeculture.xml $(IMAGES)
121 $(DBLATEX) -o freeculture-dblatex.pdf freeculture.xml
122 $(DBLATEX) -T db2latex \-o freeculture-dblatex-db2latex.pdf freeculture.xml
123
124 # plain xmlto fail
125 #xmlto pdf freeculture.xml && mv freeculture.pdf freeculture-xmlto.pdf
126 xmlto --with-fop pdf freeculture.xml && mv freeculture.pdf freeculture-xmlto-fop.pdf
127
128 xsltproc --output freeculture-docbook-xsl.fo \
129 /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl \
130 freeculture.xml
131 fop -fo freeculture-docbook-xsl.fo -pdf freeculture-docbook-xsl.pdf
132
133 %.html: %.xml $(IMAGES) $(HTML_XSLT)
134 xmlto \
135 -x data/stylesheet-html.xsl \
136 html-nochunks \
137 $<
138
139 %.txt: %.xml $(IMAGES)
140 xmlto txt $<
141
142 %.epub: %.xml $(IMAGES) $(EPUB_XSLT)
143 $(DBTOEPUB) \
144 -s data/stylesheet-epub.xsl \
145 $<
146
147 %.mobi: %.epub
148 ebook-convert $< $@
149
150 freeculture.xml:
151 GET $(url) | gunzip > freeculture.xml
152
153 # <beginpage> workaround can be removed when BTS #684137 is fixed in
154 # po4a.
155 freeculture.pot: freeculture.xml cover-text.xml
156 po4a-gettextize -o nodefault='<beginpage>' -o inline='<beginpage>' \
157 -o attributes='href' \
158 -f docbook -m freeculture.xml -m cover-text.xml > $@.new && mv $@.new $@
159
160 stats: update-stats progress.png
161 update-stats: freeculture.nb.po lint.nb
162 ( \
163 printf "%s " $$(date +"%Y-%m-%dT%H%M") ; \
164 msgfmt -o /dev/null --statistics freeculture.nb.po 2>&1 \
165 ) \
166 | sed -e 's/translated messages/oversatte meldinger/' -e 's/fuzzy translations/antatte oversettelser/' -e 's/untranslated messages/oversatte meldinger/' \
167 | tee -a stats.txt
168 progress.png: stats.txt progress.gnuplot
169 awk '{print $$1, $$2, $$5, $$8}' < stats.txt > stats.csv
170 gnuplot progress.gnuplot
171 rm stats.csv
172
173 # Have to disable --postvalid, when using xref with xrefstyle.
174 # See <URL: http://bugs.debian.org/682944 > for the bug report.
175 XMLLINTOPTS = --nonet --noout --xinclude --postvalid
176 lint: freeculture.xml
177 xmllint $(XMLLINTOPTS) freeculture.xml
178
179 lint.nb: freeculture.nb.xml
180 xmllint $(XMLLINTOPTS) freeculture.nb.xml
181
182 lint.fr: freeculture.fr.xml
183 xmllint $(XMLLINTOPTS) freeculture.fr.xml
184
185 lint.da: freeculture.da.xml
186 xmllint $(XMLLINTOPTS) freeculture.da.xml
187
188 images/cc.svg:
189 wget -O $@ http://upload.wikimedia.org/wikipedia/commons/9/97/CC_some_rights_reserved_new_2.svg
190
191 images/cc.png: images/cc.svg
192 inkscape -z -D --export-height=200 -D --export-png=$(shell pwd)/$@ $^
193
194 images/cover-art.pdf: images/cover-art.svg
195 inkscape --export-dpi=600 --export-pdf=$@ $^
196
197 images/nb/cover-art.pdf: images/nb/cover-art.svg
198 inkscape --export-dpi=600 --export-pdf=$@ $^
199
200 images/fr/cover-art.pdf: images/fr/cover-art.svg
201 inkscape --export-dpi=600 --export-pdf=$@ $^
202
203 INKSCAPE_FRONTCOORDINATES = 603.54:0:1154.70:832.500
204 images/cover-front-72dpi.png: images/cover-art.svg Makefile
205 inkscape --export-dpi=72 --export-png=$@ -a $(INKSCAPE_FRONTCOORDINATES) images/cover-art.svg
206
207 images/nb/cover-front-72dpi.png: images/nb/cover-art.svg Makefile
208 inkscape --export-dpi=72 --export-png=$@ -a $(INKSCAPE_FRONTCOORDINATES) images/nb/cover-art.svg
209
210 images/fr/cover-front-72dpi.png: images/fr/cover-art.svg Makefile
211 inkscape --export-dpi=72 --export-png=$@ -a $(INKSCAPE_FRONTCOORDINATES) images/fr/cover-art.svg
212
213 images/cover-front-10dpi.png: images/cover-art.svg Makefile
214 inkscape --export-dpi=10 --export-png=$@ -a $(INKSCAPE_FRONTCOORDINATES) images/cover-art.svg
215
216 images/nb/cover-front-10dpi.png: images/nb/cover-art.svg Makefile
217 inkscape --export-dpi=10 --export-png=$@ -a $(INKSCAPE_FRONTCOORDINATES) images/nb/cover-art.svg
218
219 images/fr/cover-front-10dpi.png: images/fr/cover-art.svg Makefile
220 inkscape --export-dpi=10 --export-png=$@ -a $(INKSCAPE_FRONTCOORDINATES) images/fr/cover-art.svg
221
222 .xcf.png:
223 convert $^ $@
224
225 clean:
226 $(RM) *~
227
228 distclean: clean
229 $(RM) \
230 freeculture.pdf \
231 freeculture.epub \
232 freeculture.html \
233 freeculture.txt \
234 freeculture.mobi \
235 freeculture.nb.pdf \
236 freeculture.nb.epub \
237 freeculture.nb.html \
238 freeculture.nb.txt \
239 freeculture.nb.mobi \
240 freeculture.nb.xml \
241 freeculture.fr.pdf \
242 freeculture.fr.epub \
243 freeculture.fr.html \
244 freeculture.fr.txt \
245 freeculture.fr.mobi \
246 freeculture.fr.xml \
247 freeculture.da.pdf \
248 freeculture.da.epub \
249 freeculture.da.html \
250 freeculture.da.txt \
251 freeculture.da.mobi \
252 freeculture.da.xml \
253 freeculture-docbook-xsl.pdf \
254 freeculture-docbook-xsl.fo \
255 freeculture-dblatex-db2latex.pdf \
256 freeculture-dblatex.pdf \
257 freeculture-xmlto-fop.pdf
258
259 .SUFFIXES: .png .xcf .svg .xml .pdf