hgbook

view en/Makefile @ 4:33a2e7b9978d

Make it possible to include example input and output from real programs.

Instead of having to cut and paste example text, the task is automated.
author Bryan O'Sullivan <bos@serpentine.com>
date Sun Jun 25 22:04:50 2006 -0700 (2006-06-25)
parents 379a802c0210
children 339e75288632
line source
1 sources := \
2 00book.tex \
3 99book.bib \
4 99defs.tex \
5 mq.tex
7 example-sources := \
8 examples/run-example \
9 examples/mq.qinit-help
11 latex-options = \
12 -interaction batchmode \
13 -output-directory $(dir $(1)) \
14 -jobname $(basename $(notdir $(1)))
16 all: pdf html
18 pdf: pdf/hgbook.pdf
20 pdf/hgbook.pdf: $(sources) examples
21 mkdir -p $(dir $@)
22 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
23 cp 99book.bib $(dir $@)
24 cd $(dir $@) && bibtex $(basename $(notdir $@))
25 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
26 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
28 html: html/onepage/hgbook.html html/split/hgbook.html
30 define htlatex
31 mkdir -p $(dir $(1))
32 head -4 $(shell which htlatex) > $(dir $(1))/htlatex.book
33 chmod 755 $(dir $(1))/htlatex.book
34 $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1)
35 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf
36 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1)))
37 endef
39 html/onepage/hgbook.html: $(sources) examples
40 $(call htlatex,$@,$<)
42 html/split/hgbook.html: $(sources) examples
43 $(call htlatex,$@,$<,2)
45 .PHONY: examples
47 examples: examples/.run
49 examples/.run: $(example-sources)
50 cd examples && ./run-example
52 clean:
53 rm -rf html pdf *.aux *.dvi *.log *.out