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