aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile.common
blob: 6dc193d6e4948141754e47230c202cd7f2074ceb (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
#######################################################################
#  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       #
#######################################################################

-include config/Makefile

###########################################################################
# Executables
###########################################################################

COQMKTOP:=bin/coqmktop$(EXE) 

COQC:=bin/coqc$(EXE)

COQTOPBYTE:=bin/coqtop.byte$(EXE)
COQTOPEXE:=bin/coqtop$(EXE)

CHICKENBYTE:=bin/coqchk.byte$(EXE)
CHICKEN:=bin/coqchk$(EXE)

ifeq ($(CAMLP4),camlp4)
CAMLP4MOD:=camlp4lib
else
CAMLP4MOD:=gramlib
endif

ifeq ($(HASNATDYNLINK)-$(BEST),true-opt)
  DEPNATDYN:=
else
  DEPNATDYN:=-natdynlink no
endif

INSTALLBIN:=install
INSTALLLIB:=install -m 644 
INSTALLSH:=./install.sh
MKDIR:=install -d

COQIDEBYTE:=bin/coqide.byte$(EXE)
COQIDE:=bin/coqide$(EXE)
COQIDEAPP:=bin/CoqIDE_$(VERSION).app
COQIDEINAPP:=$(COQIDEAPP)/Contents/MacOS/coqide

ifeq ($(BEST),opt)
OPT:=opt
else
OPT:=
endif

BESTOBJ:=$(if $(OPT),.cmx,.cmo)
BESTLIB:=$(if $(OPT),.cmxa,.cma)
BESTDYN:=$(if $(OPT),.cmxs,.cma)

COQBINARIES:= $(COQMKTOP) \
  $(COQTOPBYTE) $(COQTOPEXE) \
  $(CHICKENBYTE) $(CHICKEN)

CSDPCERT:=plugins/micromega/csdpcert$(EXE)

CORESRCDIRS:=\
  config 	lib		kernel		kernel/byterun	library \
  proofs 	tactics 	pretyping	interp		stm \
  toplevel	parsing	printing	grammar	        intf

PLUGINS:=\
  omega		romega 		micromega 	quote \
  setoid_ring 	xml 		extraction 	fourier \
  cc 		funind 		firstorder 	Derive \
  rtauto 	nsatz           syntax          decl_mode	btauto

SRCDIRS:=\
  $(CORESRCDIRS)  \
  tools 	tools/coqdoc	\
  $(addprefix plugins/, $(PLUGINS))

IDESRCDIRS:= $(CORESRCDIRS) ide ide/utils

# Order is relevent here because kernel and checker contain files
# with the same name
CHKSRCDIRS:= checker lib config kernel parsing

###########################################################################
# tools
###########################################################################

COQDEP:=bin/coqdep$(EXE)
COQDEPBOOT:=bin/coqdep_boot$(EXE)
COQMAKEFILE:=bin/coq_makefile$(EXE)
GALLINA:=bin/gallina$(EXE)
COQTEX:=bin/coq-tex$(EXE)
COQWC:=bin/coqwc$(EXE)
COQDOC:=bin/coqdoc$(EXE)
FAKEIDE:=bin/fake_ide$(EXE)
COQWORKMGR:=bin/coqworkmgr$(EXE)

TOOLS:=$(COQDEP) $(COQMAKEFILE) $(GALLINA) $(COQTEX) $(COQWC) $(COQDOC) $(COQC)\
	$(COQWORKMGR)

PRIVATEBINARIES:=$(FAKEIDE) $(COQDEPBOOT)

###########################################################################
# Documentation
###########################################################################

LATEX:=latex
BIBTEX:=BIBINPUTS=.: bibtex -min-crossrefs=10
MAKEINDEX:=makeindex
PDFLATEX:=pdflatex
HEVEA:=hevea
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 AsyncProofs.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 ) \
  $(REFMANCOQTEXFILES) \

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

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

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



###########################################################################
# Object and Source files 
###########################################################################

COQRUN := coqrun
LIBCOQRUN:=kernel/byterun/lib$(COQRUN).a
DLLCOQRUN:=$(dir $(LIBCOQRUN))dll$(COQRUN)$(DLLEXT)

