comparison en/Makefile @ 213:18cffee85038

Fix build of HTML pages with PNG images.
author Bryan O'Sullivan <bos@serpentine.com>
date Wed, 09 May 2007 15:17:10 -0700
parents 6f167e644762
children 154e4ba293e7
comparison
equal deleted inserted replaced
212:ef8a5e393103 213:18cffee85038
49 wdir-pre-branch.svg 49 wdir-pre-branch.svg
50 50
51 image-dot := $(filter %.dot,$(image-sources)) 51 image-dot := $(filter %.dot,$(image-sources))
52 image-svg := $(filter %.svg,$(image-sources)) 52 image-svg := $(filter %.svg,$(image-sources))
53 image-png := $(filter %.png,$(image-sources)) 53 image-png := $(filter %.png,$(image-sources))
54
55 image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png)
56 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
54 57
55 example-sources := \ 58 example-sources := \
56 backout \ 59 backout \
57 bisect \ 60 bisect \
58 branching \ 61 branching \
116 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) 119 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
117 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) 120 TEXINPUTS=$(dir $<): pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
118 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi 121 if grep 'Reference.*undefined' $(@:.pdf=.log); then exit 1; fi
119 endef 122 endef
120 123
121 image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png)
122
123 pdf/hgbook.pdf: $(sources) $(image-pdf) examples 124 pdf/hgbook.pdf: $(sources) $(image-pdf) examples
124 $(call pdf) 125 $(call pdf)
125 126
126 html: onepage split 127 html: onepage split
127 128
128 htlatex := /usr/bin/htlatex 129 htlatex := /usr/bin/htlatex
129 130
130 onepage: $(htlatex) html/onepage/hgbook.html 131 onepage: $(htlatex) html/onepage/hgbook.html html/onepage/hgbook.css $(image-html:%=html/onepage/%)
131 132
132 split: $(htlatex) html/split/hgbook.html 133 html/onepage/%: %
134 cp $< $@
135
136 split: $(htlatex) html/split/hgbook.html html/split/hgbook.css $(image-html:%=html/split/%)
137
138 html/split/%: %
139 cp $< $@
133 140
134 # This is a horrible hack to work around the fact that the htlatex 141 # This is a horrible hack to work around the fact that the htlatex
135 # command in tex4ht is itself a horrible hack. I really don't want to 142 # command in tex4ht is itself a horrible hack. I really don't want to
136 # include verbatim the big wad of TeX that is repeated in that script, 143 # include verbatim the big wad of TeX that is repeated in that script,
137 # but I've given up and run a hacked copy as htlatex.book here. 144 # but I've given up and run a hacked copy as htlatex.book here.
143 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf 150 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
144 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1))) 151 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
145 ./fixhtml.py $(dir $(1))/*.html 152 ./fixhtml.py $(dir $(1))/*.html
146 endef 153 endef
147 154
148 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png) 155 html/onepage/hgbook.html: $(sources) $(image-html) examples bookhtml.cfg
149
150 html/onepage/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
151 $(call htlatex,$@,$<) 156 $(call htlatex,$@,$<)
152 cp $(image-sources:%.svg=%.png) $(dir $@) 157
153 cp hgbook.css $(dir $@) 158 html/split/hgbook.html: $(sources) examples bookhtml.cfg
154
155 html/split/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
156 $(call htlatex,$@,$<,2) 159 $(call htlatex,$@,$<,2)
157 cp $(image-sources:%.svg=%.png) $(dir $@)
158 cp hgbook.css $(dir $@)
159 160
160 # Produce 90dpi PNGs for the web. 161 # Produce 90dpi PNGs for the web.
161 162
162 %.png: %.svg 163 %.png: %.svg
163 inkscape -D -e $@ $< 164 inkscape -D -e $@ $<