Makefile.in 69.1 KB
Newer Older
1 2 3
####################################################################
#                                                                  #
#  The Why3 Verification Platform   /   The Why3 Development Team  #
Guillaume Melquiond's avatar
Guillaume Melquiond committed
4
#  Copyright 2010-2018   --   Inria - CNRS - Paris-Sud University  #
5 6 7 8 9 10
#                                                                  #
#  This software is distributed under the terms of the GNU Lesser  #
#  General Public License version 2.1, with the special exception  #
#  on linking described in file LICENSE.                           #
#                                                                  #
####################################################################
11

12 13 14
VERBOSEMAKE ?= @enable_verbose_make@

ifeq ($(VERBOSEMAKE),yes)
15 16
  SHOW = @true
  HIDE =
17
else
18 19
  SHOW = @echo
  HIDE = @
20 21
endif

22
# install the binaries
23
DESTDIR =
24

25
prefix	    = @prefix@
26 27 28 29 30
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@

BINDIR  = $(DESTDIR)@bindir@
LIBDIR  = $(DESTDIR)@libdir@
31
DATADIR = $(DESTDIR)@datarootdir@
32
MANDIR  = $(DESTDIR)@mandir@
33
TOOLDIR = $(LIBDIR)/why3/commands
34

Andrei Paskevich's avatar
Andrei Paskevich committed
35
# OS specific stuff
36
EXE   = @EXE@
37 38

# other variables
39
CC        = @CC@
40 41 42
MKDIR_P   = @MKDIR_P@
INSTALL   = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
43 44 45 46 47 48 49
OCAMLC    = @OCAMLC@
OCAMLOPT  = @OCAMLOPT@
OCAMLDEP  = @OCAMLDEP@
OCAMLLEX  = @OCAMLLEX@
OCAMLYACC = @OCAMLYACC@
OCAMLDOC  = @OCAMLDOC@
OCAMLLIB  = @OCAMLLIB@
50
OCAMLINSTALLLIB  = $(DESTDIR)@OCAMLINSTALLLIB@
51 52
OCAMLBEST = @OCAMLBEST@
OCAMLVERSION = @OCAMLVERSION@
53 54
COQC      = @COQC@
COQDEP    = @COQDEP@
55 56
COQCAMLP  = @COQCAMLP@
COQCAMLPLIB = @COQCAMLPLIB@
MARCHE Claude's avatar
MARCHE Claude committed
57
FRAMAC_LIBDIR = $(DESTDIR)@FRAMAC_LIBDIR@
58

59 60 61 62 63 64
ifeq (@enable_menhirLib@,yes)
MENHIR	  = @MENHIR@ --table
else
MENHIR	  = @MENHIR@
endif

65
DEPFLAGS  = -slash -I lib/why3
66
ifeq (@OCAMLBEST@,opt)
67 68
# the semantics of the -native flag changed in ocaml 4.03.0
#DEPFLAGS += -native
69 70
endif

71
RUBBER = @RUBBER@
72
HEVEA = @HEVEA@
73
HACHA = @HACHA@
74
EMACS = @EMACS@
75

76
#PSVIEWER  = @PSVIEWER@
Andrei Paskevich's avatar
Andrei Paskevich committed
77
#PDFVIEWER = @PDFVIEWER@
78

79
INCLUDES = @ZIPINCLUDE@ @MENHIRINCLUDE@
80 81 82 83 84 85 86 87 88 89

# warnings are enabled and non fatal by default, except:
# - disabled:
#   4    Fragile pattern matching: matching that will remain complete even
#        if additional constructors are added to one of the variant types
#        matched.
#   9    Missing fields in a record pattern.
#   41   Ambiguous constructor or label name.
#   44   Open statement shadows an already defined identifier.
#   45   Open statement shadows an already defined label or constructor.
90
#   50   Unexpected documentation comment.
91 92 93
#   52   The argument of this constructor should not be matched against a
#        constant pattern; the actual value of the argument could change
#        in the future.
94 95 96 97 98
# - fatal:
#   5    Partially applied function: expression whose result has function
#        type and is ignored.
#   48   Implicit elimination of optional arguments.

99
WARNINGS = A-4-9-41-44-45-50-52@5@48
100

101 102
OFLAGS = -w $(WARNINGS) -safe-string -keep-locs -bin-annot -dtypes -g -I lib/why3 $(INCLUDES)
BFLAGS = -w $(WARNINGS) -safe-string -keep-locs -bin-annot -dtypes -g -I lib/why3 $(INCLUDES)
103 104 105

OLINKFLAGS = -linkall $(EXTCMXA)
BLINKFLAGS = -linkall $(EXTCMA)
106

107
ifeq (@enable_profiling@,yes)
108 109 110
OFLAGS += -g -p
endif

111 112 113
# see http://caml.inria.fr/mantis/view.php?id=4991
CMIHACK = -intf-suffix .cmi

114 115
# external libraries common to all binaries

116
EXTOBJS = @MENHIRLIB@
117
EXTLIBS = str unix nums dynlink @ZIPLIB@
118 119 120

EXTCMA	= $(addsuffix .cma,$(EXTLIBS)) $(addsuffix .cmo,$(EXTOBJS))
EXTCMXA = $(addsuffix .cmxa,$(EXTLIBS)) $(addsuffix .cmx,$(EXTOBJS))
121

122 123
INSTALLED_LIB_EXTS = a cma cmx cmi cmxa cmxs
COMPILED_LIB_EXTS = $(INSTALLED_LIB_EXTS) o cmo cmt cmti annot dep conflicts
124

125 126
TOTARGET = > "$@" || (RV=$$?; rm -f "$@"; exit $${RV})

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
127 128 129
###############
# main target
###############
130

131 132 133 134
all: @OCAMLBEST@
plugins: plugins.@OCAMLBEST@
opt: plugins.opt
byte: plugins.byte
Francois Bobot's avatar
Francois Bobot committed
135

136 137 138 139 140
ifeq (@enable_local@,yes)
all: install_local
endif

.PHONY: byte opt clean depend all install install_local install_no_local
141
.PHONY: plugins plugins.byte plugins.opt
142

143 144 145 146
CLEANDIRS =
CLEANLIBS =
GENERATED =

147 148 149
##############
# Why3 library
##############
150

151
LIBGENERATED = src/util/config.ml \
152
	       src/util/rc.ml src/util/lexlib.ml src/parser/lexer.ml \
153 154
	       src/parser/parser.mli src/parser/parser.ml \
	       src/driver/driver_parser.mli src/driver/driver_parser.ml \
155
	       src/driver/driver_lexer.ml \
156 157
	       src/driver/parse_smtv2_model_parser.mli src/driver/parse_smtv2_model_parser.ml \
	       src/driver/parse_smtv2_model_lexer.ml \
158
	       src/session/compress.ml src/session/xml.ml \
159
	       src/session/strategy_parser.ml \
160
	       lib/ocaml/why3__BigInt_compat.ml
161

162 163
LIB_UTIL = config bigInt util opt lists strings \
	   extmap extset exthtbl weakhtbl \
164
	   hashcons stdlib exn_printer pp json debug loc lexlib print_tree \
165
	   cmdline warning sysutil rc plugin bigInt number pqueue
166

167
LIB_CORE = ident ty term pattern decl theory \
168
	   task pretty dterm env trans printer model_parser
169

170
LIB_DRIVER = prove_client call_provers driver_ast driver_parser driver_lexer driver \
171 172 173 174
		whyconf autodetection \
		smt2_model_defs parse_smtv2_model_parser \
		collect_data_model parse_smtv2_model_lexer parse_smtv2_model \
		parse_smtv2_model
