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