summaryrefslogtreecommitdiff
path: root/Makefile.doc
blob: cdd9852e87f667f53f8adb8db52b59721df9de18 (plain)
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
#######################################################################
#  v      #   The Coq Proof Assistant  /  The Coq Development Team    #
# <O___,, #        INRIA-Rocquencourt  &  LRI-CNRS-Orsay              #
#   \VV/  #############################################################
#    //   #      This file is distributed under the terms of the      #
#         #       GNU Lesser General Public License Version 2.1       #
#######################################################################

# Makefile for the Coq documentation

# To compile documentation, you need the following tools:
# Dvi: latex (latex2e), bibtex, makeindex
# Pdf: pdflatex
# Html: hevea (http://hevea.inria.fr) >= 1.05

# The main entry point :

documentation: doc-$(WITHDOC)  ## see $(WITHDOC) in config/Makefile
doc-all: doc
doc-no:

.PHONY: documentation doc-all doc-no

######################################################################
### Variables
######################################################################

LATEX:=latex
BIBTEX:=BIBINPUTS=.: bibtex -min-crossrefs=10
MAKEINDEX:=makeindex
PDFLATEX:=pdflatex
DVIPS:=dvips
FIG2DEV:=fig2dev
CONVERT:=convert
HEVEA:=hevea
HACHA:=hacha
HEVEAOPTS:=-fix -exec xxdate.exe
HEVEALIB:=/usr/local/lib/hevea:/usr/lib/hevea
HTMLSTYLE:=simple
export TEXINPUTS:=$(HEVEALIB):
COQTEXOPTS:=-boot -n 72 -sl -small

DOCCOMMON:=doc/common/version.tex doc/common/title.tex doc/common/macros.tex

REFMANCOQTEXFILES:=$(addprefix doc/refman/, \
  RefMan-gal.v.tex RefMan-ext.v.tex \
  RefMan-mod.v.tex RefMan-tac.v.tex \
  RefMan-cic.v.tex RefMan-lib.v.tex \
  RefMan-tacex.v.tex RefMan-syn.v.tex \
  RefMan-oth.v.tex RefMan-ltac.v.tex \
  RefMan-decl.v.tex RefMan-pro.v.tex RefMan-sch.v.tex \
  Cases.v.tex Coercion.v.tex CanonicalStructures.v.tex Extraction.v.tex \
  Program.v.tex Omega.v.tex Micromega.v.tex Polynom.v.tex Nsatz.v.tex \
  Setoid.v.tex Classes.v.tex Universes.v.tex \
  Misc.v.tex)

REFMANTEXFILES:=$(addprefix doc/refman/, \
  headers.sty Reference-Manual.tex \
  RefMan-pre.tex RefMan-int.tex RefMan-com.tex \
  RefMan-uti.tex RefMan-ide.tex RefMan-add.tex RefMan-modr.tex \
  AsyncProofs.tex ) \
  $(REFMANCOQTEXFILES) \

REFMANEPSFILES:=doc/refman/coqide.eps doc/refman/coqide-queries.eps

REFMANFILES:=$(REFMANTEXFILES) $(DOCCOMMON) $(REFMANEPSFILES) doc/refman/biblio.bib

REFMANPNGFILES:=$(REFMANEPSFILES:.eps=.png)


######################################################################
### General rules
######################################################################

.PHONY: doc doc-html doc-pdf doc-ps refman refman-quick tutorial
.PHONY: stdlib full-stdlib faq rectutorial refman-html-dir

INDEXURLS:=doc/refman/html/index_urls.txt

doc: refman faq tutorial rectutorial stdlib $(INDEXURLS)

doc-html:\
  doc/tutorial/Tutorial.v.html doc/refman/html/index.html \
  doc/faq/html/index.html doc/stdlib/html/index.html doc/RecTutorial/RecTutorial.html

doc-pdf:\
  doc/tutorial/Tutorial.v.pdf doc/refman/Reference-Manual.pdf \
  doc/faq/FAQ.v.pdf doc/stdlib/Library.pdf doc/RecTutorial/RecTutorial.pdf

doc-ps:\
  doc/tutorial/Tutorial.v.ps doc/refman/Reference-Manual.ps \
  doc/faq/FAQ.v.ps doc/stdlib/Library.ps doc/RecTutorial/RecTutorial.ps