175

176
LIB_MLW = ity expr dexpr pdecl pmodule
177

178 179
LIB_PARSER = ptree glob parser typing lexer

180
LIB_TRANSFORM = simplify_formula inlining split_goal induction \
Clément Fumex's avatar
Clément Fumex committed
181
		detect_polymorphism reduction_engine compute \
182
		eliminate_definition eliminate_algebraic \
183
		eliminate_inductive eliminate_let eliminate_if \
184 185 186 187
		libencoding discriminate encoding encoding_select \
		encoding_guards_full encoding_tags_full \
		encoding_guards encoding_tags encoding_twin \
		encoding_sort simplify_array filter_trigger \
188
		introduction abstraction close_epsilon lift_epsilon \
189
		eliminate_epsilon intro_projections_counterexmp \
190
		intro_vc_vars_counterexmp prepare_for_counterexmp \
MARCHE Claude's avatar
MARCHE Claude committed
191
		eval_match instantiate_predicate smoke_detector \
Clément Fumex's avatar
Clément Fumex committed
192
		induction_pr prop_curry eliminate_literal
193

Sylvain Dailler's avatar
Sylvain Dailler committed
194
LIB_PRINTER = cntexmp_printer alt_ergo why3printer smtv1 smtv2 coq\
195
	      pvs isabelle \
196
	      simplify gappa cvc3 yices mathematica
197

198
LIB_WHYML = mlw_ty mlw_expr mlw_decl mlw_pretty mlw_wp mlw_module \
199
	    mlw_dexpr mlw_typing mlw_driver mlw_exec mlw_ocaml \
200
	    mlw_main mlw_interp
201

202 203 204
LIB_SESSION = compress xml termcode session session_tools strategy \
              strategy_parser session_scheduler

205
LIBMODULES =  $(addprefix src/util/, $(LIB_UTIL)) \
206 207
	      $(addprefix src/core/, $(LIB_CORE)) \
	      $(addprefix src/driver/, $(LIB_DRIVER)) \
208
	      $(addprefix src/mlw/, $(LIB_MLW)) \
209
	      $(addprefix src/parser/, $(LIB_PARSER)) \
210
	      $(addprefix src/transform/, $(LIB_TRANSFORM)) \
François Bobot's avatar
François Bobot committed
211
	      $(addprefix src/printer/, $(LIB_PRINTER)) \
212 213
	      $(addprefix src/whyml/, $(LIB_WHYML)) \
	      $(addprefix src/session/, $(LIB_SESSION))
214

215
LIBDIRS = util core driver mlw parser transform printer whyml session
216
LIBINCLUDES = $(addprefix -I src/, $(LIBDIRS))
MARCHE Claude's avatar
MARCHE Claude committed
217

218
LIBDEP = $(addsuffix .dep, $(LIBMODULES))
219 220
LIBCMO = $(addsuffix .cmo, $(LIBMODULES))
LIBCMX = $(addsuffix .cmx, $(LIBMODULES))
221

222
$(LIBDEP): DEPFLAGS += $(LIBINCLUDES)
223
$(LIBCMO) $(LIBCMX): INCLUDES += $(LIBINCLUDES)
224
$(LIBCMX): OFLAGS += -for-pack Why3
225

226 227
$(LIBDEP): $(LIBGENERATED)

228 229 230
# Zarith

ifeq (@enable_zarith@,yes)
231
lib/ocaml/why3__BigInt_compat.ml: config.status lib/ocaml/why3__BigInt_zarith.ml
232
	cp lib/ocaml/why3__BigInt_zarith.ml $@
233
else
234
lib/ocaml/why3__BigInt_compat.ml: config.status lib/ocaml/why3__BigInt_num.ml
235
	cp lib/ocaml/why3__BigInt_num.ml $@
236 237
endif

238 239 240 241 242 243 244 245 246 247
# Ocamlzip

ifeq (@enable_zip@,yes)
src/session/compress.ml: config.status src/session/compress_z.ml
	cp src/session/compress_z.ml $@
else
src/session/compress.ml: config.status src/session/compress_none.ml
	cp src/session/compress_none.ml $@
endif

248 249
# hide deprecated warnings for strings

250 251
src/util/strings.cmo: WARNINGS:=$(WARNINGS)-3
src/util/strings.cmx: WARNINGS:=$(WARNINGS)-3
252

253 254
# hide warning 'no cmx file was found in path for module ..., and its interface was not compiled with -opaque' for the coq tactic

255
src/coq-tactic/why3tac.cmx: WARNINGS:=$(WARNINGS)-58
256

257
# build targets
258

259 260
byte: lib/why3/why3.cma
opt:  lib/why3/why3.cmxa
261

262 263
lib/why3/why3.cma: lib/why3/why3.cmo
lib/why3/why3.cmxa: lib/why3/why3.cmx
264

265
lib/why3/why3.cmo: $(LIBCMO)
266 267
	$(SHOW) 'Linking  $@'
	$(HIDE)$(OCAMLC) $(BFLAGS) -pack -o $@ $^
268

269
lib/why3/why3.cmx: $(LIBCMX) lib/why3/why3.cmo
270
	$(SHOW) 'Linking  $@'
271
	$(HIDE)$(OCAMLOPT) $(OFLAGS) $(CMIHACK) -pack -o $@ $(filter %.cmx, $^)
272

273
# clean and depend
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
274

275
ifneq "$(MAKECMDGOALS:clean%=clean)" "clean"
276
-include $(LIBDEP)
277
endif
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
278

279
depend: $(LIBDEP)
280

281 282 283
CLEANDIRS += src $(addprefix src/, $(LIBDIRS))
CLEANLIBS += lib/why3/why3session lib/why3/why3
GENERATED += $(LIBGENERATED)
284

285 286 287
###############
# installation
###############
288

Kate's avatar
Kate committed
289 290
clean_old_install::
	rm -rf $(LIBDIR)/why3
MARCHE Claude's avatar
MARCHE Claude committed
291 292
	rm -rf $(DATADIR)/why3

293 294
clean_old_install-lib::
	if test -d $(OCAMLINSTALLLIB) -a -w $(OCAMLINSTALLLIB); then \
Guillaume Melquiond's avatar
Guillaume Melquiond committed
295
	  rm -rf $(OCAMLINSTALLLIB)/why3; \
296
	fi
297

298
install_no_local::
299 300 301 302 303 304
	$(MKDIR_P) $(BINDIR)
	$(MKDIR_P) $(LIBDIR)/why3
	$(MKDIR_P) $(TOOLDIR)
	$(MKDIR_P) $(DATADIR)/why3
	$(MKDIR_P) $(DATADIR)/why3/images
	$(MKDIR_P) $(DATADIR)/why3/vim
305 306
	$(MKDIR_P) $(DATADIR)/why3/vim/ftdetect
	$(MKDIR_P) $(DATADIR)/why3/vim/syntax
