aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile.common
blob: 100698321aa7e1ae302485b095896d293675c5c3 (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
#######################################################################
#  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) 

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

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

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

COQDEPBOOT:=bin/coqdep_boot$(EXE)
OCAMLLIBDEP:=bin/ocamllibdep$(EXE)
FAKEIDE:=bin/fake_ide$(EXE)

PRIVATEBINARIES:=$(FAKEIDE) $(OCAMLLIBDEP) $(COQDEPBOOT)

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

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

ifeq ($(HASNATDYNLINK)-$(BEST),false-opt)
 # static link of plugins, do not mention them in .v.d
 DYNDEP:=-dyndep no
else
 DYNDEP:=-dyndep var
endif

# Which coqtop do we use to build .vo file ? The best ;-)
# Note: $(BEST) could be overridden by the user if a byte build is desired
# Note: coqdep -dyndep var will use $(DYNOBJ) and $(DYNLIB) extensions
# for Declare ML Module files.

ifeq ($(BEST),opt)
COQTOPBEST:=$(COQTOPEXE)
DYNOBJ:=.cmxs
DYNLIB:=.cmxs
else
COQTOPBEST:=$(COQTOPBYTE)
DYNOBJ:=.cmo
DYNLIB:=.cma
endif

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

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

PLUGINDIRS:=\
  omega		romega 		micromega 	quote \
  setoid_ring 	extraction 	fourier \
  cc 		funind 		firstorder 	derive \
  rtauto 	nsatz           syntax          btauto \
  ssrmatching	ltac		ssr

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

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:
# 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 intf/intf.cma library/library.cma \
        engine/engine.cma pretyping/pretyping.cma interp/interp.cma proofs/proofs.cma \
        parsing/parsing.cma printing/printing.cma tactics/tactics.cma vernac/vernac.cma \
	stm/stm.cma toplevel/toplevel.cma parsing/highparsing.cma API/API.cma

TOPLOOPCMA:=stm/proofworkertop.cma stm/tacworkertop.cma stm/queryworkertop.cma

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

# modules known by the toplevel of Coq

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

###########################################################################
# plugins object files
###########################################################################

OMEGACMO:=plugins/omega/omega_plugin.cmo
ROMEGACMO:=plugins/romega/romega_plugin.cmo
MICROMEGACMO:=plugins/micromega/micromega_plugin.cmo
QUOTECMO:=plugins/quote/quote_plugin.cmo
RINGCMO:=plugins/setoid_ring/newring_plugin.cmo
NSATZCMO:=plugins/nsatz/nsatz_plugin.cmo
FOURIERCMO:=plugins/fourier/fourier_plugin.cmo
EXTRACTIONCMO:=plugins/extraction/extraction_plugin.cmo
FUNINDCMO:=plugins/funind/recdef_plugin.cmo
FOCMO:=plugins/firstorder/ground_plugin.cmo
CCCMO:=plugins/cc/cc_plugin.cmo
BTAUTOCMO:=plugins/btauto/btauto_plugin.cmo
RTAUTOCMO:=plugins/rtauto/rtauto_plugin.cmo
NATSYNTAXCMO:=plugins/syntax/nat_syntax_plugin.cmo
OTHERSYNTAXCMO:=$(addprefix plugins/syntax/, \
        z_syntax_plugin.cmo \
        r_syntax_plugin.cmo \
	int31_syntax_plugin.cmo \
	ascii_syntax_plugin.cmo \
        string_syntax_plugin.cmo )
DERIVECMO:=plugins/derive/derive_plugin.cmo
LTACCMO:=plugins/ltac/ltac_plugin.cmo plugins/ltac/tauto_plugin.cmo
SSRMATCHINGCMO:=plugins/ssrmatching/ssrmatching_plugin.cmo
SSRCMO:=plugins/ssr/ssreflect_plugin.cmo

PLUGINSCMO:=$(LTACCMO) $(OMEGACMO) $(ROMEGACMO) $(MICROMEGACMO) \
        $(QUOTECMO) $(RINGCMO) \
        $(FOURIERCMO) $(EXTRACTIONCMO) \
        $(CCCMO)  $(FOCMO) $(RTAUTOCMO) $(BTAUTOCMO) \
        $(FUNINDCMO) $(NSATZCMO) $(NATSYNTAXCMO) $(OTHERSYNTAXCMO) \
	$(DERIVECMO) $(SSRMATCHINGCMO) $(SSRCMO)

ifeq ($(HASNATDYNLINK)-$(BEST),false-opt)
 STATICPLUGINS:=$(PLUGINSCMO)
 PLUGINS:=
else
 STATICPLUGINS:=
 PLUGINS:=$(PLUGINSCMO)
endif
PLUGINSOPT:=$(PLUGINSCMO:.cmo=.cmxs)

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

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

THEORIESVO := $(patsubst %.v,%.vo,$(shell find theories -type f -name "*.v"))
PLUGINSVO := $(patsubst %.v,%.vo,$(shell find plugins -type f -name "*.v"))
ALLVO := $(THEORIESVO) $(PLUGINSVO)
VFILES := $(ALLVO:.vo=.v)

## More specific targets

THEORIESLIGHTVO:= \
 $(filter theories/Init/% theories/Logic/% theories/Unicode/% theories/Arith/%, $(THEORIESVO))

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=))))

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


# 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)))))

GLOBFILES:=$(ALLVO:.vo=.glob)
LIBFILES:=$(ALLVO) $(call vo_to_cm,$(ALLVO)) \
	    $(call vo_to_obj,$(ALLVO)) \
	    $(VFILES) $(GLOBFILES)

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