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