refman: \
  doc/refman/html/index.html doc/refman/Reference-Manual.ps doc/refman/Reference-Manual.pdf

tutorial: \
  doc/tutorial/Tutorial.v.html doc/tutorial/Tutorial.v.ps doc/tutorial/Tutorial.v.pdf

stdlib: \
  doc/stdlib/html/index.html doc/stdlib/Library.ps doc/stdlib/Library.pdf

full-stdlib: \
  doc/stdlib/html/index.html doc/stdlib/FullLibrary.ps doc/stdlib/FullLibrary.pdf

faq: doc/faq/html/index.html doc/faq/FAQ.v.ps doc/faq/FAQ.v.pdf

rectutorial: doc/RecTutorial/RecTutorial.html \
  doc/RecTutorial/RecTutorial.ps doc/RecTutorial/RecTutorial.pdf

######################################################################
### Implicit rules
######################################################################

ifdef QUICK
%.v.tex: %.tex
	$(COQTEX) $(COQTEXOPTS) $<
else
%.v.tex: %.tex $(COQTEX) $(COQTOPEXE) $(ALLVO)
	$(COQTEX) $(COQTEXOPTS) $<
endif

%.ps: %.dvi
	(cd `dirname $<`; $(DVIPS) -q -o `basename $@` `basename $<`)

%.png: %.fig
	$(FIG2DEV) -L png -m 2 $< $@

%.pdf: %.fig
	$(FIG2DEV) -L pdftex $< $@
	$(FIG2DEV) -L pdftex_t -p `basename $@` $< $@_t

%.eps: %.fig
	$(FIG2DEV) -L pstex $< $@
	$(FIG2DEV) -L pstex_t -p `basename $@` $< $@_t

%.eps: %.png
	$(CONVERT) $< $@

######################################################################
# Macros for filtering outputs
######################################################################

HIDEBIBTEXINFO=| grep -v "^A level-1 auxiliary file"
SHOWMAKEINDEXERROR=egrep '^!! Input index error|^\*\* Input style error|^   --'

# Empty subsection levels in faq are on purpose
HEVEAFAQFILTER=2>&1 | grep -v "^Warning: List with no item"

######################################################################
# Common
######################################################################

### Version

doc/common/version.tex: config/Makefile
	printf '\\newcommand{\\coqversion}{$(VERSION)}' > doc/common/version.tex

######################################################################
# Reference Manual
######################################################################


### Reference Manual (printable format)

# The second LATEX compilation is necessary otherwise the pages of the index
# are not correct (don't know why...) - BB
doc/refman/Reference-Manual.dvi: $(REFMANFILES) doc/refman/Reference-Manual.tex
	@(cd doc/refman;\
	$(LATEX) -interaction=batchmode Reference-Manual;\
	$(BIBTEX) -terse Reference-Manual $(HIDEBIBTEXINFO);\
	$(LATEX) -interaction=batchmode Reference-Manual > /dev/null;\
	$(MAKEINDEX) -q Reference-Manual;\
	$(SHOWMAKEINDEXERROR) Reference-Manual.ilg;\
	$(MAKEINDEX) -q Reference-Manual.tacidx -o Reference-Manual.tacind;\
	$(SHOWMAKEINDEXERROR) Reference-Manual.ilg;\
	$(MAKEINDEX) -q Reference-Manual.comidx -o Reference-Manual.comind;\
	$(SHOWMAKEINDEXERROR) Reference-Manual.ilg;\
	$(MAKEINDEX) -q Reference-Manual.optidx -o Reference-Manual.optind;\
	$(SHOWMAKEINDEXERROR) Reference-Manual.ilg;\
	$(MAKEINDEX) -q Reference-Manual.erridx -o Reference-Manual.errind;\
	$(SHOWMAKEINDEXERROR) Reference-Manual.ilg;\
	$(LATEX) -interaction=batchmode Reference-Manual > /dev/null;\
	$(LATEX) -interaction=batchmode Reference-Manual > /dev/null;\
	../tools/show_latex_messages -no-overfull Reference-Manual.log)

doc/refman/Reference-Manual.pdf: doc/refman/Reference-Manual.dvi $(REFMANPNGFILES)
	(cd doc/refman;\
	$(PDFLATEX) -interaction=batchmode Reference-Manual.tex;\
	../tools/show_latex_messages -no-overfull Reference-Manual.log)

