# file: Makfile.doc
# author: Andrea Vedaldi
# description: Makefile submodule to build the documentation
# AUTORIGHTS
# This makefile should not be called directly.
.PHONY: doc, doc-api, doc-toolbox, doc-figures, doc-man
.PHONY: doc-web, doc-demo
.PHONY: doc-bindist, doc-distclean
.PHONY: autorights
# 95 DPI make a letter page 808 pixels large
screen_dpi := 95
fig_src := $(wildcard docsrc/figures/*.fig)
demo_src := $(wildcard doc/demo/*.eps)
html_src := $(wildcard docsrc/*.html)
man_src := $(wildcard src/*.1)
man_src += $(wildcard src/*.7)
pdf_tgt := #$(fig_src:.fig=.pdf)
eps_tgt := #$(subst docsrc/,doc/,$(fig_src:.fig=.eps))
png_tgt := $(subst docsrc/,doc/,$(fig_src:.fig=.png))
jpg_tgt := $(demo_src:.eps=.jpg)
img_tgt := $(jpg_tgt) $(png_tgt) $(pdf_tgt) $(eps_tgt)
man_tgt := $(subst src/,doc/man-src/,$(addsuffix .html,$(man_src)))
VERSION: Makefile
echo "$(VER)" > VERSION
docsrc/version.html: Makefile
echo "$(VER)" > docsrc/version.html
doc: doc-api doc-man doc-web
doc-man: doc/man-src/man.xml doc/man-src/man.html
doc-api: doc/api/index.html
doc-web: doc/index.html
doc-toolbox: doc/toolbox-src/mdoc.html
doc-deep: all $(doc-dir) $(results-dir)
cd toolbox ; \
$(MATLABEXE) -nojvm -nodesktop -r "vl_setup('noprefix','demo');vl_demo;exit"
#
# Use webdoc.py to generate the website
#
doc/index.html: \
doc/toolbox-src/mdoc.html \
doc/man-src/man.xml \
doc/man-src/man.html \
docsrc/web.xml \
docsrc/web.css \
docsrc/webdoc.py \
$(img_tgt) $(html_src)
$(PYTHON) docsrc/webdoc.py --outdir=doc \
docsrc/web.xml --verbose
rsync -arv docsrc/images doc
rsync -arv docsrc/web.css doc
#
# Use mdoc.py to create the toolbox documentation that will be
# embedded in the website.
#
doc/toolbox-src/mdoc.html : $(m_src) docsrc/mdoc.py
$(PYTHON) docsrc/mdoc.py toolbox doc/toolbox-src \
--format=web \
--exclude='noprefix/.*' \
--exclude='.*/vl_test_.*' \
--exclude='.*/vl_demo_.*' \
--verbose
#
# Generate C API documentation
#
doc/doxygen_header.html doc/doxygen_footer.html: doc/index.html
cat doc/api/index.html | \
sed -n '//q;p' > doc/doxygen_header.html
cat doc/api/index.html | \
sed -n '//,$$p' > doc/doxygen_footer.html
doc/api/index.html: docsrc/doxygen.conf VERSION docsrc/version.html \
$(dll_src) $(dll_hdr) $(img_tgt) toolbox/mexutils.h \
doc/doxygen_header.html doc/doxygen_footer.html
$(call C,DOXYGEN) $<
#
# Generate Man documentation
#
doc/man-src/man.xml : $(man_tgt) $(doc-dir)
echo "" > "$@"
for fullName in $(man_src) ; \
do \
fileName=$${fullName#src/} ; \
stem=$${fileName%.*} ; \
( \
echo "" ; \
echo "" ; \
echo "" \
) >> "$@" ; \
done
echo "" >> "$@"
doc/man-src/man.html : $(man_tgt) $(doc-dir)
echo "
" > "$@"
for fullName in $(man_src) ; \
do \
fileName=$${fullName#src/} ; \
stem=$${fileName%.*} ; \
echo "- $${stem}
" >> "$@" ; \
done
echo "
" >> "$@"
doc/man-src/%.html : src/% $(doc-dir)
( \
echo '' ; \
echo "" ; \
$(GROFF) -mandoc -Thtml < "$<" | \
$(TIDY) -asxhtml | \
sed -e '1,// d' -e '/<\/body>/,$$ d' ; \
echo "" \
) > "$@"
doc/man-src/index.html : $(doc-dir)
#
# Convert figure formats
#
doc-figures: $(img_tgt)
doc/figures/%.png : doc/figures/%.dvi
$(call C,DVIPNG) -D $(screen_dpi) -T tight -o $@ $<
doc/figures/%.eps : doc/figures/%.dvi
$(call C,DVIPS) -E -o $@ $<
doc/figures/%-raw.tex : docsrc/figures/%.fig
$(call C,FIG2DEV) -L pstex_t -p doc/figures/$*-raw.ps $< $@
doc/figures/%-raw.ps : docsrc/figures/%.fig
$(call C,FIG2DEV) -L pstex $< $@
doc/figures/%.dvi doc/figures/%.aux doc/figures/%.log : \
doc/figures/%.tex doc/figures/%-raw.tex doc/figures/%-raw.ps $(doc-dir)
$(LATEX) -output-directory=$(dir $@) $<
doc/figures/%.tex : $(doc-dir)
@$(print-command GEN, $@)
@/bin/echo '\documentclass[landscape]{article}' >$@
@/bin/echo '\usepackage[margin=0pt]{geometry}' >>$@
@/bin/echo '\usepackage{graphicx,color}' >>$@
@/bin/echo '\begin{document}' >>$@
@/bin/echo '\pagestyle{empty}' >>$@
@/bin/echo '\input{doc/figures/$(*)-raw.tex}' >>$@
@/bin/echo '\end{document}' >>$@
doc/demo/%.jpg : doc/demo/%.eps
$(call C,CONVERT) -density 400 -resample $(screen_dpi) "$<" -colorspace rgb jpg:$@
doc/demo/%.png : doc/demo/%.eps
$(call C,CONVERT) -density 400 -resample $(screen_dpi) "$<" -colorspace rgb png:$@
doc/%.pdf : doc/%.eps
$(call C,EPSTOPDF) --outfile=$@ $<
#
# Other documentation related targets
#
doc-bindist: $(NAME) doc
rsync -arv doc $(NAME)/ \
--exclude=doc/demo/*.eps \
--exclude=doc/toolbox-src*
doc-distclean:
rm -f docsrc/*.pyc
rm -rf doc
autorights: distclean
autorights \
toolbox vl \
--recursive \
--verbose \
--template doc/copylet.txt \
--years 2007-2008 \
--authors "Andrea Vedaldi and Brian Fulkerson" \
--holders "Andrea Vedaldi and Brian Fulkerson" \
--program "VLFeat"
# --------------------------------------------------------------------
# Debug Makefile
# --------------------------------------------------------------------
.PHONY: doc-info
doc-info :
@echo "=== DOCUMENTATION RELATED VARIABLES ==="
$(call dump-var,man_src)
$(call dump-var,fig_src)
$(call dump-var,demo_src)
$(call dump-var,bin_src)
$(call dump-var,bin_tgt)
$(call dump-var,bin_dep)
$(call dump-var,pdf_tgt)
$(call dump-var,eps_tgt)
$(call dump-var,png_tgt)
$(call dump-var,jpg_tgt)
$(call dump-var,man_tgt)