hgbook

view it/Makefile @ 879:4688f8ac941d

User should use nxml-mode for emacs
author Dongsheng Song <dongsheng.song@gmail.com>
date Wed Oct 21 15:43:16 2009 +0800 (2009-10-21)
parents 793e15b562ef
children 719b03ea27c8
line source
1 include Makefile.vars
3 # Makefile.vars includes the following system-dependent variables:
4 #
5 # dtd-url = the location of the DocBook 4.5 DTD on your filesystem
6 # system-xsl-dir = the location of DocBook XSLT on your filesystem
7 # dynamic-link-command = the command to link the DocBook XSLT to our styles
8 # python = the location of Python 3.x on your filesystem
10 xml-src-files := \
11 00book.xml \
12 $(wildcard ch*.xml) \
13 $(wildcard app*.xml) \
14 bibliography.xml
16 xsltproc-opts := --nonet --xinclude
17 xmllint-opts := --noout --nonet --valid --path '$(dtd-url)'
19 root-web := html
20 support-web := $(root-web)/support
21 obj-web := $(root-web)/read
22 figs-web-folder := $(obj-web)/figs
23 script-web := $(obj-web)/javascript
24 web-global := ../web
25 web-local := web
27 html: $(obj-web)/index.html $(web-local)/index-read.html.in figs
29 $(obj-web)/index.html: ../stylesheets/system-xsl .validated-00book.xml
30 xsltproc $(xsltproc-opts) -o $(obj-web)/x ../stylesheets/it/web.xsl 00book.xml
31 mkdir -p $(support-web)
32 cp -f $(web-global)/icons/*.png $(support-web)
33 cp $(web-global)/styles.css $(support-web)
34 sed -i -e "s|figs/||g" $(support-web)/styles.css
35 mkdir -p $(figs-web-folder)
36 mkdir -p $(script-web)
37 cp -f $(web-local)/*.js $(script-web)
39 ../stylesheets/system-xsl: $(system-xsl-dir)
40 $(dynamic-link-command)
42 $(web-local)/index-read.html.in: $(web-local)/genindex.py $(xml-src-files)
43 cp $(web-local)/index-template.html $(obj-web)/index.html
44 sed -i -e "s|{% block bodycontent %}{% endblock %}|$(shell cat $(web-local)/index-read.html.in)|g" $(obj-web)/index.html
45 sed -i -e "s|/support/|../support/|g" $(obj-web)/*.html
46 cp $(web-local)/index-template.html $(root-web)/index.html
47 sed -i "s|{% block bodycontent %}{% endblock %}|$(shell cat $(web-local)/index-home.html.in)|g" $(root-web)/index.html
48 sed -i -e "s|/support/|support/|g" $(root-web)/index.html
50 $(web-local)/genindex.py: $(xml-src-files)
51 cd $(web-local) && $(python) genindex.py
53 valid: .validated-00book.xml
55 .validated-00book.xml: $(xml-src-files)
56 xmllint $(xmllint-opts) $<
57 touch $@
59 clean:
60 rm -f $(web-local)/index-read.html.in
61 rm -f .validated-00book.xml
62 rm -rf $(root-web)
64 image-folder := figs
65 # graphs, figures, screenshots
66 image-files := $(wildcard $(image-folder)/*.dot $(image-folder)/*.svg $(image-folder)/*.png)
67 # graphs
68 image-dot := $(filter %.dot, $(image-files))
69 # figures
70 image-svg := $(filter %.svg, $(image-files))
71 # screenshots
72 image-png := $(filter %.png, $(image-files))
74 figs-web := \
75 $(image-dot:$(image-folder)/%.dot=$(figs-web-folder)/%.png) \
76 $(image-svg:$(image-folder)/%.svg=$(figs-web-folder)/%.png) \
77 $(image-png:$(image-folder)/%.png=$(figs-web-folder)/%.png)
79 figs: $(figs-web)
81 $(figs-web-folder)/%.png: $(image-folder)/%.svg
82 inkscape -D -d 120 -e $@ $<
84 $(figs-web-folder)/%.png: $(figs-web-folder)/%.svg
85 inkscape -D -e $@ $<
86 rm $<
88 $(figs-web-folder)/%.png: $(image-folder)/%.png
89 cp $< $@
91 $(figs-web-folder)/%.svg: $(image-folder)/%.dot
92 dot -Tsvg -o $@ $<