]> pere.pagekite.me Git - text-free-culture-lessig.git/blob - Makefile
Another format proposal for Licentia.
[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 db2latex \
14 --backend=xetex \
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
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
54 html: freeculture.html freeculture.nb.html
55
56 %.pdf: %.xml $(IMAGES) $(PDF_XSLT)
57 # $(DBLATEX) $<
58
59 # Alternative processing path to dblatex is to use xmlto using fop to
60 # create PDF like this. The PDF output (visual design) is better, but
61 # the footnote handling is worse and images are missing.
62 # xmlto --noautosize \
63 # -x data/stylesheet-fo.xsl \
64 # --with-fop pdf $<
65
66 # Third alternative is to use xsltproc and fop directly, as
67 # recommended by <URL: http://www.sagehill.net/docbookxsl/index.html > .
68 # This include images, but the index refs and footnote handling is
69 # broken.
70 xsltproc \
71 --output myfile.fo \
72 data/stylesheet-fo.xsl \
73 $<
74 fop -c data/fop-params.xconf -fo myfile.fo -pdf $@
75
76 %.html: %.xml $(IMAGES) $(HTML_XSLT)
77 xmlto \
78 -x data/stylesheet-html.xsl \
79 html-nochunks \
80 $<
81
82 %.txt: %.xml $(IMAGES)
83 xmlto txt $<
84
85 %.epub: %.xml $(IMAGES)
86 $(DBTOEPUB) $<
87
88 freeculture.xml:
89 GET $(url) | gunzip > freeculture.xml
90
91 freeculture.pot: freeculture.xml
92 po4a-gettextize -f docbook -m $^ > $@.new && mv $@.new $@
93
94 stats: update-stats progress.png
95 update-stats: freeculture.nb.po
96 ( \
97 printf "%s " $$(date +"%Y-%m-%dT%H%M") ; \
98 msgfmt -o /dev/null --statistics freeculture.nb.po 2>&1 \
99 ) | tee -a stats.txt
100 progress.png: stats.txt progress.gnuplot
101 awk '{print $$1, $$2, $$5, $$8}' < stats.txt > stats.csv
102 gnuplot progress.gnuplot
103 rm stats.csv
104
105 # Have to disable --postvalid, when using xref with xrefstyle.
106 # See <URL: http://bugs.debian.org/682944 > for the bug report.
107 XMLLINTOPTS = --nonet --noout --xinclude --postvalid
108 lint: freeculture.xml
109 xmllint $(XMLLINTOPTS) freeculture.xml
110
111 lint.nb: freeculture.nb.xml
112 xmllint $(XMLLINTOPTS) freeculture.nb.xml
113
114 images/cc.svg:
115 wget -O $@ http://upload.wikimedia.org/wikipedia/commons/9/97/CC_some_rights_reserved_new_2.svg
116
117 images/cc.png: images/cc.svg
118 inkscape -z -D --export-height=200 -D --export-png=$(shell pwd)/$@ $^