]> rtime.felk.cvut.cz Git - omk.git/blobdiff - doc/Makefile
Use wvtool for testing instead of wvtestrun
[omk.git] / doc / Makefile
index a3b2e1acd381939a670c787b394c53efb256c044..6e6a5b3b488709f08e0b0f9f8f072a9d4870e3c0 100644 (file)
@@ -1,28 +1,66 @@
-SOURCE = omk-manual
+VERSION:=$(shell git describe|sed -e 's/^v//')
+OLDVERSION:=$(shell cat .version 2>/dev/null)
 
-all: $(SOURCE).pdf $(SOURCE).txt $(SOURCE).html
+.PHONY: FORCE
+
+all: omk-manual.txt omk-manual.html omk-manual.pdf
+
+ifneq ($(VERSION),$(OLDVERSION))
+.version: FORCE
+       echo $(VERSION) | cmp -s $@ - || echo $(VERSION) > $@
+endif
 
 PNG_FIGS = $(wildcard *.png)
 PDF_FIGS = $(patsubst %.png,%.pdf,$(PNG_FIGS))
 
+MANUAL_INCLUDES = .version tests/programs/Makefile.omk         \
+tests/libraries/Makefile.omk tests/default-config/Makefile.omk \
+tests/default-config/subdir/Makefile.omk                       \
+tests/default-config/config.omk-correct
+
+tests/%: DIR=$(shell echo $@|sed -e 's,\([^/]*/[^/]*\)/.*,\1,')
+tests/%:
+       rm -rf $(DIR)
+       mkdir -p $(DIR)
+       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
+       cd $(DIR) && ../../../$(DIR)
+
 %.pdf: %.png
        convert $< -density 150 $@
 
-%.pdf: %.texinfo $(PDF_FIGS)
+# We want to use synctex. texi2dvi does not support this directly, so
+# we use the PDFTEX variable for this.
+export PDFTEX = pdfetex -synctex=1
+
+%.pdf: %.texinfo $(PNG_FIGS) $(MANUAL_INCLUDES)
        texi2dvi --pdf $<
        texi2dvi --pdf $<
 
-%.txt: %.texinfo
+%.txt: %.texinfo $(MANUAL_INCLUDES)
        makeinfo --no-headers --force -o $@ $<
 
-%.html: %.texinfo Makefile
-       texi2html --l2h $<
+%.html: %.texinfo $(MANUAL_INCLUDES)
+       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"//}' \
-                  -e '@match=/\[ ([^ ]+) \]/; if (@match > 0 && -r $$match[0] . ".png") { s/\[ ([^ ]+) \]/<img src="$$1.png"><\/img>/ }' \
-                  -e '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 $(addprefix omk-manual.,aux cp cps fn ky log pg toc tp vr vrs) $(PDF_FIGS) .version
+
+WWW ?= www
+
+web: all $(WWW) $(addprefix $(WWW)/,index.html omk-manual.html $(wildcard *.png) omk-manual.pdf $(wildcard RelNotes*.txt))
+
+$(WWW):
+       mkdir $@
+
+$(WWW)/index.html: index.html
+       sed -e "s/<!-- @LAST_MODIFIED@ -->/`LC_TIME=C TZ= date`/" < $< > $@
+
+$(WWW)/%: %
+       cp -p $^ $@