307 308 309 310 311 312 313 314 315 316
	$(MKDIR_P) $(DATADIR)/why3/lang
	$(MKDIR_P) $(DATADIR)/why3/theories
	$(MKDIR_P) $(DATADIR)/why3/modules/mach
	$(MKDIR_P) $(DATADIR)/why3/drivers
	$(INSTALL_DATA) theories/*.why $(DATADIR)/why3/theories
	$(INSTALL_DATA) modules/*.mlw $(DATADIR)/why3/modules
	$(INSTALL_DATA) modules/mach/*.mlw $(DATADIR)/why3/modules/mach
	$(INSTALL_DATA) drivers/*.drv drivers/*.gen $(DATADIR)/why3/drivers
	$(INSTALL_DATA) LICENSE $(DATADIR)/why3/
	$(INSTALL_DATA) share/provers-detection-data.conf $(DATADIR)/why3/
317 318
	for i in share/images/*.rc; do \
	     d=`basename $$i .rc`; \
319 320 321
	     $(INSTALL_DATA) $$i $(DATADIR)/why3/images; \
	     $(MKDIR_P) $(DATADIR)/why3/images/$$d; \
	     $(INSTALL_DATA) share/images/$$d/* $(DATADIR)/why3/images/$$d; \
322
	done
323 324 325
	$(INSTALL_DATA) share/images/*.png $(DATADIR)/why3/images
	$(INSTALL_DATA) share/why3session.dtd $(DATADIR)/why3
	$(INSTALL_DATA) share/Makefile.config $(DATADIR)/why3
326 327
	$(INSTALL_DATA) share/vim/ftdetect/why3.vim $(DATADIR)/why3/vim/ftdetect/why3.vim
	$(INSTALL_DATA) share/vim/syntax/why3.vim $(DATADIR)/why3/vim/syntax/why3.vim
328
	$(INSTALL_DATA) share/lang/why3.lang $(DATADIR)/why3/lang/why3.lang
329

MARCHE Claude's avatar
MARCHE Claude committed
330
install_no_local_lib::
331 332
	$(MKDIR_P) $(OCAMLINSTALLLIB)/why3
	$(INSTALL_DATA) $(wildcard $(addprefix lib/why3/why3., $(INSTALLED_LIB_EXTS))) \
333
		lib/why3/META $(OCAMLINSTALLLIB)/why3
MARCHE Claude's avatar
MARCHE Claude committed
334

335 336
ifeq (@enable_local@,yes)
install install-lib:
337 338
	@echo "Why3 is configured in local installation mode."
	@echo "To install Why3, run ./configure --disable-local ; make ; make install"
339
else
MARCHE Claude's avatar
MARCHE Claude committed
340
install: clean_old_install install_no_local
341
install-lib: clean_old_install-lib install_no_local_lib
342 343
endif

MARCHE Claude's avatar
MARCHE Claude committed
344 345
install-all: install install-lib

Kate's avatar
Kate committed
346 347 348 349
##################
# Uninstallation
##################

350 351 352 353 354 355
ifeq (@enable_local@,yes)
uninstall:
	@echo "Why3 is configured in local installation mode."
else
uninstall: clean_old_install clean_old_install-lib
endif
Kate's avatar
Kate committed
356

357 358 359 360 361 362 363
##################
# Why3 emacs mode
##################

%.elc: %.el
	$(EMACS) --batch --no-init-file -f batch-byte-compile $<

Kate's avatar
Kate committed
364 365 366 367 368
clean_old_install::
	rm -f $(DATADIR)/emacs/site-lisp/why3.el
	rm -f $(DATADIR)/emacs/site-lisp/why3.elc

install_no_local::
369
	$(MKDIR_P) $(DATADIR)/emacs/site-lisp/
370
	$(INSTALL_DATA) share/emacs/why3.el $(DATADIR)/emacs/site-lisp/why3.el
371
ifeq (@enable_emacs_compilation@,yes)
372
	$(INSTALL_DATA) share/emacs/why3.elc $(DATADIR)/emacs/site-lisp/why3.elc
Kate's avatar
Kate committed
373 374
endif

375
ifeq (@enable_emacs_compilation@,yes)
376
all: share/emacs/why3.elc
377 378
endif

Kate's avatar
Kate committed
379

380
##################
381
# Why3 plugins
382 383
##################

Andrei Paskevich's avatar
Andrei Paskevich committed
384
PLUGGENERATED = plugins/tptp/tptp_lexer.ml \
385
		plugins/tptp/tptp_parser.ml plugins/tptp/tptp_parser.mli \
386 387
		plugins/python/py_lexer.ml \
		plugins/python/py_parser.ml plugins/python/py_parser.mli \
388
		plugins/parser/dimacs.ml \
389

390
PLUG_PARSER = genequlin dimacs
391
PLUG_PRINTER =
392
PLUG_TRANSFORM =
393
PLUG_TPTP = tptp_ast tptp_parser tptp_typing tptp_lexer tptp_printer
394
PLUG_PYTHON = py_ast py_parser py_lexer py_main
395

396
PLUGINS = genequlin dimacs tptp python
397

398
TPTPMODULES = $(addprefix plugins/tptp/, $(PLUG_TPTP))
399
PYTHONMODULES = $(addprefix plugins/python/, $(PLUG_PYTHON))
Andrei Paskevich's avatar
Andrei Paskevich committed
400

401 402
TPTPCMO = $(addsuffix .cmo, $(TPTPMODULES))
TPTPCMX = $(addsuffix .cmx, $(TPTPMODULES))
403

404 405 406
PYTHONCMO = $(addsuffix .cmo, $(PYTHONMODULES))
PYTHONCMX = $(addsuffix .cmx, $(PYTHONMODULES))

407 408 409 410 411 412 413 414 415 416
ifeq (@enable_hypothesis_selection@,yes)
PLUG_TRANSFORM += hypothesis_selection
PLUGINS += hypothesis_selection

lib/plugins/hypothesis_selection.cmxs: INCLUDES += -I @OCAMLGRAPHLIB@
lib/plugins/hypothesis_selection.cmo:  INCLUDES += -I @OCAMLGRAPHLIB@
lib/plugins/hypothesis_selection.cmxs: OFLAGS += graph.cmxa
lib/plugins/hypothesis_selection.cmo:  BFLAGS += graph.cmo
endif

417 418
PLUGMODULES = $(addprefix plugins/parser/, $(PLUG_PARSER)) \
	      $(addprefix plugins/printer/, $(PLUG_PRINTER)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
419
	      $(addprefix plugins/transform/, $(PLUG_TRANSFORM)) \
420
	      $(TPTPMODULES) $(PYTHONMODULES)
421

422
PLUGDEP = $(addsuffix .dep, $(PLUGMODULES))
423 424 425
PLUGCMO = $(addsuffix .cmo, $(PLUGMODULES))
PLUGCMX = $(addsuffix .cmx, $(PLUGMODULES))

426
PLUGDIRS = parser printer transform tptp python
427 428
PLUGINCLUDES = $(addprefix -I plugins/, $(PLUGDIRS))

429
$(PLUGDEP): DEPFLAGS += $(PLUGINCLUDES)
430 431
$(PLUGCMO) $(PLUGCMX): INCLUDES += $(PLUGINCLUDES)

432 433
$(PLUGDEP): $(PLUGGENERATED)

434 435 436 437 438
LIBPLUGCMO =  $(addsuffix .cmo,  $(addprefix lib/plugins/, $(PLUGINS)))
LIBPLUGCMXS = $(addsuffix .cmxs, $(addprefix lib/plugins/, $(PLUGINS)))

plugins.byte: $(LIBPLUGCMO)
plugins.opt : $(LIBPLUGCMXS)
439

440 441 442 443
lib/plugins:
	mkdir lib/plugins

lib/plugins/%.cmxs: | lib/plugins
444
	$(SHOW) 'Linking  $@'
445
	$(HIDE)$(OCAMLOPT) $(OFLAGS) -shared -o $@ $^
446

447
lib/plugins/%.cmo: | lib/plugins
448
	$(SHOW) 'Linking  $@'
449
	$(HIDE)$(OCAMLC) $(BFLAGS) -pack -o $@ $^
450

451 452
lib/plugins/%.cmxs: plugins/parser/%.cmx
lib/plugins/%.cmo: plugins/parser/%.cmo
453 454 455 456
lib/plugins/%.cmxs: plugins/printer/%.cmx
lib/plugins/%.cmo: plugins/printer/%.cmo
lib/plugins/%.cmxs: plugins/transform/%.cmx
lib/plugins/%.cmo: plugins/transform/%.cmo
457 458
lib/plugins/tptp.cmxs: $(TPTPCMX)
lib/plugins/tptp.cmo: $(TPTPCMO)
459 460
lib/plugins/python.cmxs: $(PYTHONCMX)
lib/plugins/python.cmo: $(PYTHONCMO)
461

462 463
# depend and clean targets

464
ifneq "$(MAKECMDGOALS:clean%=clean)" "clean"
465
-include $(PLUGDEP)
466 467
endif

468
depend: $(PLUGDEP)
469

470 471
CLEANDIRS += plugins $(addprefix plugins/, $(PLUGDIRS)) lib/plugins
GENERATED += $(PLUGGENERATED)
472 473

install_no_local::
474 475
	$(MKDIR_P) $(LIBDIR)/why3/plugins
	$(INSTALL_DATA) $(wildcard $(LIBPLUGCMO) $(LIBPLUGCMXS)) $(LIBDIR)/why3/plugins
476

477 478 479 480
###############
# Why3 commands
###############

481 482 483 484 485
TOOLSGENERATED = src/tools/why3wc.ml

TOOLS_BIN = why3config why3execute why3extract why3prove \
	    why3realize why3replay why3wc

486
TOOLS_FILES = main $(TOOLS_BIN)
487 488 489 490 491 492 493 494 495 496

TOOLSMODULES = $(addprefix src/tools/, $(TOOLS_FILES))

TOOLSDEP = $(addsuffix .dep, $(TOOLSMODULES))
TOOLSCMO = $(addsuffix .cmo, $(TOOLSMODULES))
TOOLSCMX = $(addsuffix .cmx, $(TOOLSMODULES))

$(TOOLSDEP): DEPFLAGS += -I src/tools
$(TOOLSCMO) $(TOOLSCMX): INCLUDES += -I src/tools

497 498
$(TOOLSDEP): $(TOOLSGENERATED)

499 500 501
byte: bin/why3.byte $(TOOLS_BIN:%=bin/%.byte)
opt:  bin/why3.opt  $(TOOLS_BIN:%=bin/%.opt)

502 503 504
bin:
	mkdir bin

505 506
bin/why3.opt: lib/why3/why3.cmxa src/tools/main.cmx
bin/why3.byte: lib/why3/why3.cma src/tools/main.cmo
507 508
bin/why3config.opt: lib/why3/why3.cmxa src/tools/why3config.cmx
bin/why3config.byte: lib/why3/why3.cma src/tools/why3config.cmo
509 510 511 512 513 514 515 516
bin/why3execute.opt: lib/why3/why3.cmxa src/tools/why3execute.cmx
bin/why3execute.byte: lib/why3/why3.cma src/tools/why3execute.cmo
bin/why3extract.opt: lib/why3/why3.cmxa src/tools/why3extract.cmx
bin/why3extract.byte: lib/why3/why3.cma src/tools/why3extract.cmo
bin/why3prove.opt: lib/why3/why3.cmxa src/tools/why3prove.cmx
bin/why3prove.byte: lib/why3/why3.cma src/tools/why3prove.cmo
bin/why3realize.opt: lib/why3/why3.cmxa src/tools/why3realize.cmx
bin/why3realize.byte: lib/why3/why3.cma src/tools/why3realize.cmo
517 518
bin/why3replay.opt: lib/why3/why3.cmxa src/tools/why3replay.cmx
bin/why3replay.byte: lib/why3/why3.cma src/tools/why3replay.cmo
519 520 521
bin/why3wc.opt: src/tools/why3wc.cmx
bin/why3wc.byte: src/tools/why3wc.cmo

Kate's avatar
Kate committed
522
clean_old_install::
523
	rm -f $(TOOLS_BIN:%=$(TOOLDIR)/%$(EXE)) $(BINDIR)/why3$(EXE)
524
	rm -f $(BINDIR)/why3bench$(EXE) $(BINDIR)/why3replayer$(EXE)
Kate's avatar
Kate committed
525

526
install_no_local::
527 528 529 530 531 532 533 534
	$(INSTALL) bin/why3.@OCAMLBEST@ $(BINDIR)/why3$(EXE)
	$(INSTALL) bin/why3config.@OCAMLBEST@  $(TOOLDIR)/why3config$(EXE)
	$(INSTALL) bin/why3execute.@OCAMLBEST@ $(TOOLDIR)/why3execute$(EXE)
	$(INSTALL) bin/why3extract.@OCAMLBEST@ $(TOOLDIR)/why3extract$(EXE)
	$(INSTALL) bin/why3prove.@OCAMLBEST@   $(TOOLDIR)/why3prove$(EXE)
	$(INSTALL) bin/why3realize.@OCAMLBEST@ $(TOOLDIR)/why3realize$(EXE)
	$(INSTALL) bin/why3replay.@OCAMLBEST@  $(TOOLDIR)/why3replay$(EXE)
	$(INSTALL) bin/why3wc.@OCAMLBEST@      $(TOOLDIR)/why3wc$(EXE)
535 536

install_local:: bin/why3 $(addprefix bin/,$(TOOLS_BIN))
537

538
bin/%:	bin/%.@OCAMLBEST@
539
	ln -sf $(notdir $<) $@
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
540

541 542 543 544 545 546 547 548 549 550 551
install_local:: share/drivers share/modules share/theories

share/drivers:
	ln -snf ../drivers share/drivers

share/modules:
	ln -snf ../modules share/modules

share/theories:
	ln -snf ../theories share/theories

552
ifneq "$(MAKECMDGOALS:clean%=clean)" "clean"
553
-include $(TOOLSDEP)
554 555
endif

556
depend: $(TOOLSDEP)
557

558 559 560
CLEANDIRS += src/tools
GENERATED += $(TOOLSGENERATED)

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
561
clean::
562
	rm -f bin/why3*
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
563

564 565 566
##############
# test targets
##############
567

568 569
%.gui: %.why bin/why3ide.opt
	bin/why3ide.opt $*.why
570

571 572
%: %.mlw bin/why3.opt
	bin/why3.opt $*.mlw
573

574 575
%: %.why bin/why3.opt
	bin/why3.opt $*.why
François Bobot's avatar
François Bobot committed
576

577 578
%.gui: %.mlw bin/why3ide.opt
	bin/why3ide.opt $*.mlw
579

580
%.type: %.mlw bin/why3ide.opt
581
	bin/why3.opt --type-only $*.mlw
582

583 584 585 586
##############
# Why3server #
##############

587 588 589 590 591 592 593 594
SERVER_MODULES := logging arraylist options queue readbuf request \
		  writebuf server-unix server-win

CPULIM_MODULES := cpulimit-unix cpulimit-win

SERVER_O := $(addprefix src/server/, $(addsuffix .o, $(SERVER_MODULES)))

CPULIM_O := $(addprefix src/server/, $(addsuffix .o, $(CPULIM_MODULES)))
595

596 597
TOOLS = lib/why3server$(EXE) lib/why3cpulimit$(EXE)

598
all: $(TOOLS)
599

600
lib/why3server$(EXE): $(SERVER_O)
601 602 603 604
	$(CC) -Wall -o $@ $^

lib/why3cpulimit$(EXE): $(CPULIM_O)
	$(CC) -Wall -o $@ $^
605

606
%.o: %.c
607
	$(CC) -Wall -O -g -o $@ -c $<
608 609

install_no_local::
610 611 612 613
	$(MKDIR_P) $(LIBDIR)/why3
	$(INSTALL) lib/why3server$(EXE) $(LIBDIR)/why3/why3server$(EXE)
	$(INSTALL) lib/why3cpulimit$(EXE) $(LIBDIR)/why3/why3cpulimit$(EXE)
	$(INSTALL) lib/why3-call-pvs $(LIBDIR)/why3/why3-call-pvs
614 615

clean::
616
	rm -f $(SERVER_O) $(CPULIM_O) $(TOOLS)
617

618 619 620 621
##########
# gallery
##########

622
# we export exactly the programs that have a why3session.xml file
623 624 625

.PHONY: gallery

626 627 628 629 630
gallery:: gallery-simple gallery-subs

.PHONY: gallery-simple

gallery-simple::
631
	@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
Andrei Paskevich's avatar
Andrei Paskevich committed
632
	@for x in examples/*/why3session.xml ; do \
