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