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