File size: 6,339 Bytes
d4035c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# 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 "<code>$(VER)</code>" > 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 '/<!-- Doc Here -->/q;p'  > doc/doxygen_header.html
	cat doc/api/index.html | \
	sed -n '/<!-- Doc Here -->/,$$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 "<group>" > "$@"
	for fullName in $(man_src) ; \
	do  \
	  fileName=$${fullName#src/} ; \
	  stem=$${fileName%.*} ; \
	  ( \
	    echo "<page id='man.$${stem}' name='$${stem}' title='$${stem}'>" ; \
	    echo "<include src='doc/man-src/$${fileName}.html'/>" ; \
	    echo "</page>" \
	  ) >> "$@" ; \
	done
	echo "</group>" >> "$@"

doc/man-src/man.html : $(man_tgt) $(doc-dir)
	echo "<ul>" > "$@"
	for fullName in $(man_src) ; \
	do  \
	  fileName=$${fullName#src/} ; \
	  stem=$${fileName%.*} ; \
	  echo "<li><a href='%pathto:man.$${stem};'>$${stem}</a></li>" >> "$@" ; \
	done
	echo "</ul>" >> "$@"

doc/man-src/%.html : src/% $(doc-dir)
	( \
	  echo '<!DOCTYPE group PUBLIC ' ; \
	  echo '  "-//W3C//DTD XHTML 1.0 Transitional//EN"' ; \
	  echo '  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' ; \
	  echo "<group>" ; \
	  $(GROFF) -mandoc -Thtml < "$<" | \
	    $(TIDY) -asxhtml | \
	    sed -e '1,/<body>/ d' -e '/<\/body>/,$$ d' ; \
	  echo "</group>" \
	)  > "$@"

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)