BYTERUN:=$(addprefix kernel/byterun/, \
  coq_fix_code.o coq_memory.o coq_values.o coq_interp.o )

# LINK ORDER:
# Beware that highparsing.cma should appear before hightactics.cma
# respecting this order is useful for developers that want to load or link
# the libraries directly

CORECMA:=lib/clib.cma lib/lib.cma kernel/kernel.cma library/library.cma \
        pretyping/pretyping.cma interp/interp.cma proofs/proofs.cma \
        parsing/parsing.cma printing/printing.cma tactics/tactics.cma \
	stm/stm.cma toplevel/toplevel.cma parsing/highparsing.cma tactics/hightactics.cma

TOPLOOPCMA:=stm/stmworkertop.cma stm/tacworkertop.cma

GRAMMARCMA:=tools/compat5.cmo grammar/grammar.cma

OMEGACMA:=plugins/omega/omega_plugin.cma
ROMEGACMA:=plugins/romega/romega_plugin.cma
MICROMEGACMA:=plugins/micromega/micromega_plugin.cma
QUOTECMA:=plugins/quote/quote_plugin.cma
RINGCMA:=plugins/setoid_ring/newring_plugin.cma
NSATZCMA:=plugins/nsatz/nsatz_plugin.cma
FOURIERCMA:=plugins/fourier/fourier_plugin.cma
EXTRACTIONCMA:=plugins/extraction/extraction_plugin.cma
FUNINDCMA:=plugins/funind/recdef_plugin.cma
FOCMA:=plugins/firstorder/ground_plugin.cma
CCCMA:=plugins/cc/cc_plugin.cma
BTAUTOCMA:=plugins/btauto/btauto_plugin.cma
RTAUTOCMA:=plugins/rtauto/rtauto_plugin.cma
NATSYNTAXCMA:=plugins/syntax/nat_syntax_plugin.cma
OTHERSYNTAXCMA:=$(addprefix plugins/syntax/, \
        z_syntax_plugin.cma \
        numbers_syntax_plugin.cma \
        r_syntax_plugin.cma \
	ascii_syntax_plugin.cma \
        string_syntax_plugin.cma )
DECLMODECMA:=plugins/decl_mode/decl_mode_plugin.cma
DERIVECMA:=plugins/Derive/derive_plugin.cma

PLUGINSCMA:=$(OMEGACMA) $(ROMEGACMA) $(MICROMEGACMA) $(DECLMODECMA) \
        $(QUOTECMA) $(RINGCMA) \
        $(FOURIERCMA) $(EXTRACTIONCMA) \
        $(CCCMA)  $(FOCMA) $(RTAUTOCMA) $(BTAUTOCMA) \
        $(FUNINDCMA) $(NSATZCMA) $(NATSYNTAXCMA) $(OTHERSYNTAXCMA) \
	$(DERIVECMA)

ifneq ($(HASNATDYNLINK),false)
 STATICPLUGINS:=
 INITPLUGINS:=$(EXTRACTIONCMA) $(FOCMA) $(CCCMA) \
	$(FUNINDCMA) $(NATSYNTAXCMA)
 INITPLUGINSOPT:=$(INITPLUGINS:.cma=.cmxs)
 PLUGINS:=$(PLUGINSCMA)
 PLUGINSOPT:=$(PLUGINSCMA:.cma=.cmxs)
else
 STATICPLUGINS:=$(PLUGINSCMA)
 INITPLUGINS:=
 INITPLUGINSOPT:=
 PLUGINS:=
 PLUGINSOPT:=
endif

LINKCMO:=$(CORECMA) $(STATICPLUGINS)
LINKCMX:=$(CORECMA:.cma=.cmxa) $(STATICPLUGINS:.cma=.cmxa)

IDEDEPS:=lib/clib.cma lib/xml_lexer.cmo lib/xml_parser.cmo lib/xml_printer.cmo lib/errors.cmo lib/spawn.cmo
IDECMA:=ide/ide.cma
IDETOPLOOPCMA=ide/coqidetop.cma