### Reference Manual (browsable format)

doc/refman/Reference-Manual.html: doc/refman/styles.hva doc/refman/headers.hva doc/refman/Reference-Manual.dvi # to ensure bbl file
	(cd doc/refman; BIBINPUTS=.: $(HEVEA) $(HEVEAOPTS) ./styles.hva ./Reference-Manual.tex)

doc/refman/cover.html: doc/common/styles/html/$(HTMLSTYLE)/cover.html
	sed -e "s/COQVERSION/$(VERSION)/g" $< > $@

doc/refman/styles.hva: doc/common/styles/html/$(HTMLSTYLE)/styles.hva
	$(INSTALLLIB) $< doc/refman

INDEXES:= doc/refman/html/command-index.html doc/refman/html/tactic-index.html
ALLINDEXES:= doc/refman/html/index.html $(INDEXES)

refman-html-dir $(ALLINDEXES): doc/refman/Reference-Manual.html $(REFMANPNGFILES) \
	       doc/refman/cover.html doc/refman/styles.hva doc/refman/index.html
	- rm -rf doc/refman/html
	$(MKDIR) doc/refman/html
	$(INSTALLLIB) $(REFMANPNGFILES) doc/refman/html
	(cd doc/refman/html; $(HACHA) -nolinks -tocbis -o toc.html ../styles.hva ../Reference-Manual.html)
	$(INSTALLLIB) doc/refman/cover.html doc/refman/html/index.html
	-$(INSTALLLIB) doc/common/styles/html/$(HTMLSTYLE)/*.css doc/refman/html

refman-quick:
	(cd doc/refman;\
	$(PDFLATEX) -interaction=batchmode Reference-Manual.tex;\
	../tools/show_latex_messages -no-overfull Reference-Manual.log && \
	$(HEVEA) $(HEVEAOPTS) ./Reference-Manual.tex)

######################################################################
# Index file for CoqIDE
######################################################################

$(INDEXURLS): $(INDEXES)
	cat $< | grep li-indexenv | grep href= | sed -e 's@.*>\([^<]*\)</span>.*, <a href="\([^"]*\)">.*@\1,\2@' > $@


######################################################################
# Tutorial
######################################################################

doc/tutorial/Tutorial.v.dvi: $(DOCCOMMON) doc/tutorial/Tutorial.v.tex
	(cd doc/tutorial;\
	$(LATEX) -interaction=batchmode Tutorial.v;\
	../tools/show_latex_messages Tutorial.v.log)

doc/tutorial/Tutorial.v.pdf: $(DOCCOMMON) doc/tutorial/Tutorial.v.tex
	(cd doc/tutorial;\
	$(PDFLATEX) -interaction=batchmode Tutorial.v.tex;\
	../tools/show_latex_messages Tutorial.v.log)

doc/tutorial/Tutorial.v.html: $(DOCCOMMON) doc/tutorial/Tutorial.v.tex
	(cd doc/tutorial; $(HEVEA) $(HEVEAOPTS) Tutorial.v)


######################################################################
# FAQ
######################################################################

doc/faq/FAQ.v.dvi: doc/common/version.tex doc/common/title.tex doc/faq/FAQ.v.tex doc/faq/axioms.eps
	(cd doc/faq;\
	$(LATEX) -interaction=batchmode FAQ.v;\
	$(BIBTEX) -terse FAQ.v;\
	$(LATEX) -interaction=batchmode FAQ.v > /dev/null;\
	$(LATEX) -interaction=batchmode FAQ.v > /dev/null;\
	../tools/show_latex_messages FAQ.v.log)

doc/faq/FAQ.v.pdf: doc/common/version.tex doc/common/title.tex doc/faq/FAQ.v.dvi doc/faq/axioms.pdf
	(cd doc/faq;\
        $(PDFLATEX) -interaction=batchmode FAQ.v.tex;\
	../tools/show_latex_messages FAQ.v.log)

doc/faq/FAQ.v.html: doc/faq/FAQ.v.dvi doc/faq/axioms.png # to ensure FAQ.v.bbl
	(cd doc/faq; ($(HEVEA) $(HEVEAOPTS) FAQ.v.tex $(HEVEAFAQFILTER)))

doc/faq/html/index.html: doc/faq/FAQ.v.html
	- rm -rf doc/faq/html
	$(MKDIR) doc/faq/html
	$(INSTALLLIB) doc/faq/interval_discr.v doc/faq/axioms.png doc/faq/html
	$(INSTALLLIB) doc/faq/FAQ.v.html doc/faq/html/index.html

######################################################################
# Standard library
######################################################################

### Standard library (browsable html format)

ifdef QUICK
doc/stdlib/html/genindex.html:
else
doc/stdlib/html/genindex.html: | $(COQDOC) $(ALLVO)
endif
	- rm -rf doc/stdlib/html
	$(MKDIR) doc/stdlib/html
	$(COQDOC) -q -d doc/stdlib/html --with-header doc/common/styles/html/$(HTMLSTYLE)/header.html --with-footer doc/common/styles/html/$(HTMLSTYLE)/footer.html --multi-index --html -g \
	  -R theories Coq -R plugins Coq $(VFILES)
	mv doc/stdlib/html/index.html doc/stdlib/html/genindex.html

doc/stdlib/index-list.html: doc/stdlib/index-list.html.template doc/stdlib/make-library-index
	./doc/stdlib/make-library-index doc/stdlib/index-list.html doc/stdlib/hidden-files

doc/stdlib/html/index.html: doc/stdlib/html/genindex.html doc/stdlib/index-list.html
	cat doc/common/styles/html/$(HTMLSTYLE)/header.html doc/stdlib/index-list.html > $@
	cat doc/common/styles/html/$(HTMLSTYLE)/footer.html >> $@

### Standard library (light version, full version is definitely too big)

ifdef QUICK
doc/stdlib/Library.coqdoc.tex:
else
doc/stdlib/Library.coqdoc.tex: | $(COQDOC) $(THEORIESLIGHTVO)
endif
	$(COQDOC) -q -boot --gallina --body-only --latex --stdout \
            -R theories Coq $(THEORIESLIGHTVO:.vo=.v) >> $@

doc/stdlib/Library.dvi: $(DOCCOMMON) doc/stdlib/Library.coqdoc.tex doc/stdlib/Library.tex
	(cd doc/stdlib;\
	$(LATEX) -interaction=batchmode Library;\
	$(LATEX) -interaction=batchmode Library > /dev/null;\
	../tools/show_latex_messages -no-overfull Library.log)

doc/stdlib/Library.pdf: $(DOCCOMMON) doc/stdlib/Library.coqdoc.tex doc/stdlib/Library.dvi
	(cd doc/stdlib;\
	$(PDFLATEX) -interaction=batchmode Library;\
	../tools/show_latex_messages -no-overfull Library.log)

### Standard library (full version if you're crazy enouth to try)

doc/stdlib/FullLibrary.tex: doc/stdlib/Library.tex
	sed -e 's/Library.coqdoc/FullLibrary.coqdoc/g;s/\\begin{document}/\\newcommand{\\textlambda}{\\ensuremath{\\lambda}}\\newcommand{\\textPi}{\\ensuremath{\\Pi}}\\begin{document}/' $< > $@

ifdef QUICK
doc/stdlib/FullLibrary.coqdoc.tex:
	$(COQDOC) -q -boot --gallina --body-only --latex --stdout --utf8 \
            -R theories Coq -R plugins Coq $(VFILES) > $@
	sed -i.tmp -e 's///g' $@ && rm $@.tmp
else
doc/stdlib/FullLibrary.coqdoc.tex: $(COQDOC) $(ALLVO)
	$(COQDOC) -q -boot --gallina --body-only --latex --stdout --utf8 \
            -R theories Coq -R plugins Coq $(VFILES) > $@
	sed -i.tmp -e 's///g' $@ && rm $@.tmp
endif

doc/stdlib/FullLibrary.dvi: $(DOCCOMMON) doc/stdlib/FullLibrary.coqdoc.tex doc/stdlib/FullLibrary.tex
	(cd doc/stdlib;\
	$(LATEX) -interaction=batchmode FullLibrary;\
	$(LATEX) -interaction=batchmode FullLibrary > /dev/null;\
	../tools/show_latex_messages -no-overfull FullLibrary.log)

doc/stdlib/FullLibrary.pdf: $(DOCCOMMON) doc/stdlib/FullLibrary.coqdoc.tex doc/stdlib/FullLibrary.dvi
	(cd doc/stdlib;\
	$(PDFLATEX) -interaction=batchmode FullLibrary;\
	../tools/show_latex_messages -no-overfull FullLibrary.log)

######################################################################
# Tutorial on inductive types
######################################################################

doc/RecTutorial/RecTutorial.dvi: doc/common/version.tex doc/common/title.tex doc/RecTutorial/RecTutorial.tex
	(cd doc/RecTutorial;\
	$(LATEX) -interaction=batchmode RecTutorial;\
	$(BIBTEX) -terse RecTutorial;\
	$(LATEX) -interaction=batchmode RecTutorial > /dev/null;\
	$(LATEX) -interaction=batchmode RecTutorial > /dev/null;\
	../tools/show_latex_messages RecTutorial.log)

doc/RecTutorial/RecTutorial.pdf: doc/common/version.tex doc/common/title.tex doc/RecTutorial/RecTutorial.dvi
	(cd doc/RecTutorial;\
	$(PDFLATEX) -interaction=batchmode RecTutorial.tex;\
	../tools/show_latex_messages RecTutorial.log)

doc/RecTutorial/RecTutorial.html: doc/RecTutorial/RecTutorial.tex
	(cd doc/RecTutorial; $(HEVEA) $(HEVEAOPTS) RecTutorial)

######################################################################
# Install all documentation files
######################################################################

.PHONY: install-doc install-doc-meta install-doc-html install-doc-printable install-doc-index-urls

install-doc: install-doc-meta install-doc-html install-doc-printable install-doc-index-urls

install-doc-meta:
	$(MKDIR) $(FULLDOCDIR)
	$(INSTALLLIB) doc/LICENSE $(FULLDOCDIR)/LICENSE.doc

install-doc-html: 
	$(MKDIR) $(addprefix $(FULLDOCDIR)/html/, refman stdlib faq)
	$(INSTALLLIB) doc/refman/html/* $(FULLDOCDIR)/html/refman 
	$(INSTALLLIB) doc/stdlib/html/* $(FULLDOCDIR)/html/stdlib 
	$(INSTALLLIB) doc/RecTutorial/RecTutorial.html $(FULLDOCDIR)/html/RecTutorial.html
	$(INSTALLLIB) doc/faq/html/* $(FULLDOCDIR)/html/faq
	$(INSTALLLIB) doc/tutorial/Tutorial.v.html $(FULLDOCDIR)/html/Tutorial.html

install-doc-printable: 
	$(MKDIR) $(FULLDOCDIR)/ps $(FULLDOCDIR)/pdf
	$(INSTALLLIB) doc/refman/Reference-Manual.pdf \
		doc/stdlib/Library.pdf $(FULLDOCDIR)/pdf
	$(INSTALLLIB) doc/refman/Reference-Manual.ps \
		doc/stdlib/Library.ps $(FULLDOCDIR)/ps
	$(INSTALLLIB) doc/tutorial/Tutorial.v.pdf $(FULLDOCDIR)/pdf/Tutorial.pdf
	$(INSTALLLIB) doc/RecTutorial/RecTutorial.pdf $(FULLDOCDIR)/pdf/RecTutorial.pdf
	$(INSTALLLIB) doc/faq/FAQ.v.pdf $(FULLDOCDIR)/pdf/FAQ.pdf
	$(INSTALLLIB) doc/tutorial/Tutorial.v.ps $(FULLDOCDIR)/ps/Tutorial.ps
	$(INSTALLLIB) doc/RecTutorial/RecTutorial.ps $(FULLDOCDIR)/ps/RecTutorial.ps
	$(INSTALLLIB) doc/faq/FAQ.v.ps $(FULLDOCDIR)/ps/FAQ.ps

install-doc-index-urls:
	$(MKDIR) $(FULLDATADIR)
	$(INSTALLLIB) $(INDEXURLS) $(FULLDATADIR)


###########################################################################
# Documentation of the source code (using ocamldoc)
###########################################################################

OCAMLDOCDIR=dev/ocamldoc

DOCMLIS=$(wildcard ./lib/*.mli ./intf/*.mli ./kernel/*.mli ./library/*.mli \
	./engine/*.mli ./pretyping/*.mli ./interp/*.mli printing/*.mli \
	./parsing/*.mli ./proofs/*.mli \
	./tactics/*.mli ./stm/*.mli ./toplevel/*.mli ./ltac/*.mli)

# Defining options to generate dependencies graphs
DOT=dot
ODOCDOTOPTS=-dot -dot-reduce

.PHONY: source-doc mli-doc ml-doc

source-doc: mli-doc $(OCAMLDOCDIR)/coq.pdf

$(OCAMLDOCDIR)/coq.tex: $(DOCMLIS:.mli=.cmi)
	$(SHOW)'OCAMLDOC -latex -o $@'
	$(HIDE)$(OCAMLFIND) ocamldoc -latex -rectypes -I $(MYCAMLP4LIB) $(MLINCLUDES)\
	$(DOCMLIS) -noheader -t "Coq mlis documentation" \
	-intro $(OCAMLDOCDIR)/docintro -o $@.tmp
	$(SHOW)'OCAMLDOC utf8 fix'
	$(HIDE)$(OCAMLDOCDIR)/fix-ocamldoc-utf8 $@.tmp
	$(HIDE)cat $(OCAMLDOCDIR)/header.tex $@.tmp > $@
	rm $@.tmp

mli-doc: $(DOCMLIS:.mli=.cmi)
	$(SHOW)'OCAMLDOC -html'
	$(HIDE)$(OCAMLFIND) ocamldoc -charset utf-8 -html -rectypes -I +threads -I $(MYCAMLP4LIB) $(MLINCLUDES) \
	$(DOCMLIS) -d $(OCAMLDOCDIR)/html -colorize-code \
	-t "Coq mlis documentation" -intro $(OCAMLDOCDIR)/docintro \
	-css-style style.css

ml-dot: $(MLFILES)
	$(OCAMLFIND) ocamldoc -dot -dot-reduce -rectypes -I +threads -I $(CAMLLIB) -I $(MYCAMLP4LIB) $(MLINCLUDES) \
	$(filter $(addsuffix /%.ml,$(CORESRCDIRS)),$(MLFILES)) -o $(OCAMLDOCDIR)/coq.dot

%_dep.png: %.dot
	$(DOT) -Tpng $< -o $@

%_types.dot: %.mli
	$(OCAMLFIND) ocamldoc -rectypes $(MLINCLUDES) $(ODOCDOTOPTS) -dot-types -o $@ $<

OCAMLDOC_MLLIBD = $(OCAMLFIND) ocamldoc -rectypes $(MLINCLUDES) $(ODOCDOTOPTS) -o $@ \
  $(foreach lib,$(|:.mllib.d=_MLLIB_DEPENDENCIES),$(addsuffix .ml,$($(lib))))

%.dot: | %.mllib.d
	$(OCAMLDOC_MLLIBD)

ml-doc:
	$(OCAMLFIND) ocamldoc -charset utf-8 -html -rectypes -I +threads $(MLINCLUDES) $(COQIDEFLAGS) -d $(OCAMLDOCDIR) $(MLSTATICFILES)

parsing/parsing.dot : | parsing/parsing.mllib.d parsing/highparsing.mllib.d
	$(OCAMLDOC_MLLIBD)

grammar/grammar.dot : | grammar/grammar.mllib.d
	$(OCAMLDOC_MLLIBD)

tactics/tactics.dot: | tactics/tactics.mllib.d ltac/ltac.mllib.d
	$(OCAMLDOC_MLLIBD)

%.dot: %.mli
	$(OCAMLFIND) ocamldoc -rectypes $(MLINCLUDES) $(ODOCDOTOPTS) -o $@ $<

$(OCAMLDOCDIR)/%.pdf: $(OCAMLDOCDIR)/%.tex
	$(SHOW)'PDFLATEX $*.tex'
	$(HIDE)(cd $(OCAMLDOCDIR) ; pdflatex -interaction=batchmode $*.tex && pdflatex -interaction=batchmode $*.tex)
	$(HIDE)(cd doc/tools/; show_latex_messages -no-overfull ../../$(OCAMLDOCDIR)/$*.log)


# For emacs:
# Local Variables:
# mode: makefile
# End: