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