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