633 634
	  d=`dirname $$x`; \
	  f=`basename $$d`; \
635 636
	  echo "exporting $$f"; \
	  mkdir -p $(GALLERYDIR)/$$f; \
637 638
	  WHY3CONFIG="" bin/why3session.@OCAMLBEST@ html $$x -o $(GALLERYDIR)/$$f; \
	  cp examples/$$f.mlw $(GALLERYDIR)/$$f/; \
Andrei Paskevich's avatar
Andrei Paskevich committed
639
	  cd examples/; \
640 641
	  rm -f $(GALLERYDIR)/$$f/$$f.zip; \
	  zip -q -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f; \
642
	  cd ..; \
643
	done
644

645 646
.PHONY: gallery-subs

647
GALLERYSUBS=WP_revisited verifythis_2016_matrix_multiplication avl double_wp
648 649

gallery-subs::
650
	@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
651 652
	@for d in $(GALLERYSUBS) ; do \
	  echo "exporting examples/$$d"; \
653
	  mkdir -p $(GALLERYDIR)/$$d; \
654
	  cd examples/$$d; \
655
	  WHY3CONFIG="" ../../bin/why3doc.@OCAMLBEST@ -L ../../theories -L ../../modules -L . --stdlib-url http://why3.lri.fr/stdlib/ *.mlw -o $(GALLERYDIR)/$$d; \
