+.PHONY: epub
+epub: $(TGT_BASE).epub
+ echo "application/epub+zip" > mimetype
+ cp -r ./figures ./OEBPS/
+ mkdir ./OEBPS/style
+ cp ./style/manual.css ./OEBPS/style/
+ zip -0Xq $(TGT_BASE).epub mimetype
+ zip -Xr9D $(TGT_BASE).epub OEBPS/*
+ zip -Xr9D $(TGT_BASE).epub META-INF/*
+
+.PHONY: chunked-html
+chunked-html: $(CHUNKED_HTML)/%.html
+ cp -r ./figures ./${CHUNKED_HTML}
+
+
+# get the git hash for the last successful build of the manual
+.PHONY: mastermanual.revision
+mastermanual.revision:
+ wget -O mastermanual.index $(MASTER_URL) || wget -O mastermanual.index $(MASTER_URL_LAB)
+ awk '/Revision/ { print $$NF }' mastermanual.index > mastermanual.revision
+
+# only fetch the full manual if we don't have it or the manual changed
+$(TGT_MASTER).xhtml: mastermanual.revision
+ if ! cmp -s mastermanual.revision $(TGT_MASTER).revision ; then\
+ (wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML) || \
+ wget -O $(TGT_MASTER).xhtml $(MASTER_XHTML_LAB)) && \
+ mv mastermanual.revision $(TGT_MASTER).revision;\
+ fi
+
+.PHONY: diff
+diff: $(TGT_BASE).xhtml $(TGT_MASTER).xhtml
+ ./tools/diff.py $(TGT_MASTER).xhtml $(TGT_BASE).xhtml > $(TGT_BASE).diff.html
+
+