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