656
	  cd ..; \
657 658
	  rm -f $(GALLERYDIR)/$$d/$$d.zip; \
	  zip -q -r $(GALLERYDIR)/$$d/$$d.zip $$d; \
659 660 661 662
	  cd ..; \
	done


663 664 665 666 667 668
%-gallery::
	@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
	x=$*/why3session.xml; \
	d=`dirname $$x`; \
	f=`basename $$d`; \
	echo "exporting $$f"; \
669
	rm -f $$d/*.bak; \
670
	mkdir -p $(GALLERYDIR)/$$f; \
671
	WHY3CONFIG="" bin/why3session.@OCAMLBEST@ html $$d -o $(GALLERYDIR)/$$f; \
672 673
	if test -f examples/$$f.mlw; then cp examples/$$f.mlw $(GALLERYDIR)/$$f/; fi; \
	if test -f examples/$$f.why; then cp examples/$$f.why $(GALLERYDIR)/$$f/; fi; \
674
	cd examples/; \
675 676
	rm -f $(GALLERYDIR)/$$f/$$f.zip; \
	zip -q -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f
677

MARCHE Claude's avatar
MARCHE Claude committed
678 679 680 681 682 683 684 685
########
# XML DTD validation
########

.PHONY: xml-validate

xml-validate:
	@for x in `find examples/ -name why3session.xml`; do \
686
	  xmllint --noout --valid $$x 2>&1 | head -1; \
MARCHE Claude's avatar
MARCHE Claude committed
687 688
	done

689 690 691 692 693
xml-validate-local:
	@for x in `find examples/ -name why3session.xml`; do \
	  xmllint --noout --dtdvalid share/why3session.dtd $$x 2>&1 | head -1; \
	done

MARCHE Claude's avatar
MARCHE Claude committed
694 695 696 697
###############
# IDE
###############

698 699
ifeq (@enable_ide@,yes)

François Bobot's avatar
François Bobot committed
700
IDE_FILES = gconfig gmain
MARCHE Claude's avatar
MARCHE Claude committed
701 702 703

IDEMODULES = $(addprefix src/ide/, $(IDE_FILES))

704
IDEDEP = $(addsuffix .dep, $(IDEMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
705 706 707
IDECMO = $(addsuffix .cmo, $(IDEMODULES))
IDECMX = $(addsuffix .cmx, $(IDEMODULES))

708
$(IDEDEP): DEPFLAGS += -I src/ide
709
$(IDECMO) $(IDECMX): INCLUDES += -I src/ide
MARCHE Claude's avatar
MARCHE Claude committed
710

711
# build targets
MARCHE Claude's avatar
MARCHE Claude committed
712

713 714
byte: bin/why3ide.byte
opt:  bin/why3ide.opt
MARCHE Claude's avatar
MARCHE Claude committed
715

716
bin/why3ide.opt bin/why3ide.byte: INCLUDES += -I @LABLGTK2LIB@
717
bin/why3ide.opt bin/why3ide.byte: EXTLIBS += lablgtk lablgtksourceview2
718
bin/why3ide.byte: BLINKFLAGS += -custom
MARCHE Claude's avatar
MARCHE Claude committed
719

720 721
bin/why3ide.opt: lib/why3/why3.cmxa src/ide/resetgc.o $(IDECMX)
bin/why3ide.byte: lib/why3/why3.cma src/ide/resetgc.o $(IDECMO)
MARCHE Claude's avatar
MARCHE Claude committed
722

723
src/ide/resetgc.o: src/ide/resetgc.c
724 725
	$(SHOW) 'Ocamlc   $<'
	$(HIDE)$(OCAMLC) -c -ccopt "-Wall -o $@" $<
726

MARCHE Claude's avatar
MARCHE Claude committed
727 728
# depend and clean targets

729
ifneq "$(MAKECMDGOALS:clean%=clean)" "clean"
730
-include $(IDEDEP)
731
endif
MARCHE Claude's avatar
MARCHE Claude committed
732

733
depend: $(IDEDEP)
MARCHE Claude's avatar
MARCHE Claude committed
734

735
CLEANDIRS += src/ide
MARCHE Claude's avatar
MARCHE Claude committed
736

Kate's avatar
Kate committed
737 738 739
clean_old_install::
	rm -f $(BINDIR)/why3ide$(EXE)

740
install_no_local::
741
	$(INSTALL) bin/why3ide.@OCAMLBEST@ $(TOOLDIR)/why3ide$(EXE)
742

743
install_local:: bin/why3ide
744

745
endif
MARCHE Claude's avatar
d  
MARCHE Claude committed
746

747 748 749 750
###############
# Session
###############

751 752 753
SESSION_FILES = why3session_lib why3session_copy why3session_info \
		why3session_latex why3session_html why3session_rm \
		why3session_output why3session_run why3session_csv \
754
		why3session_main
755 756 757

SESSIONMODULES = $(addprefix src/why3session/, $(SESSION_FILES))

758
SESSIONDEP = $(addsuffix .dep, $(SESSIONMODULES))
759 760 761
SESSIONCMO = $(addsuffix .cmo, $(SESSIONMODULES))
SESSIONCMX = $(addsuffix .cmx, $(SESSIONMODULES))

762
$(SESSIONDEP): DEPFLAGS += -I src/why3session
763 764 765 766 767 768 769
$(SESSIONCMO) $(SESSIONCMX): INCLUDES += -I src/why3session

# build targets

byte: bin/why3session.byte
opt:  bin/why3session.opt

770 771
bin/why3session.opt: lib/why3/why3.cmxa $(SESSIONCMX)
bin/why3session.byte: lib/why3/why3.cma $(SESSIONCMO)
772 773 774

# depend and clean targets

775
ifneq "$(MAKECMDGOALS:clean%=clean)" "clean"
776
-include $(SESSIONDEP)
777
endif
778

779
depend: $(SESSIONDEP)
780

781
CLEANDIRS += src/why3session
782

Kate's avatar
Kate committed
783 784 785
clean_old_install::
	rm -f $(BINDIR)/why3session$(EXE)

786
install_no_local::
787
	$(INSTALL) bin/why3session.@OCAMLBEST@ $(TOOLDIR)/why3session$(EXE)
788

789
install_local:: bin/why3session
790

MARCHE Claude's avatar
MARCHE Claude committed
791

792 793 794
##############
# Coq plugin
##############
795

796
ifeq (@enable_coq_tactic@,yes)
797

798
COQPGENERATED = src/coq-tactic/why3tac.ml
799

800
COQP_FILES = why3tac
801

802
COQPMODULES = $(addprefix src/coq-tactic/, $(COQP_FILES))
803

804 805 806
COQPDEP = $(addsuffix .dep, $(COQPMODULES))
COQPCMO = $(addsuffix .cmo, $(COQPMODULES))
COQPCMX = $(addsuffix .cmx, $(COQPMODULES))
807

Guillaume Melquiond's avatar
Guillaume Melquiond committed
808
COQPTREES = engine interp intf kernel lib library ltac parsing pretyping printing proofs tactics toplevel vernac plugins/ltac
809
COQPINCLUDES = -I src/coq-tactic -I $(COQCAMLPLIB) $(addprefix -I @COQLIB@/, $(COQPTREES)) @ZIPINCLUDE@
810

811
$(COQPDEP): DEPFLAGS += -I src/coq-tactic
812
$(COQPCMO) $(COQPCMX): INCLUDES += $(COQPINCLUDES)
813 814
$(COQPCMO) $(COQPCMX): BFLAGS += -rectypes
$(COQPCMX): OFLAGS += -rectypes
815

816
$(COQPDEP): $(COQPGENERATED)
817

818 819
byte: lib/coq-tactic/why3tac.cma
opt:  lib/coq-tactic/why3tac.cmxs
820

821 822 823 824
lib/coq-tactic/why3tac.cmxs: OFLAGS += $(addsuffix .cmxa, @ZIPLIB@)
lib/coq-tactic/why3tac.cmxs: OFLAGS += $(addsuffix .cmx,  @MENHIRLIB@)

lib/coq-tactic/why3tac.cma:  BFLAGS += $(addsuffix .cma,  @ZIPLIB@)
825
lib/coq-tactic/why3tac.cma:  BFLAGS += $(addsuffix .cmo,  @MENHIRLIB@)
826

827 828
lib/coq-tactic/why3tac.cmxs: lib/why3/why3.cmxa $(COQPCMX)
lib/coq-tactic/why3tac.cma: lib/why3/why3.cma $(COQPCMO)
829

830
src/coq-tactic/why3tac.ml: src/coq-tactic/why3tac.ml4
831 832
	$(SHOW) 'Camlp    $<'
	$(HIDE)$(COQCAMLP) pr_dump.cmo @COQPPLIBS@ pa_macro.cmo -D@coq_compat_version@ -impl $^ -o $@
833

834
COQRTAC = -R lib/coq-tactic Why3 -R lib/coq Why3 -I lib/coq-tactic
835

836 837 838 839 840
ifeq "$(OCAMLBEST)" "opt"
COQTACEXT = cmxs
else
COQTACEXT = cma
COQRTAC += -byte
Guillaume Melquiond's avatar
Guillaume Melquiond committed
841
endif
842

843
lib/coq-tactic/Why3.vo: lib/coq-tactic/Why3.v lib/coq/BuiltIn.vo lib/coq-tactic/why3tac.$(COQTACEXT)
844
	$(SHOW) 'Coqc     $<'
845
	$(HIDE)WHY3CONFIG="" $(COQC) $(COQRTAC) $<
846

847
all: lib/coq-tactic/Why3.vo
848

849
# depend and clean targets
Andrei Paskevich's avatar
Andrei Paskevich committed
850

851
ifneq "$(MAKECMDGOALS:clean%=clean)" "clean"
852
-include $(COQPDEP)
853
endif
854

855
depend: $(COQPDEP)
856

857 858 859 860
CLEANDIRS += src/coq-tactic
CLEANLIBS += lib/coq-tactic/why3tac
GENERATED += $(COQPGENERATED)

861
clean::
862
	rm -f lib/coq-tactic/*.vo lib/coq-tactic/*.glob
863

864
install_no_local::
865 866
	$(MKDIR_P) $(LIBDIR)/why3/coq-tactic
	$(INSTALL_DATA) lib/coq-tactic/* $(LIBDIR)/why3/coq-tactic
867

868 869 870 871 872 873
endif

####################
# Coq realizations
####################

874 875
ifeq (@enable_coq_support@,yes)

876 877
ifeq (@enable_coq_libs@,yes)

878

879
COQVERSIONSPECIFIC=
880 881 882 883 884 885 886 887 888 889 890 891 892

COQVERSIONSPECIFICTARGETS=$(addprefix lib/coq/, $(COQVERSIONSPECIFIC))
COQVERSIONSPECIFICSOURCES=$(addsuffix .@coq_compat_version@, $(COQVERSIONSPECIFICTARGETS))

$(COQVERSIONSPECIFICTARGETS): $(COQVERSIONSPECIFICSOURCES)
	for i in $(COQVERSIONSPECIFIC); do \
		cp lib/coq/$$i.@coq_compat_version@ lib/coq/$$i ; \
	done

clean::
	rm -f $(COQVERSIONSPECIFICTARGETS)


893
COQLIBS_INT_FILES = Abs ComputerDivision Div2 EuclideanDivision Int MinMax Power NumOf
894 895
COQLIBS_INT_ALL_FILES = Exponentiation $(COQLIBS_INT_FILES)
COQLIBS_INT = $(addprefix lib/coq/int/, $(COQLIBS_INT_ALL_FILES))
896

897 898 899
COQLIBS_BOOL_FILES = Bool
COQLIBS_BOOL = $(addprefix lib/coq/bool/, $(COQLIBS_BOOL_FILES))

900
ifeq (@enable_coq_fp_libs@,yes)
901
COQLIBS_REAL_FILES = Abs ExpLog FromInt MinMax PowerInt PowerReal Real RealInfix Square Trigonometry Truncate
902 903 904
else
COQLIBS_REAL_FILES = Abs ExpLog FromInt MinMax PowerInt PowerReal Real RealInfix Square Trigonometry
endif
905 906
COQLIBS_REAL = $(addprefix lib/coq/real/, $(COQLIBS_REAL_FILES))

907
COQLIBS_NUMBER_FILES = Divisibility Gcd Parity Prime Coprime
908 909
COQLIBS_NUMBER = $(addprefix lib/coq/number/, $(COQLIBS_NUMBER_FILES))

910 911 912
COQLIBS_SET_FILES = Set
COQLIBS_SET = $(addprefix lib/coq/set/, $(COQLIBS_SET_FILES))

MARCHE Claude's avatar
MARCHE Claude committed
913
COQLIBS_MAP_FILES = Map Const Occ MapPermut MapInjection
914 915
COQLIBS_MAP = $(addprefix lib/coq/map/, $(COQLIBS_MAP_FILES))

916
COQLIBS_LIST_FILES = List Length Mem Nth NthLength HdTl NthHdTl Append NthLengthAppend Reverse HdTlNoOpt NthNoOpt RevAppend Combine Distinct NumOcc Permut
917 918 919 920 921
COQLIBS_LIST = $(addprefix lib/coq/list/, $(COQLIBS_LIST_FILES))

COQLIBS_OPTION_FILES = Option
COQLIBS_OPTION = $(addprefix lib/coq/option/, $(COQLIBS_OPTION_FILES))

922 923 924
COQLIBS_SEQ_FILES = Seq
COQLIBS_SEQ = $(addprefix lib/coq/seq/, $(COQLIBS_SEQ_FILES))

925 926 927
ifeq (@coq_compat_version@,COQ84)
COQLIBS_BV_FILES = Pow2int
else
928
COQLIBS_BV_FILES = Pow2int BV_Gen
929
endif
930 931
COQLIBS_BV = $(addprefix lib/coq/bv/, $(COQLIBS_BV_FILES))

932
ifeq (@enable_coq_fp_libs@,yes)
933
COQLIBS_FP_FILES = Rounding SingleFormat Single DoubleFormat Double
934 935
COQLIBS_FP_ALL_FILES = GenFloat $(COQLIBS_FP_FILES)
COQLIBS_FP = $(addprefix lib/coq/floating_point/, $(COQLIBS_FP_ALL_FILES))
936

937
COQLIBS_IEEEFLOAT_FILES = RoundingMode GenericFloat Float32 Float64
938
COQLIBS_IEEEFLOAT = $(addprefix lib/coq/ieee_float/, $(COQLIBS_IEEEFLOAT_FILES))
939
endif
940

941
COQLIBS_FILES = lib/coq/BuiltIn lib/coq/HighOrd $(COQLIBS_INT) $(COQLIBS_BOOL) $(COQLIBS_REAL) $(COQLIBS_NUMBER) $(COQLIBS_SET) $(COQLIBS_MAP) $(COQLIBS_LIST) $(COQLIBS_OPTION) $(COQLIBS_SEQ) $(COQLIBS_FP)  $(COQLIBS_BV) $(COQLIBS_IEEEFLOAT)
942

943
drivers/coq-realizations.aux: Makefile
944 945
	$(SHOW) 'Generate $@'
	$(HIDE)(echo "(* generated automatically at compilation time *)"; \
Andrei Paskevich's avatar
Andrei Paskevich committed
946
	echo 'theory BuiltIn meta "realized_theory" "BuiltIn", "" end'; \
947
	echo 'theory HighOrd meta "realized_theory" "HighOrd", "" end'; \
Andrei Paskevich's avatar
Andrei Paskevich committed
948
	for f in $(COQLIBS_INT_FILES); do \
Andrei Paskevich's avatar
Andrei Paskevich committed
949
	echo 'theory int.'"$$f"' meta "realized_theory" "int.'"$$f"'", "" end'; done; \
950 951
	for f in $(COQLIBS_BOOL_FILES); do \
	echo 'theory bool.'"$$f"' meta "realized_theory" "bool.'"$$f"'", "" end'; done; \
Andrei Paskevich's avatar
Andrei Paskevich committed
952
	for f in $(COQLIBS_REAL_FILES); do \
Andrei Paskevich's avatar
Andrei Paskevich committed
953
	echo 'theory real.'"$$f"' meta "realized_theory" "real.'"$$f"'", "" end'; done; \
954
	for f in $(COQLIBS_NUMBER_FILES); do \
Andrei Paskevich's avatar
Andrei Paskevich committed
955
	echo 'theory number.'"$$f"' meta "realized_theory" "number.'"$$f"'", "" end'; done; \
956
	for f in $(COQLIBS_SET_FILES); do \
Andrei Paskevich's avatar
Andrei Paskevich committed
957
	echo 'theory set.'"$$f"' meta "realized_theory" "set.'"$$f"'", "" end'; done; \
958 959
	for f in $(COQLIBS_MAP_FILES); do \
	echo 'theory map.'"$$f"' meta "realized_theory" "map.'"$$f"'", "" end'; done; \
960 961 962 963
	for f in $(COQLIBS_LIST_FILES); do \
	echo 'theory list.'"$$f"' meta "realized_theory" "list.'"$$f"'", "" end'; done; \
	for f in $(COQLIBS_OPTION_FILES); do \
	echo 'theory option.'"$$f"' meta "realized_theory" "option.'"$$f"'", "" end'; done; \
964 965
	for f in $(COQLIBS_SEQ_FILES); do \
	echo 'theory seq.'"$$f"' meta "realized_theory" "seq.'"$$f"'", "" end'; done; \
966 967
	for f in $(COQLIBS_BV_FILES); do \
	echo 'theory bv.'"$$f"' meta "realized_theory" "bv.'"$$f"'", "" end'; done; \
968 969
	for f in $(COQLIBS_IEEEFLOAT_FILES); do \
	echo 'theory ieee_float.'"$$f"' meta "realized_theory" "ieee_float.'"$$f"'", "" end'; done; \
Andrei Paskevich's avatar
Andrei Paskevich committed
970
	for f in $(COQLIBS_FP_FILES); do \
Andrei Paskevich's avatar
Andrei Paskevich committed
971
	echo 'theory floating_point.'"$$f"' meta "realized_theory" "floating_point.'"$$f"'", "" end'; done; \
972
	) > $@
973

974
install_no_local::
975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996
	$(MKDIR_P) $(LIBDIR)/why3/coq
	$(INSTALL_DATA) lib/coq/BuiltIn.vo lib/coq/HighOrd.vo $(LIBDIR)/why3/coq/
	$(MKDIR_P) $(LIBDIR)/why3/coq/int
	$(INSTALL_DATA) $(addsuffix .vo, $(COQLIBS_INT)) $(LIBDIR)/why3/coq/int/
	$(MKDIR_P) $(LIBDIR)/why3/coq/bool
	$(INSTALL_DATA) $(addsuffix .vo, $(COQLIBS_BOOL)) $(LIBDIR)/why3/coq/bool/
	$(MKDIR_P) $(LIBDIR)/why3/coq/real
	$(INSTALL_DATA) $(addsuffix .vo, $(COQLIBS_REAL)) $(LIBDIR)/why3/coq/real/
	$(MKDIR_P) $(LIBDIR)/why3/coq/number
	$(INSTALL_DATA) $(addsuffix .vo, $(COQLIBS_NUMBER)) $(LIBDIR)/why3/coq/number/
	$(MKDIR_P) $(LIBDIR)/why3/coq/set
	$(INSTALL_DATA) $(addsuffix .vo, $(COQLIBS_SET)) $(LIBDIR)/why3/coq/set/
	$(MKDIR_P) $(LIBDIR)/why3/coq/map
	$(INSTALL_DATA) $(addsuffix .vo, $(COQLIBS_MAP)) $(LIBDIR)/why3/coq/map/
	$(MKDIR_P) $(LIBDIR)/why3/coq/list
	$(INSTALL_DATA) $(addsuffix .vo, $(COQLIBS_LIST)) $(LIBDIR)/why3/coq/list/
	$(MKDIR_P) $(LIBDIR)/why3/coq/option
	$(INSTALL_DATA) $(addsuffix .vo, $(COQLIBS_OPTION)) $(LIBDIR)/why3/coq/option/
	$(MKDIR_P) $(LIBDIR)/why3/coq/seq
	$(INSTALL_DATA) $(addsuffix .vo, $(COQLIBS_SEQ)) $(LIBDIR)/why3/coq/seq/
	$(MKDIR_P) $(LIBDIR)/why3/coq/bv
	$(INSTALL_DATA) $(addsuffix .vo, $(COQLIBS_BV)) $(LIBDIR)/why3/coq/bv/
997
ifeq (@enable_coq_fp_libs@,yes)
998 999
	$(MKDIR_P) $(LIBDIR)/why3/coq/floating_point
	$(INSTALL_DATA) $(addsuffix .vo, $(COQLIBS_FP)) $(LIBDIR)/why3/coq/floating_point/
1000 1001
	$(MKDIR_P) $(LIBDIR)/why3/coq/ieee_float
	$(INSTALL_DATA) $(addsuffix .vo, $(COQLIBS_IEEEFLOAT)) $(LIBDIR)/why3/coq/ieee_float/
1002
endif
1003

1004
update-coq: update-coq-int update-coq-bool update-coq-real update-coq-number update-coq-set update-coq-map update-coq-list update-coq-option update-coq-fp update-coq-seq update-coq-bv update-coq-ieee_float
1005

1006
update-coq-int: bin/why3realize.@OCAMLBEST@ drivers/coq-realizations.aux theories/int.why
1007
	for f in $(COQLIBS_INT_ALL_FILES); do WHY3CONFIG="" bin/why3realize.@OCAMLBEST@ -L theories -D drivers/coq-realize.drv -T int.$$f -o lib/coq/int/; done
1008

1009
update-coq-bool: bin/why3realize.@OCAMLBEST@ drivers/coq-realizations.aux theories/bool.why
1010
	for f in $(COQLIBS_BOOL_FILES); do WHY3CONFIG="" bin/why3realize.@OCAMLBEST@ -L theories -D drivers/coq-realize.drv -T bool.$$f -o lib/coq/bool/; done
1011

1012
update-coq-real: bin/why3realize.@OCAMLBEST@ drivers/coq-realizations.aux theories/real.why
1013
	for f in $(COQLIBS_REAL_FILES); do WHY3CONFIG="" bin/why3realize.@OCAMLBEST@ -L theories -D drivers/coq-realize.drv -T real.$$f -o lib/coq/real/; done
1014

1015
update-coq-number: bin/why3realize.@OCAMLBEST@ drivers/coq-realizations.aux theories/number.why
1016
	for f in $(COQLIBS_NUMBER_FILES); do WHY3CONFIG="" bin/why3realize.@OCAMLBEST@ -L theories -D drivers/coq-realize.drv -T number.$$f -o lib/coq/number/; done
1017

1018
update-coq-set: bin/why3realize.@OCAMLBEST@ drivers/coq-realizations.aux theories/set.why
1019
	for f in $(COQLIBS_SET_FILES); do WHY3CONFIG="" bin/why3realize.@OCAMLBEST@ -L theories -D drivers/coq-realize.drv -T set.$$f -o lib/coq/set/; done
1020

1021
update-coq-map: bin/why3realize.@OCAMLBEST@ drivers/coq-realizations.aux theories/map.why
1022
	for f in $(COQLIBS_MAP_FILES); do WHY3CONFIG="" bin/why3realize.@OCAMLBEST@ -L theories -D drivers/coq-realize.drv -T map.$$f -o lib/coq/map/; done
1023

1024
update-coq-list: bin/why3realize.@OCAMLBEST@ drivers/coq-realizations.aux theories/list.why
1025
	for f in $(COQLIBS_LIST_FILES); do WHY3CONFIG="" bin/why3realize.@OCAMLBEST@ -L theories -D drivers/coq-realize.drv -T list.$$f -o lib/coq/list/; done
1026

1027
update-coq-option: bin/why3realize.@OCAMLBEST@ drivers/coq-realizations.aux theories/option.why
1028
	for f in $(COQLIBS_OPTION_FILES); do WHY3CONFIG="" bin/why3realize.@OCAMLBEST@ -L theories -D drivers/coq-realize.drv -T option.$$f -o lib/coq/option/; done
1029

1030 1031 1032
update-coq-seq: bin/why3realize.@OCAMLBEST@ drivers/coq-realizations.aux theories/seq.why
	for f in $(COQLIBS_SEQ_FILES); do WHY3CONFIG="" bin/why3realize.@OCAMLBEST@ -L theories -D drivers/coq-realize.drv -T seq.$$f -o lib/coq/seq/; done

1033 1034 1035
update-coq-bv: bin/why3realize.@OCAMLBEST@ drivers/coq-realizations.aux theories/bv.why
	for f in $(COQLIBS_BV_FILES); do WHY3CONFIG="" bin/why3realize.@OCAMLBEST@ -L theories -D drivers/coq-realize.drv -T bv.$$f -o lib/coq/bv/; done

1036 1037 1038
update-coq-ieee_float: bin/why3realize.@OCAMLBEST@ drivers/coq-realizations.aux theories/ieee_float.why
	for f in $(COQLIBS_IEEEFLOAT_FILES); do WHY3CONFIG="" bin/why3realize.@OCAMLBEST@ -L theories -D drivers/coq-realize.drv -T ieee_float.$$f -o lib/coq/ieee_float/; done

1039
update-coq-fp: bin/why3realize.@OCAMLBEST@ drivers/coq-realizations.aux theories/floating_point.why
1040
	for f in $(COQLIBS_FP_FILES); do WHY3CONFIG="" bin/why3realize.@OCAMLBEST@ -L theories -D drivers/coq-realize.drv -T floating_point.$$f -o lib/coq/floating_point/; done
1041

1042 1043
else

1044 1045 1046
drivers/coq-realizations.aux: Makefile
	$(SHOW) 'Generate $@'
	$(HIDE)echo "(* generated automatically at compilation time *)" > $@
1047

1048
COQLIBS_FILES = lib/coq/BuiltIn lib/coq/HighOrd
1049 1050 1051 1052 1053 1054 1055 1056

endif

COQV  = $(addsuffix .v,  $(COQLIBS_FILES))
COQVO = $(addsuffix .vo, $(COQLIBS_FILES))
COQVD = $(addsuffix .vd, $(COQLIBS_FILES))

%.vo: %.v
1057 1058
	$(SHOW) 'Coqc     $<'
	$(HIDE)$(COQC) -R lib/coq Why3 $<
1059 1060

%.vd: %.v
1061 1062
	$(SHOW) 'Coqdep   $<'
	$(HIDE)$(COQDEP) -R lib/coq Why3 $< $(TOTARGET)
1063

1064
all: $(COQVO)
1065 1066 1067

ifneq "$(MAKECMDGOALS:clean%=clean)" "clean"
ifneq "$(MAKECMDGOALS:update-coq%=update-coq)" "update-coq"
1068
-include $(COQVD)
1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080
endif
endif

depend: $(COQVD)

clean-coq:
	rm -f $(COQVO) $(COQVD) $(addsuffix .glob, $(COQLIBS_FILES))

clean:: clean-coq

else

1081 1082 1083
drivers/coq-realizations.aux: Makefile
	$(SHOW) 'Generate $@'
	$(HIDE)echo "(* generated automatically at compilation time *)" > $@
1084

1085
endif
1086

1087 1088
all: drivers/coq-realizations.aux

1089
install_no_local::
1090
	$(INSTALL_DATA) drivers/coq-realizations.aux $(DATADIR)/why3/drivers/
1091