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