]> rtime.felk.cvut.cz Git - omk.git/blob - doc/Makefile
Allow including an arbitrary file from tests in the documentation
[omk.git] / doc / Makefile
1 VERSION:=$(shell git describe|sed -e 's/^v//')
2 OLDVERSION:=$(shell cat .version 2>/dev/null)
3
4 .PHONY: FORCE
5
6 all: omk-manual.txt omk-manual.html omk-manual.pdf
7
8 ifneq ($(VERSION),$(OLDVERSION))
9 .version: FORCE
10         echo $(VERSION) | cmp -s $@ - || echo $(VERSION) > $@
11 endif
12
13 PNG_FIGS = $(wildcard *.png)
14 PDF_FIGS = $(patsubst %.png,%.pdf,$(PNG_FIGS))
15
16 MANUAL_INCLUDES = .version tests/programs/Makefile.omk          \
17 tests/libraries/Makefile.omk tests/default-config/Makefile.omk  \
18 tests/default-config/subdir/Makefile.omk                        \
19 tests/default-config/config.omk-correct
20
21 tests/%: DIR=$(shell echo $@|sed -e 's,\([^/]*/[^/]*\)/.*,\1,')
22 tests/%:
23         rm -rf $(DIR)
24         mkdir -p $(DIR)
25         echo 'WVSTART() { local d=$(CURDIR)/$(DIR)/$$(echo $$1|tr " " -|tr A-Z a-z); mkdir -p $$d && cd $$d; }; WVPASS() { :; }; needs_valid_CC() { :; }; omkize() { :; }' > $(DIR)/wvtest.sh
26         cd $(DIR) && ../../../$(DIR)
27
28 %.pdf: %.png
29         convert $< -density 150 $@
30
31 # We want to use synctex. texi2dvi does not support this directly, so
32 # we use the PDFTEX variable for this.
33 export PDFTEX = pdfetex -synctex=1
34
35 %.pdf: %.texinfo $(PNG_FIGS) $(MANUAL_INCLUDES)
36         texi2dvi --pdf $<
37         texi2dvi --pdf $<
38
39 %.txt: %.texinfo $(MANUAL_INCLUDES)
40         makeinfo --no-headers --force -o $@ $<
41
42 %.html: %.texinfo $(MANUAL_INCLUDES)
43         makeinfo --html --no-split -o $@ $<
44 #       texi2html --l2h $<
45 # Fix texinfo HTML output
46 #       perl -w -n -e 'if (/<div class="contents">/) {$$toc=1}' \
47 #                  -e 'if (!$$toc) { s/class="toc"//}' \
48 #                  -e '@match=/\[ ([^ ]+) \]/; if (@match > 0 && -r $$match[0] . ".png") { s/\[ ([^ ]+) \]/<img src="$$1.png"><\/img>/ }' \
49 #                  -e 'print;' < $@ > $@.tmp
50 #       mv $@.tmp $@
51
52 clean:
53         rm -f $(addprefix omk-manual.,aux cp cps fn ky log pg toc tp vr vrs) $(PDF_FIGS) .version
54
55 WWW ?= www
56
57 web: all $(WWW) $(addprefix $(WWW)/,index.html omk-manual.html $(wildcard *.png) omk-manual.pdf $(wildcard RelNotes*.txt))
58
59 $(WWW):
60         mkdir $@
61
62 $(WWW)/index.html: index.html
63         sed -e "s/<!-- @LAST_MODIFIED@ -->/`LC_TIME=C TZ= date`/" < $< > $@
64
65 $(WWW)/%: %
66         cp -p $^ $@