aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile.common
blob: df705034e7522bb9c4eb29085c00679aa2edeede (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
#######################################################################
#  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),true-opt)
  DEPNATDYN:=
else
  DEPNATDYN:=-natdynlink no
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

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

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

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 \
        numbers_syntax_plugin.cmo \
        r_syntax_plugin.cmo \
	ascii_syntax_plugin.cmo \
        string_syntax_plugin.cmo )
DECLMODECMO:=plugins/decl_mode/decl_mode_plugin.cmo
DERIVECMO:=plugins/derive/derive_plugin.cmo
LTACCMO:=plugins/ltac/ltac_plugin.cmo
SSRMATCHINGCMO:=plugins/ssrmatching/ssrmatching_plugin.cmo

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

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

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

THEORIESVO:= $(foreach f, $(wildcard theories/*/vo.itarget), \
                $(addprefix $(dir $(f)),$(shell cat $(f))))

PLUGINSVO:=  $(foreach f, $(wildcard plugins/*/vo.itarget), \
                $(addprefix $(dir $(f)),$(shell cat $(f))))

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

LIBFILES:=$(THEORIESVO) $(PLUGINSVO) $(call vo_to_cm,$(THEORIESVO)) \
	    $(call vo_to_cm,$(PLUGINSVO)) $(call vo_to_obj,$(THEORIESVO)) \
	    $(call vo_to_obj,$(PLUGINSVO)) \
	    $(PLUGINSVO:.vo=.v) $(THEORIESVO:.vo=.v) \
	    $(PLUGINSVO:.vo=.glob) $(THEORIESVO:.vo=.glob)

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