bos@2: sources := \ bos@2: 00book.tex \ bos@2: 99book.bib \ bos@2: 99defs.tex \ bos@2: mq.tex bos@0: bos@11: image-sources := \ bos@11: mq-stack.svg bos@11: bos@4: example-sources := \ bos@4: examples/run-example \ bos@7: examples/mq.qinit-help \ bos@7: examples/mq.tutorial bos@4: bos@0: latex-options = \ bos@0: -interaction batchmode \ bos@0: -output-directory $(dir $(1)) \ bos@0: -jobname $(basename $(notdir $(1))) bos@0: bos@0: all: pdf html bos@0: bos@0: pdf: pdf/hgbook.pdf bos@0: bos@11: pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%_pdf.png) examples bos@0: mkdir -p $(dir $@) bos@0: pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) bos@2: cp 99book.bib $(dir $@) bos@2: cd $(dir $@) && bibtex $(basename $(notdir $@)) bos@0: pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) bos@0: pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1) bos@0: bos@0: html: html/onepage/hgbook.html html/split/hgbook.html bos@0: bos@0: define htlatex bos@0: mkdir -p $(dir $(1)) bos@7: head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book bos@7: cp 99book.bib $(dir $@) bos@7: echo '(cd $(dir $@) && bibtex $(basename $(notdir $@)))' >> $(dir $(1))/htlatex.book bos@7: head -3 $(shell which htlatex) >> $(dir $(1))/htlatex.book bos@7: echo 'echo status $$$$' >> $(dir $(1))/htlatex.book bos@0: chmod 755 $(dir $(1))/htlatex.book bos@0: $(dir $(1))/htlatex.book $(2) "xhtml,html4-uni,$(3)" " -cunihtf -utf8" "" "$(call latex-options,$(1))" || (rm -f $(1); exit 1) bos@0: cd $(dir $(1)) && tex4ht -f/$(basename $(notdir $(1))) -cvalidate -cunihtf bos@0: cd $(dir $(1)) && t4ht -f/$(basename $(notdir $(1))) bos@7: perl -pi -e 's/�([0-7][0-9a-f]);/chr(hex($$1))/egi' $(dir $(1))/*.html bos@0: endef bos@0: bos@11: html/onepage/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples bos@0: $(call htlatex,$@,$<) bos@11: cp $(image-sources:%.svg=%.png) $(dir $@) bos@0: bos@11: html/split/hgbook.html: $(sources) $(image-sources:%.svg=%.png) examples bos@0: $(call htlatex,$@,$<,2) bos@11: cp $(image-sources:%.svg=%.png) $(dir $@) bos@0: bos@11: %.png: %.svg bos@11: inkscape -D -e $@ $< bos@11: bos@11: %_pdf.png: %.svg bos@11: inkscape -D -d 300 -e $@ $< bos@11: bos@11: %.eps: %.svg bos@11: inkscape -E $@ $< bos@4: bos@4: examples: examples/.run bos@4: bos@4: examples/.run: $(example-sources) bos@4: cd examples && ./run-example bos@4: bos@0: clean: bos@11: rm -rf html pdf *.eps *.png *.aux *.dvi *.log *.out examples/*.out examples/.run