LINKIDE:=$(IDEDEPS) $(IDECDEPS) $(IDECMA) ide/coqide_main.ml
LINKIDEOPT:=$(IDEOPTCDEPS) $(patsubst %.cma,%.cmxa,$(IDEDEPS:.cmo=.cmx)) $(IDECMA:.cma=.cmxa) ide/coqide_main.ml

# modules known by the toplevel of Coq

OBJSMOD:=$(shell cat $(CORECMA:.cma=.mllib))

IDEMOD:=$(shell cat ide/ide.mllib)

# coqmktop, coqc

COQENVCMO:=lib/clib.cma lib/errors.cmo

COQMKTOPCMO:=$(COQENVCMO) tools/tolink.cmo tools/coqmktop.cmo

COQCCMO:=$(COQENVCMO) toplevel/usage.cmo tools/coqc.cmo

## Misc

CSDPCERTCMO:=$(addprefix plugins/micromega/, \
  mutils.cmo 	micromega.cmo \
  sos_types.cmo sos_lib.cmo sos.cmo 	csdpcert.cmo )

DEBUGPRINTERS:=dev/top_printers.cmo dev/vm_printers.cmo dev/printers.cma

COQDEPCMO:=$(COQENVCMO) tools/coqdep_lexer.cmo tools/coqdep_common.cmo tools/coqdep.cmo

COQDOCCMO:=lib/clib.cma $(addprefix tools/coqdoc/, \
  cdglobals.cmo alpha.cmo index.cmo tokens.cmo output.cmo cpretty.cmo main.cmo )

COQMAKEFILECMO:=lib/clib.cma ide/project_file.cmo tools/coq_makefile.cmo

###########################################################################
# vo files
###########################################################################

## we now retrieve the names of .vo file to compile in */vo.itarget files

cat_vo_itarget = $(addprefix $(1)/,$(shell cat $(1)/vo.itarget))

## Theories

INITVO:=$(call cat_vo_itarget, theories/Init)
LOGICVO:=$(call cat_vo_itarget, theories/Logic)
STRUCTURESVO:=$(call cat_vo_itarget, theories/Structures)
ARITHVO:=$(call cat_vo_itarget, theories/Arith)
SORTINGVO:=$(call cat_vo_itarget, theories/Sorting)
BOOLVO:=$(call cat_vo_itarget, theories/Bool)
PARITHVO:=$(call cat_vo_itarget, theories/PArith)
NARITHVO:=$(call cat_vo_itarget, theories/NArith)
ZARITHVO:=$(call cat_vo_itarget, theories/ZArith)
QARITHVO:=$(call cat_vo_itarget, theories/QArith)
LISTSVO:=$(call cat_vo_itarget, theories/Lists)
VECTORSVO:=$(call cat_vo_itarget, theories/Vectors)
STRINGSVO:=$(call cat_vo_itarget, theories/Strings)
SETSVO:=$(call cat_vo_itarget, theories/Sets)
FSETSVO:=$(call cat_vo_itarget, theories/FSets)
MSETSVO:=$(call cat_vo_itarget, theories/MSets)
RELATIONSVO:=$(call cat_vo_itarget, theories/Relations)
WELLFOUNDEDVO:=$(call cat_vo_itarget, theories/Wellfounded)
REALSVO:=$(call cat_vo_itarget, theories/Reals)
NUMBERSVO:=$(call cat_vo_itarget, theories/Numbers)
SETOIDSVO:=$(call cat_vo_itarget, theories/Setoids)
UNICODEVO:=$(call cat_vo_itarget, theories/Unicode)
CLASSESVO:=$(call cat_vo_itarget, theories/Classes)
PROGRAMVO:=$(call cat_vo_itarget, theories/Program)

THEORIESVO:=\
  $(INITVO) $(LOGICVO) $(ARITHVO) $(BOOLVO) \
  $(UNICODEVO) $(CLASSESVO) $(PROGRAMVO) \
  $(RELATIONSVO) $(WELLFOUNDEDVO) $(SETOIDSVO) \
  $(LISTSVO) $(STRINGSVO) \
  $(PARITHVO) $(NARITHVO) $(ZARITHVO) \
  $(SETSVO) $(FSETSVO) $(MSETSVO) \
  $(REALSVO)  $(SORTINGVO) $(QARITHVO) \
  $(NUMBERSVO) $(STRUCTURESVO) $(VECTORSVO)

