comparison en/Makefile @ 149:16f02802f448

Start to produce saner HTML and CSS. Drop the "beta" targets for now (forever?).
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 08 Mar 2007 22:51:50 -0800
parents 65f6f9d18fa1
children cf24633b8de7
comparison
equal deleted inserted replaced
148:6a5864c09879 149:16f02802f448
26 image-sources := \ 26 image-sources := \
27 filelog.svg \ 27 filelog.svg \
28 kdiff3.png \ 28 kdiff3.png \
29 metadata.svg \ 29 metadata.svg \
30 mq-stack.svg \ 30 mq-stack.svg \
31 note.png \
31 revlog.svg \ 32 revlog.svg \
32 snapshot.svg \ 33 snapshot.svg \
33 tour-history.svg \ 34 tour-history.svg \
34 tour-merge-conflict.svg \ 35 tour-merge-conflict.svg \
35 tour-merge-merge.svg \ 36 tour-merge-merge.svg \
97 image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png) 98 image-pdf := $(image-dot:%.dot=%.pdf) $(image-svg:%.svg=%.pdf) $(image-png)
98 99
99 pdf/hgbook.pdf: $(sources) $(image-pdf) examples 100 pdf/hgbook.pdf: $(sources) $(image-pdf) examples
100 $(call pdf) 101 $(call pdf)
101 102
102 html: html/onepage/hgbook.html html/split/hgbook.html 103 html: onepage split
104
105 onepage: html/onepage/hgbook.html
106
107 split: html/split/hgbook.html
103 108
104 # This is a horrible hack to work around the fact that the htlatex 109 # This is a horrible hack to work around the fact that the htlatex
105 # command in tex4ht is itself a horrible hack. I really don't want to 110 # command in tex4ht is itself a horrible hack. I really don't want to
106 # include verbatim the big wad of TeX that is repeated in that script, 111 # include verbatim the big wad of TeX that is repeated in that script,
107 # so instead I mangle the script itself. 112 # so instead I mangle the script itself.
113 echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book 118 echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
114 echo '(cd $(dir $@) && makeindex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book 119 echo '(cd $(dir $@) && makeindex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book
115 head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book 120 head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book
116 echo 'echo status $$$$' >> $(dir $(1))/htlatex.book 121 echo 'echo status $$$$' >> $(dir $(1))/htlatex.book
117 chmod 755 $(dir $(1))/htlatex.book 122 chmod 755 $(dir $(1))/htlatex.book
118 TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1) 123 TEXINPUTS=$(dir $(2)): $(dir $(1))/htlatex.book $(2) "bookhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
119 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf 124 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
120 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1))) 125 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
121 perl -pi -e 's/&#x00([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html 126 ./fixhtml.py $(dir $(1))/*.html
122 endef 127 endef
123 128
124 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png) 129 image-html := $(image-dot:%.dot=%.png) $(image-svg:%.svg=%.png) $(image-png)
125 130
126 html/onepage/hgbook.html: $(sources) $(image-html) examples 131 html/onepage/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
127 $(call htlatex,$@,$<) 132 $(call htlatex,$@,$<)
128 cp $(image-sources:%.svg=%.png) $(dir $@) 133 cp $(image-sources:%.svg=%.png) $(dir $@)
134 cp hgbook.css $(dir $@)
129 135
130 html/split/hgbook.html: $(sources) $(image-html) examples 136 html/split/hgbook.html: $(sources) $(image-html) examples hgbook.css bookhtml.cfg
131 $(call htlatex,$@,$<,2) 137 $(call htlatex,$@,$<,2)
132 cp $(image-sources:%.svg=%.png) $(dir $@) 138 cp $(image-sources:%.svg=%.png) $(dir $@)
133 139 cp hgbook.css $(dir $@)
134 beta: beta/pdf/hgbook.pdf beta/html/onepage/hgbook.html beta/html/split/hgbook.html
135
136 beta/%.tex: %.tex
137 ./fblinks $(hg_id) $(dir $@) $<
138
139 beta/pdf/hgbook.pdf: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.pdf) examples fblinks
140 $(call pdf)
141
142 beta/html/onepage/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
143 $(call htlatex,$@,$<)
144 cp $(image-sources:%.svg=%.png) $(dir $@)
145
146 beta/html/split/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
147 $(call htlatex,$@,$<,2)
148 cp $(image-sources:%.svg=%.png) $(dir $@)
149 140
150 # Produce 90dpi PNGs for the web. 141 # Produce 90dpi PNGs for the web.
151 142
152 %.png: %.svg 143 %.png: %.svg
153 inkscape -D -e $@ $< 144 inkscape -D -e $@ $<
176 167
177 build_id.tex: $(wildcard ../.hg/00changelog.[id]) 168 build_id.tex: $(wildcard ../.hg/00changelog.[id])
178 echo -n $(hg_id) > build_id.tex 169 echo -n $(hg_id) > build_id.tex
179 170
180 clean: 171 clean:
181 rm -rf beta html pdf \ 172 rm -rf html pdf \
182 $(image-dot:%.dot=%.pdf) \ 173 $(image-dot:%.dot=%.pdf) \
183 $(image-dot:%.dot=%.png) \ 174 $(image-dot:%.dot=%.png) \
184 $(image-svg:%.svg=%.pdf) \ 175 $(image-svg:%.svg=%.pdf) \
185 $(image-svg:%.svg=%.png) \ 176 $(image-svg:%.svg=%.png) \
186 examples/*.{lxo,run} examples/.run build_id.tex 177 examples/*.{lxo,run} examples/.run build_id.tex