aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/Makefile
blob: b6290ff0cb027dd902da4d833e9afcdbe5ce9803 (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
# Makefile for the Coq documentation

# COQSRC needs to be set to a coq source repository

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

include ../config/Makefile


LATEX=latex
BIBTEX=bibtex -min-crossrefs=10
MAKEINDEX=makeindex
PDFLATEX=pdflatex

HEVEALIB=/usr/local/lib/hevea:/usr/lib/hevea
export TEXINPUTS=$(COQSRC)/doc:$(HEVEALIB):

COQTOP=$(COQSRC)/bin/coqtop
COQTEX=$(COQSRC)/bin/coq-tex -n 72 -image $(COQTOP) -v -sl -small
COQDOC=$(COQSRC)/bin/coqdoc

#VERSION=POSITIONNEZ-CETTE-VARIABLE

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

all: all-html all-pdf all-ps

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

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

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

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

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

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

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

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

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

.SUFFIXES: .dvi .tex .v.tex .ps .pdf .eps .png

%.v.tex: %.tex
	(cd `dirname $<`; $(COQTEX) `basename $<`)

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

%.eps: %.png
	pngtopnm $< | pnmtops -equalpixels -noturn -rle > $@

clean:
	rm -f */*.dvi */*.aux */*.log */*.bbl */*.blg */*.toc \
	*/*.idx */*~ */*.ilg */*.ind */*.dvi.gz */*.ps.gz */*.pdf.gz\
	*/*.???idx */*.???ind */*.v.tex */*.atoc */*.lof\
	*/*.hatoc */*.haux */*.hcomind */*.herrind */*.hidx */*.hind \
	*/*.htacind */*.htoc */*.v.html
	rm -f stdlib/index-list.html stdlib/index-body.html \
	  stdlib/Library.coqdoc.tex stdlib/library.files \
	  stdlib/library.files.ls
	rm -f stdlib/html/*.html
	rm -f refman/euclid.ml{,i} refman/heapsort.ml{,i}
	rm -f common/version.tex
	rm -f refman/*.eps refman/Reference-Manual.html
	rm -f coq.tex

cleanall: clean
	rm -f */*.ps */*.pdf
	rm -rf refman/html stdlib/html faq/html tutorial/tutorial.v.html

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

COMMON=common/version.tex common/title.tex common/macros.tex 

### Version

common/version.tex: Makefile
	echo "\newcommand{\coqversion}{$(VERSION)}" > common/version.tex

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

REFMANCOQTEXFILES=\
  refman/RefMan-gal.v.tex refman/RefMan-ext.v.tex \
  refman/RefMan-mod.v.tex refman/RefMan-tac.v.tex \
  refman/RefMan-cic.v.tex refman/RefMan-lib.v.tex \
  refman/RefMan-tacex.v.tex refman/RefMan-syn.v.tex \
  refman/RefMan-oth.v.tex refman/RefMan-ltac.v.tex \
  refman/RefMan-decl.v.tex \
  refman/Cases.v.tex refman/Coercion.v.tex refman/Extraction.v.tex \
  refman/Program.v.tex refman/Omega.v.tex refman/Polynom.v.tex \
  refman/Setoid.v.tex refman/Helm.tex # refman/Natural.v.tex

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

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

REFMANFILES=\
  $(REFMANTEXFILES) $(COMMON) $(REFMANEPSFILES) refman/biblio.bib

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

### Reference Manual (printable format)

# The second LATEX compilation is necessary otherwise the pages of the index
# are not correct (don't know why...) - BB
refman/Reference-Manual.dvi: $(REFMANFILES)
	(cd refman;\
	$(LATEX) Reference-Manual;\
	$(BIBTEX) Reference-Manual;\
	$(LATEX) Reference-Manual;\
	$(MAKEINDEX) Reference-Manual;\
	$(MAKEINDEX) Reference-Manual.tacidx -o Reference-Manual.tacind;\
	$(MAKEINDEX) Reference-Manual.comidx -o Reference-Manual.comind;\
	$(MAKEINDEX) Reference-Manual.erridx -o Reference-Manual.errind;\
	$(LATEX) Reference-Manual;\
	$(LATEX) Reference-Manual)

refman/Reference-Manual.pdf: refman/Reference-Manual.tex
	(cd refman; $(PDFLATEX) Reference-Manual.tex)

### Reference Manual (browsable format)

refman/Reference-Manual.html: refman/headers.hva refman/Reference-Manual.dvi # to ensure bbl file
	(cd refman; hevea -fix -exec xxdate.exe ./Reference-Manual.tex)

refman/html/index.html: refman/Reference-Manual.html $(REFMANPNGFILES) \
                        refman/cover.html refman/index.html
	- rm -rf refman/html
	mkdir refman/html
	cp $(REFMANPNGFILES) refman/html
	(cd refman/html; hacha -o toc.html ../Reference-Manual.html)
	cp refman/cover.html refman/menu.html refman/html
	cp refman/index.html refman/html

refman-quick:
	(cd refman; \
	 $(PDFLATEX) Reference-Manual.tex; \
	 hevea -fix -exec xxdate.exe ./Reference-Manual.tex)


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

tutorial/Tutorial.v.dvi: common/version.tex common/title.tex tutorial/Tutorial.v.tex
	(cd tutorial; $(LATEX) Tutorial.v)

tutorial/Tutorial.v.pdf: common/version.tex common/title.tex tutorial/Tutorial.v.dvi
	(cd tutorial; $(PDFLATEX) Tutorial.v.tex)

tutorial/Tutorial.v.html: tutorial/Tutorial.v.tex
	(cd tutorial; hevea -exec xxdate.exe Tutorial.v)


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

faq/FAQ.v.dvi: common/version.tex common/title.tex faq/FAQ.v.tex
	(cd faq;\
	$(LATEX) FAQ.v;\
	$(BIBTEX) FAQ.v;\
	$(LATEX) FAQ.v;\
	$(LATEX) FAQ.v)

faq/FAQ.v.pdf: common/version.tex common/title.tex faq/FAQ.v.dvi faq/axioms.png
	(cd faq; $(PDFLATEX) FAQ.v.tex)

faq/FAQ.v.html: faq/FAQ.v.dvi # to ensure FAQ.v.bbl
	(cd faq; hevea -fix FAQ.v.tex)

faq/html/index.html: faq/FAQ.v.html
	- rm -rf faq/html
	mkdir faq/html
	cp faq/interval_discr.v faq/axioms.png faq/html
	cp faq/FAQ.v.html faq/html/index.html

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

GLOBDUMP=$(COQSRC)/glob.dump

LIBDIRS= Init Logic Bool Arith NArith ZArith QArith Relations Sets Setoids Lists Sorting Wellfounded IntMap FSets Reals Program
# We avoid Strings as String.v contains unicode caracters that make latex fail

LIBDIRS+= Ints Ints/num Ints/Z
LIBDIRS+= Numbers Numbers/NatInt Numbers/Natural/Abstract Numbers/Natural/Binary Numbers/Natural/Peano Numbers/Integer/Abstract Numbers/Integer/NatPairs Numbers/Integer/Binary


ALLTHEORIES_VO=$(foreach dir, $(LIBDIRS), $(wildcard $(COQSRC)/theories/$(dir)/*.vo))
ALLTHEORIES_V=$(ALLTHEORIES_VO:%.vo=%.v)
ALLTHEORIES_GLOB = $(ALLTHEORIES_V:%.v=%.glob)

### Standard library (browsable html format)

$(GLOBDUMP): $(ALLTHEORIES_GLOB)
	$(MAKE) -C .. $(@:../%=%)

stdlib/index-body.html: $(GLOBDUMP) $(ALLTHEORIES_V)
	- rm -rf stdlib/html
	mkdir stdlib/html
	(cd stdlib/html;\
	 $(COQDOC) -q --multi-index --html --glob-from $(GLOBDUMP)\
	  -R $(COQSRC)/theories Coq $(ALLTHEORIES_V))
	mv stdlib/html/index.html stdlib/index-body.html

stdlib/index-list.html: stdlib/index-list.html.template
	COQTOP=$(COQSRC) ./stdlib/make-library-index stdlib/index-list.html

stdlib/html/index.html: stdlib/index-list.html stdlib/index-body.html stdlib/index-trailer.html
	cat stdlib/index-list.html > $@
	sed -n -e '/<table>/,/<\/table>/p' stdlib/index-body.html >> $@
	cat stdlib/index-trailer.html >> $@

### Standard library (printable format - produces > 350 pages)

stdlib/Library.coqdoc.tex: 
	(for dir in $(LIBDIRS) ; do \
	  $(COQDOC) -q --gallina --body-only --latex --stdout \
	    --coqlib_path $(COQSRC) \
            -R $(COQSRC)/theories Coq "$(COQSRC)/theories/$$dir/"*.v >> $@ ; done)

stdlib/Library.dvi: $(COMMON) stdlib/Library.coqdoc.tex stdlib/Library.tex
	(cd stdlib;\
	$(LATEX) Library;\
	$(LATEX) Library)

stdlib/Library.pdf: $(COMMON) stdlib/Library.coqdoc.tex stdlib/Library.dvi
	(cd stdlib; $(PDFLATEX) Library)

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

RecTutorial/RecTutorial.v.dvi: common/version.tex common/title.tex RecTutorial/RecTutorial.v.tex
	(cd RecTutorial;\
	 $(LATEX) RecTutorial.v;\
	 $(BIBTEX) RecTutorial.v;\
	 $(LATEX) RecTutorial.v;\
	 $(LATEX) RecTutorial.v)

RecTutorial/RecTutorial.v.pdf: common/version.tex common/title.tex RecTutorial/RecTutorial.v.dvi
	(cd RecTutorial; $(PDFLATEX) RecTutorial.v.tex)

RecTutorial/RecTutorial.v.html: RecTutorial/RecTutorial.v.tex
	(cd RecTutorial; hevea -exec xxdate.exe RecTutorial.v)


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

COQINSTALLPREFIX=
DOCDIR=/usr/local/share/doc/coq-8.0
FULLDOCDIR=$(COQINSTALLPREFIX)$(DOCDIR)
HTMLINSTALLDIR=$(FULLDOCDIR)/html
PRINTABLEINSTALLDIR=$(FULLDOCDIR)/ps

install-doc: install-meta install-doc-html install-doc-printable

install-meta:
	mkdir $(DOCDIC)
	cp LICENCE $(DOCDIC)/LICENCE.doc
#	cp $(COQSRC)/LICENCE $(COQTOP)/CREDITS $(COQSRC)/COPYRIGHT $(DOCDIC)
#	cp $(COQSRC)/README $(COQSRC)/CHANGES $(DOCDIC)

install-doc-html: all-html
	mkdir $(HTMLINSTALLDIR)
	cp -r refman/html $(HTMLINSTALLDIR)/refman
	cp -r stdlib/html $(HTMLINSTALLDIR)/stdlib
	cp -r tutorial/tutorial.html $(HTMLINSTALLDIR)/
	cp -r RecTutorial/RecTutorial.html $(HTMLINSTALLDIR)/
	cp -r faq/html $(HTMLINSTALLDIR)/faq

install-doc-printable: all-pdf all-ps
	mkdir $(PRINTABLEINSTALLDIR)
	cp -r refman/Reference-manual.pdf $(PRINTABLEINSTALLDIR)
	cp -r stdlib/Library.pdf $(PRINTABLEINSTALLDIR)
	cp -r tutorial/Tutorial.v.pdf $(PRINTABLEINSTALLDIR)/Tutorial.pdf
	cp -r RecTutorial/RecTutorial.v.pdf $(PRINTABLEINSTALLDIR)/RecTutorial.pdf
	cp -r faq/FAQ.v.pdf $(PRINTABLEINSTALLDIR)/FAQ.pdf
	cp -r refman/Reference-manual.ps $(PRINTABLEINSTALLDIR)
	cp -r stdlib/Library.ps $(PRINTABLEINSTALLDIR)
	cp -r tutorial/Tutorial.v.ps $(PRINTABLEINSTALLDIR)/Tutorial.ps
	cp -r RecTutorial/RecTutorial.v.ps $(PRINTABLEINSTALLDIR)/RecTutorial.ps
	cp -r faq/FAQ.v.ps $(PRINTABLEINSTALLDIR)/FAQ.ps