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