THEORIESLIGHTVO:= $(INITVO) $(LOGICVO) $(UNICODEVO) $(ARITHVO)

## Plugins

OMEGAVO:=$(call cat_vo_itarget, plugins/omega)
ROMEGAVO:=$(call cat_vo_itarget, plugins/romega)
MICROMEGAVO:=$(call cat_vo_itarget, plugins/micromega)
QUOTEVO:=$(call cat_vo_itarget, plugins/quote)
RINGVO:=$(call cat_vo_itarget, plugins/setoid_ring)
NSATZVO:=$(call cat_vo_itarget, plugins/nsatz)
FOURIERVO:=$(call cat_vo_itarget, plugins/fourier)
FUNINDVO:=$(call cat_vo_itarget, plugins/funind)
BTAUTOVO:=$(call cat_vo_itarget, plugins/btauto)
RTAUTOVO:=$(call cat_vo_itarget, plugins/rtauto)
EXTRACTIONVO:=$(call cat_vo_itarget, plugins/extraction)
CCVO:=
DERIVEVO:=$(call cat_vo_itarget, plugins/Derive)

PLUGINSVO:= $(OMEGAVO) $(ROMEGAVO) $(MICROMEGAVO) \
	    $(FOURIERVO) $(CCVO) $(FUNINDVO) \
	    $(RTAUTOVO) $(BTAUTOVO) $(RINGVO) $(QUOTEVO) \
            $(NSATZVO) $(EXTRACTIONVO) $(DERIVEVO)

ALLVO:= $(THEORIESVO) $(PLUGINSVO)
VFILES:= $(ALLVO:.vo=.v)
ALLSTDLIB := test-suite/misc/universes/all_stdlib

# convert a (stdlib) filename into a module name:
# remove .vo, replace theories and plugins by Coq, and replace slashes by dots
vo_to_mod = $(subst /,.,$(patsubst theories/%,Coq.%,$(patsubst plugins/%,Coq.%,$(1:.vo=))))

# Converting a stdlib filename into native compiler filenames
# Used for install targets
vo_to_cm = $(foreach vo,$(1),$(dir $(vo)).coq-native/$(subst /,_,$(patsubst theories/%,NCoq_%,$(patsubst plugins/%,NCoq_%,$(vo:.vo=.cm*)))))

vo_to_obj = $(foreach vo,$(1),$(dir $(vo)).coq-native/$(subst /,_,$(patsubst theories/%,NCoq_%,$(patsubst plugins/%,NCoq_%,$(vo:.vo=.o)))))

ALLMODS:=$(call vo_to_mod,$(ALLVO))

LIBFILES:=$(THEORIESVO) $(PLUGINSVO) $(call vo_to_cm,$(THEORIESVO)) \
	    $(call vo_to_cm,$(PLUGINSVO)) $(call vo_to_obj,$(THEORIESVO)) \
	    $(call vo_to_obj,$(PLUGINSVO)) 

LIBFILESLIGHT:=$(THEORIESLIGHTVO)

###########################################################################
# Miscellaneous
###########################################################################

MANPAGES:=man/coq-tex.1 man/coqdep.1 man/gallina.1 \
	man/coqc.1 man/coqtop.1 man/coqtop.byte.1 man/coqtop.opt.1 \
	man/coqwc.1 man/coqdoc.1 man/coqide.1 \
	man/coq_makefile.1 man/coqmktop.1 man/coqchk.1

###########################################################################
# Source documentation
###########################################################################

OCAMLDOCDIR=dev/ocamldoc

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

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

###########################################################################
# GTK for Coqide MacOS bundle
###########################################################################

GTKSHARE=$(shell pkg-config --variable=prefix gtk+-2.0)/share
GTKBIN=$(shell pkg-config --variable=prefix gtk+-2.0)/bin
GTKLIBS=$(shell pkg-config --variable=libdir gtk+-2.0)


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