hgbook
diff en/Makefile @ 18:e6f4088ebe52
Generate a PDF file with a feedback link on each paragraph.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Tue Jul 04 16:41:31 2006 -0700 (2006-07-04) |
parents | 81454425eee9 |
children | 187702df428b ce3339dbeb6f |
line diff
1.1 --- a/en/Makefile Mon Jul 03 22:43:52 2006 -0700 1.2 +++ b/en/Makefile Tue Jul 04 16:41:31 2006 -0700 1.3 @@ -1,3 +1,7 @@ 1.4 +# This makefile requires GNU make. 1.5 + 1.6 +hg_id := $(shell hg id 2>/dev/null | sed -e 's/ tip\>//' -e 's/ /,/g' || echo external) 1.7 + 1.8 sources := \ 1.9 00book.tex \ 1.10 99book.bib \ 1.11 @@ -23,7 +27,7 @@ 1.12 1.13 pdf: pdf/hgbook.pdf 1.14 1.15 -pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%_pdf.png) examples 1.16 +define pdf 1.17 mkdir -p $(dir $@) 1.18 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) 1.19 cp 99book.bib $(dir $@) 1.20 @@ -31,9 +35,18 @@ 1.21 cd $(dir $@) && makeindex $(basename $(notdir $@)) 1.22 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) 1.23 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) 1.24 +endef 1.25 + 1.26 +pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%_pdf.png) examples 1.27 + $(call pdf) 1.28 1.29 html: html/onepage/hgbook.html html/split/hgbook.html 1.30 1.31 +# This is a horrible hack to work around the fact that the htlatex 1.32 +# command in tex4ht is itself a horrible hack. I really don't want to 1.33 +# include verbatim the big wad of TeX that is repeated in that script, 1.34 +# so instead I mangle the script itself. 1.35 + 1.36 define htlatex 1.37 mkdir -p $(dir $(1)) 1.38 head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book 1.39 @@ -57,25 +70,40 @@ 1.40 $(call htlatex,$@,$<,2) 1.41 cp $(image-sources:%.svg=%.png) $(dir $@) 1.42 1.43 +beta: beta/pdf/hgbook.pdf beta/html/onepage/hgbook.html beta/html/split/hgbook.html 1.44 + 1.45 +beta/%.tex: %.tex 1.46 + ./fblinks $(hg_id) $(dir $@) $< 1.47 + 1.48 +beta/pdf/hgbook.pdf: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%_pdf.png) examples fblinks 1.49 + $(call pdf) 1.50 + 1.51 +beta/html/onepage/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples 1.52 + $(call htlatex,$@,$<) 1.53 + cp $(image-sources:%.svg=%.png) $(dir $@) 1.54 + 1.55 +beta/html/split/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples 1.56 + $(call htlatex,$@,$<,2) 1.57 + cp $(image-sources:%.svg=%.png) $(dir $@) 1.58 + 1.59 +# Produce 90dpi PNGs for the web. 1.60 + 1.61 %.png: %.svg 1.62 inkscape -D -e $@ $< 1.63 1.64 +# Produce 300dpi PNGs for PDF. 1.65 + 1.66 %_pdf.png: %.svg 1.67 inkscape -D -d 300 -e $@ $< 1.68 1.69 -%.eps: %.svg 1.70 - inkscape -E $@ $< 1.71 - 1.72 examples: examples/.run 1.73 1.74 examples/.run: $(example-sources) 1.75 cd examples && ./run-example 1.76 1.77 -build_id.tex: 1.78 - echo 'in-place build' > $@ 1.79 - 1.80 -build_id: 1.81 - hg id | sed -e 's/ tip\>//' > build_id.tex 1.82 +build_id.tex: $(wildcard ../.hg/00changelog.[id]) 1.83 + echo $(hg_id) > build_id.tex 1.84 1.85 clean: 1.86 - rm -rf html pdf *.eps *.png *.aux *.dvi *.log *.out examples/*.out examples/.run buildrev.tex 1.87 + rm -rf beta html pdf *.eps *.png *.aux *.dvi *.log *.out \ 1.88 + examples/*.out examples/.run build_id.tex