5 url = http://www.sslug.dk/~chlor/lessig/freeculture.sgml.2004-04-01.gz
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
15 --xsl-user=data/user_param.xsl \
16 --xsl-user=data/xetex_param.xsl \
22 IMAGES = images/cc.png
33 data/stylesheet-html.xsl
40 data/stylesheet-fo.xsl
43 all: lint lint.nb html epub pdf
45 freeculture.nb.po: freeculture.pot
46 po4a --no-translations --msgmerge-opt --no-location po4a.cfg
48 freeculture.nb.xml: freeculture.nb.po freeculture.xml
49 po4a --translate-only freeculture.nb.xml po4a.cfg
51 pdf: freeculture.nb.pdf freeculture.pdf
52 epub: freeculture.nb.epub
53 html: freeculture.html freeculture.nb.html
55 %.pdf: %.xml $(IMAGES) $(PDF_XSLT)
58 # Alternative processing path to dblatex is to use xmlto using fop to
59 # create PDF like this. The PDF output (visual design) is better, but
60 # the footnote handling is worse and images are missing.
61 # xmlto --noautosize \
62 # -x data/stylesheet-fo.xsl \
65 # Third alternative is to use xsltproc and fop directly, as
66 # recommended by <URL: http://www.sagehill.net/docbookxsl/index.html > .
67 # This include images, but the index refs and footnote handling is
70 --output $(subst .pdf,.fo,$@) \
71 data/stylesheet-fo.xsl \
73 fop -c data/fop-params.xconf -fo $(subst .pdf,.fo,$@) -pdf $@
75 pdf-compare: freeculture.xml $(IMAGES)
76 dblatex -o freeculture-dblatex.pdf freeculture.xml
77 dblatex -T db2latex \-o freeculture-dblatex-db2latex.pdf freeculture.xml
80 #xmlto pdf freeculture.xml && mv freeculture.pdf freeculture-xmlto.pdf
81 xmlto --with-fop pdf freeculture.xml && mv freeculture.pdf freeculture-xmlto-fop.pdf
83 xsltproc --output freeculture-docbook-xsl.fo \
84 /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl \
86 fop -fo freeculture-docbook-xsl.fo -pdf freeculture-docbook-xsl.pdf
88 %.html: %.xml $(IMAGES) $(HTML_XSLT)
90 -x data/stylesheet-html.xsl \
94 %.txt: %.xml $(IMAGES)
97 %.epub: %.xml $(IMAGES)
101 GET $(url) | gunzip > freeculture.xml
103 # <beginpage> workaround can be removed when BTS #684137 is fixed in
105 freeculture.pot: freeculture.xml
106 po4a-gettextize -o nodefault='<beginpage>' -o inline='<beginpage>' \
107 -f docbook -m $^ > $@.new && mv $@.new $@
109 stats: update-stats progress.png
110 update-stats: freeculture.nb.po
112 printf "%s " $$(date +"%Y-%m-%dT%H%M") ; \
113 msgfmt -o /dev/null --statistics freeculture.nb.po 2>&1 \
115 progress.png: stats.txt progress.gnuplot
116 awk '{print $$1, $$2, $$5, $$8}' < stats.txt > stats.csv
117 gnuplot progress.gnuplot
120 # Have to disable --postvalid, when using xref with xrefstyle.
121 # See <URL: http://bugs.debian.org/682944 > for the bug report.
122 XMLLINTOPTS = --nonet --noout --xinclude --postvalid
123 lint: freeculture.xml
124 xmllint $(XMLLINTOPTS) freeculture.xml
126 lint.nb: freeculture.nb.xml
127 xmllint $(XMLLINTOPTS) freeculture.nb.xml
130 wget -O $@ http://upload.wikimedia.org/wikipedia/commons/9/97/CC_some_rights_reserved_new_2.svg
132 images/cc.png: images/cc.svg
133 inkscape -z -D --export-height=200 -D --export-png=$(shell pwd)/$@ $^