]> rtime.felk.cvut.cz Git - omk.git/blobdiff - doc/Makefile
Released v0.2
[omk.git] / doc / Makefile
index 30da936bf758374f353e28e93fad3d3d2bf8aedd..7ba3aabe12065ab804435fc308f149013402f0db 100644 (file)
@@ -1,25 +1,51 @@
 SOURCE = omk-manual
+VERSION:=$(shell git describe|sed -e 's/^v//')
+
+.PHONY: FORCE
 
 all: $(SOURCE).pdf $(SOURCE).txt $(SOURCE).html
 
+.version: FORCE
+       echo $(VERSION) | cmp -s $@ - || echo $(VERSION) > $@
+
+%.texi: %.texinfo .version
+       sed -e 's/\$$Id\$$/$(VERSION)/g' < $< > $@
+
 PNG_FIGS = $(wildcard *.png)
 PDF_FIGS = $(patsubst %.png,%.pdf,$(PNG_FIGS))
 
 %.pdf: %.png
        convert $< -density 150 $@
 
-%.pdf: %.texinfo $(PDF_FIGS)
-       texi2pdf $<
+%.pdf: %.texi $(PDF_FIGS)
+       texi2dvi --pdf $<
+       texi2dvi --pdf $<
 
-%.txt: %.texinfo
+%.txt: %.texi
        makeinfo --no-headers --force -o $@ $<
 
-%.html: %.texinfo
-       texi2html --l2h $<
+%.html: %.texi
+       makeinfo --html --no-split -o $@ $<
+#      texi2html --l2h $<
 # Fix texinfo HTML output
-       perl -w -n -e 'if (/<div class="contents">/) {$$toc=1}' \
-                  -e 'if (!$$toc) { s/class="toc"//}; print' < $@ > $@.tmp
-       mv $@.tmp $@
+#      perl -w -n -e 'if (/<div class="contents">/) {$$toc=1}' \
+#                 -e 'if (!$$toc) { s/class="toc"//}' \
+#                 -e '@match=/\[ ([^ ]+) \]/; if (@match > 0 && -r $$match[0] . ".png") { s/\[ ([^ ]+) \]/<img src="$$1.png"><\/img>/ }' \
+#                 -e 'print;' < $@ > $@.tmp
+#      mv $@.tmp $@
 
 clean:
-       rm -f $(SOURCE).{aux,cp,cps,fn,ky,log,pg,toc,tp,vr,vrs} $(PDF_FIGS)
+       rm -f $(SOURCE).{aux,cp,cps,fn,ky,log,pg,toc,tp,vr,vrs} $(PDF_FIGS) .version
+
+WWW ?= www
+
+web: all $(WWW) $(addprefix $(WWW)/,index.html $(SOURCE).html $(wildcard *.png) $(SOURCE).pdf $(wildcard RelNotes*.txt))
+
+$(WWW):
+       mkdir $@
+
+$(WWW)/index.html: index.html
+       sed -e "s/<!-- @LAST_MODIFIED@ -->/`LC_TIME=C TZ= date`/" < $< > $@
+
+$(WWW)/%: %
+       cp -p $^ $@