hgbook
annotate 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.
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 |
rev | line source |
---|---|
bos@2 | 1 sources := \ |
bos@2 | 2 00book.tex \ |
bos@2 | 3 99book.bib \ |
bos@2 | 4 99defs.tex \ |
bos@2 | 5 mq.tex |
bos@0 | 6 |
bos@4 | 7 example-sources := \ |
bos@4 | 8 examples/run-example \ |
bos@4 | 9 examples/mq.qinit-help |
bos@4 | 10 |
bos@0 | 11 latex-options = \ |
bos@0 | 12 -interaction batchmode \ |
bos@0 | 13 -output-directory $(dir $(1)) \ |
bos@0 | 14 -jobname $(basename $(notdir $(1))) |
bos@0 | 15 |
bos@0 | 16 all: pdf html |
bos@0 | 17 |
bos@0 | 18 pdf: pdf/hgbook.pdf |
bos@0 | 19 |
bos@4 | 20 pdf/hgbook.pdf: $(sources) examples |
bos@0 | 21 mkdir -p $(dir $@) |
bos@0 | 22 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) |
bos@2 | 23 cp 99book.bib $(dir $@) |
bos@2 | 24 cd $(dir $@) && bibtex $(basename $(notdir $@)) |
bos@0 | 25 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) |
bos@0 | 26 pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) |
bos@0 | 27 |
bos@0 | 28 html: html/onepage/hgbook.html html/split/hgbook.html |
bos@0 | 29 |
bos@0 | 30 define htlatex |
bos@0 | 31 mkdir -p $(dir $(1)) |
bos@0 | 32 head -4 $(shell which htlatex) > $(dir $(1))/htlatex.book |
bos@0 | 33 chmod 755 $(dir $(1))/htlatex.book |
bos@0 | 34 $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1) |
bos@0 | 35 cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf |
bos@0 | 36 cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1))) |
bos@0 | 37 endef |
bos@0 | 38 |
bos@4 | 39 html/onepage/hgbook.html: $(sources) examples |
bos@0 | 40 $(call htlatex,$@,$<) |
bos@0 | 41 |
bos@4 | 42 html/split/hgbook.html: $(sources) examples |
bos@0 | 43 $(call htlatex,$@,$<,2) |
bos@0 | 44 |
bos@4 | 45 .PHONY: examples |
bos@4 | 46 |
bos@4 | 47 examples: examples/.run |
bos@4 | 48 |
bos@4 | 49 examples/.run: $(example-sources) |
bos@4 | 50 cd examples && ./run-example |
bos@4 | 51 |
bos@0 | 52 clean: |
bos@0 | 53 rm -rf html pdf *.aux *.dvi *.log *.out |