]> pere.pagekite.me Git - text-free-culture-lessig.git/blob - Makefile
Rydd i språket og fullfør teksten.
[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.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 pdf: freeculture.nb.pdf freeculture.fr.pdf freeculture.pdf
75 epub: freeculture.nb.epub freeculture.fr.epub freeculture.epub
76 mobi: freeculture.nb.mobi freeculture.fr.mobi freeculture.mobi
77 html: freeculture.nb.html freeculture.fr.html freeculture.html
78
79 %.pdf: %.xml $(IMAGES) $(PDF_XSLT) Makefile myclass.cls data/dblatex-postprocess
80 # Possible pipelines:
81 #
82 # dblatex:
83 # This converts the docbook content to latex and leave it to latex
84 # to format it. Index ranges are broken in oldstable, fixed in jessie.
85 #
86 # xmlto:
87 # Alternative processing path to dblatex is to use xmlto using fop
88 # to create PDF like this. The PDF output (visual design) is
89 # better, but the footnote handling is worse and images are missing.
90 #
91 # docbook-xsl:
92 # Third alternative is to use xsltproc and fop directly, as
93 # recommended by <URL: http://www.sagehill.net/docbookxsl/index.html >.
94 # This include images, but the index refs and footnote/endnote handling
95 # is broken.
96
97 pipeline=dblatex; \
98 echo "Using $$pipeline pipeline" ; \
99 case "$$pipeline" in \
100 dblatex) \
101 PATH=$(PWD)/bin:$$PATH $(DBLATEX) $(DBLATEX_OPTS) $< ; \
102 ;; \
103 xmlto) \
104 xmlto --noautosize \
105 -x data/stylesheet-fo.xsl \
106 --with-fop pdf $< ; \
107 ;; \
108 docbook-xsl) \
109 xsltproc \
110 --output $(subst .pdf,.fo,$@) \
111 data/stylesheet-fo.xsl \
112 $< ; \
113 fop -c data/fop-params.xconf -fo $(subst .pdf,.fo,$@) -pdf $@ ; \
114 ;; \
115 esac
116
117 pdf-compare: freeculture.xml $(IMAGES)
118 $(DBLATEX) -o freeculture-dblatex.pdf freeculture.xml
119 $(DBLATEX) -T db2latex \-o freeculture-dblatex-db2latex.pdf freeculture.xml
120
121 # plain xmlto fail
122 #xmlto pdf freeculture.xml && mv freeculture.pdf freeculture-xmlto.pdf
123 xmlto --with-fop pdf freeculture.xml && mv freeculture.pdf freeculture-xmlto-fop.pdf
124
125 xsltproc --output freeculture-docbook-xsl.fo \
126 /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl \
127 freeculture.xml
128 fop -fo freeculture-docbook-xsl.fo -pdf freeculture-docbook-xsl.pdf
129
130 %.html: %.xml $(IMAGES) $(HTML_XSLT)
131 xmlto \
132 -x data/stylesheet-html.xsl \
133 html-nochunks \
134 $<
135
136 %.txt: %.xml $(IMAGES)
137 xmlto txt $<
138
139 %.epub: %.xml $(IMAGES) $(EPUB_XSLT)
140 $(DBTOEPUB) \
141 -s data/stylesheet-epub.xsl \
142 $<
143
144 %.mobi: %.epub
145 ebook-convert $< $@
146
147 freeculture.xml:
148 GET $(url) | gunzip > freeculture.xml
149
150 # <beginpage> workaround can be removed when BTS #684137 is fixed in
151 # po4a.
152 freeculture.pot: freeculture.xml cover-text.xml
153 po4a-gettextize -o nodefault='<beginpage>' -o inline='<beginpage>' \
154 -o attributes='href' \
155 -f docbook -m freeculture.xml -m cover-text.xml > $@.new && mv $@.new $@
156
157 stats: update-stats progress.png
158 update-stats: freeculture.nb.po lint.nb
159 ( \
160 printf "%s " $$(date +"%Y-%m-%dT%H%M") ; \
161 msgfmt -o /dev/null --statistics freeculture.nb.po 2>&1 \
162 ) \
163 | sed -e 's/translated messages/oversatte meldinger/' -e 's/fuzzy translations/antatte oversettelser/' -e 's/untranslated messages/oversatte meldinger/' \
164 | tee -a stats.txt
165 progress.png: stats.txt progress.gnuplot
166 awk '{print $$1, $$2, $$5, $$8}' < stats.txt > stats.csv
167 gnuplot progress.gnuplot
168 rm stats.csv
169
170 # Have to disable --postvalid, when using xref with xrefstyle.
171 # See <URL: http://bugs.debian.org/682944 > for the bug report.
172 XMLLINTOPTS = --nonet --noout --xinclude --postvalid
173 lint: freeculture.xml
174 xmllint $(XMLLINTOPTS) freeculture.xml
175
176 lint.nb: freeculture.nb.xml
177 xmllint $(XMLLINTOPTS) freeculture.nb.xml
178
179 lint.fr: freeculture.fr.xml
180 xmllint $(XMLLINTOPTS) freeculture.fr.xml
181
182 images/cc.svg:
183 wget -O $@ http://upload.wikimedia.org/wikipedia/commons/9/97/CC_some_rights_reserved_new_2.svg
184
185 images/cc.png: images/cc.svg
186 inkscape -z -D --export-height=200 -D --export-png=$(shell pwd)/$@ $^
187
188 images/cover-art.pdf: images/cover-art.svg
189 inkscape --export-dpi=600 --export-pdf=$@ $^
190
191 images/nb/cover-art.pdf: images/nb/cover-art.svg
192 inkscape --export-dpi=600 --export-pdf=$@ $^
193
194 images/fr/cover-art.pdf: images/fr/cover-art.svg
195 inkscape --export-dpi=600 --export-pdf=$@ $^
196
197 INKSCAPE_FRONTCOORDINATES = 603.54:0:1154.70:832.500
198 images/cover-front-72dpi.png: images/cover-art.svg Makefile
199 inkscape --export-dpi=72 --export-png=$@ -a $(INKSCAPE_FRONTCOORDINATES) images/cover-art.svg
200
201 images/nb/cover-front-72dpi.png: images/nb/cover-art.svg Makefile
202 inkscape --export-dpi=72 --export-png=$@ -a $(INKSCAPE_FRONTCOORDINATES) images/nb/cover-art.svg
203
204 images/fr/cover-front-72dpi.png: images/fr/cover-art.svg Makefile
205 inkscape --export-dpi=72 --export-png=$@ -a $(INKSCAPE_FRONTCOORDINATES) images/fr/cover-art.svg
206
207 images/cover-front-10dpi.png: images/cover-art.svg Makefile
208 inkscape --export-dpi=10 --export-png=$@ -a $(INKSCAPE_FRONTCOORDINATES) images/cover-art.svg
209
210 images/nb/cover-front-10dpi.png: images/nb/cover-art.svg Makefile
211 inkscape --export-dpi=10 --export-png=$@ -a $(INKSCAPE_FRONTCOORDINATES) images/nb/cover-art.svg
212
213 images/fr/cover-front-10dpi.png: images/fr/cover-art.svg Makefile
214 inkscape --export-dpi=10 --export-png=$@ -a $(INKSCAPE_FRONTCOORDINATES) images/fr/cover-art.svg
215
216 .xcf.png:
217 convert $^ $@
218
219 clean:
220 $(RM) *~
221
222 distclean: clean
223 $(RM) \
224 freeculture.pdf \
225 freeculture.epub \
226 freeculture.html \
227 freeculture.txt \
228 freeculture.mobi \
229 freeculture.nb.pdf \
230 freeculture.nb.epub \
231 freeculture.nb.html \
232 freeculture.nb.txt \
233 freeculture.nb.mobi \
234 freeculture.nb.xml \
235 freeculture.fr.pdf \
236 freeculture.fr.epub \
237 freeculture.fr.html \
238 freeculture.fr.txt \
239 freeculture.fr.mobi \
240 freeculture.fr.xml \
241 freeculture-docbook-xsl.pdf \
242 freeculture-docbook-xsl.fo \
243 freeculture-dblatex-db2latex.pdf \
244 freeculture-dblatex.pdf \
245 freeculture-xmlto-fop.pdf
246
247 .SUFFIXES: .png .xcf .svg .xml .pdf