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