]> rtime.felk.cvut.cz Git - omk.git/blob - doc/Makefile
9f08bcee03338f6f017671e96d57accb07540f1d
[omk.git] / doc / Makefile
1 SOURCE = omk-manual
2 VERSION ?= $(shell date +%Y-%m-%d)
3
4 .PHONY: FORCE
5
6 all: $(SOURCE).pdf $(SOURCE).txt $(SOURCE).html
7
8 .version: FORCE
9         echo $(VERSION) | cmp -s $@ - || echo $(VERSION) > $@
10
11 %.texi: %.texinfo .version
12         sed -e 's/\$$Id\$$/$(VERSION)/g' < $< > $@
13
14 PNG_FIGS = $(wildcard *.png)
15 PDF_FIGS = $(patsubst %.png,%.pdf,$(PNG_FIGS))
16
17 %.pdf: %.png
18         convert $< -density 150 $@
19
20 %.pdf: %.texi $(PDF_FIGS)
21         texi2dvi --pdf $<
22         texi2dvi --pdf $<
23
24 %.txt: %.texi
25         makeinfo --no-headers --force -o $@ $<
26
27 %.html: %.texi
28         makeinfo --html --no-split -o $@ $<
29 #       texi2html --l2h $<
30 # Fix texinfo HTML output
31 #       perl -w -n -e 'if (/<div class="contents">/) {$$toc=1}' \
32 #                  -e 'if (!$$toc) { s/class="toc"//}' \
33 #                  -e '@match=/\[ ([^ ]+) \]/; if (@match > 0 && -r $$match[0] . ".png") { s/\[ ([^ ]+) \]/<img src="$$1.png"><\/img>/ }' \
34 #                  -e 'print;' < $@ > $@.tmp
35 #       mv $@.tmp $@
36
37 clean:
38         rm -f $(SOURCE).{aux,cp,cps,fn,ky,log,pg,toc,tp,vr,vrs} $(PDF_FIGS) .version
39
40 WWW ?= www
41
42 web: all $(WWW) $(addprefix $(WWW)/,index.html $(SOURCE).html $(wildcard *.png) $(SOURCE).pdf)
43
44 $(WWW):
45         mkdir $@
46
47 $(WWW)/index.html: index.html
48         sed -e "s/<!-- @LAST_MODIFIED@ -->/`LC_TIME=C TZ= date`/" < $< > $@
49
50 $(WWW)/%: %
51         cp -p $^ $@