Makefile.in 61.2 KB
Newer Older
1 2 3
####################################################################
#                                                                  #
#  The Why3 Verification Platform   /   The Why3 Development Team  #
4
#  Copyright 2010-2014   --   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

Andrei Paskevich's avatar
Andrei Paskevich committed
12
include Version
13

14 15 16 17 18 19
VERBOSEMAKE ?= @enable_verbose_make@

ifeq ($(VERBOSEMAKE),yes)
  QUIET =
else
  QUIET = yes
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

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

# other variables
38
CC        = @CC@
39 40 41 42 43 44 45
OCAMLC    = @OCAMLC@
OCAMLOPT  = @OCAMLOPT@
OCAMLDEP  = @OCAMLDEP@
OCAMLLEX  = @OCAMLLEX@
OCAMLYACC = @OCAMLYACC@
OCAMLDOC  = @OCAMLDOC@
OCAMLLIB  = @OCAMLLIB@
46
OCAMLINSTALLLIB  = $(DESTDIR)@OCAMLINSTALLLIB@
47 48
OCAMLBEST = @OCAMLBEST@
OCAMLVERSION = @OCAMLVERSION@
49 50
COQC      = @COQC@
COQDEP    = @COQDEP@
51
CAMLP5O   = @CAMLP5O@
MARCHE Claude's avatar
MARCHE Claude committed
52
FRAMAC_LIBDIR = $(DESTDIR)@FRAMAC_LIBDIR@
53

54
DEPFLAGS  = -slash -I lib/why3
55
ifeq (@OCAMLBEST@,opt)
56
DEPFLAGS += -native
57 58
endif

59
RUBBER = @RUBBER@
60
HEVEA = @HEVEA@
61
HACHA = @HACHA@
62

63
#PSVIEWER  = @PSVIEWER@
Andrei Paskevich's avatar
Andrei Paskevich committed
64
#PDFVIEWER = @PDFVIEWER@
65

66
INCLUDES =
67 68
OFLAGS = -w Aer-41-44-45 -dtypes -g -I lib/why3 $(INCLUDES)
BFLAGS = -w Aer-41-44-45 -dtypes -g -I lib/why3 $(INCLUDES)
69 70 71

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

73
ifeq (@enable_profiling@,yes)
74 75 76
OFLAGS += -g -p
endif

77 78
# external libraries common to all binaries

79
EXTOBJS =
80
EXTLIBS = str unix nums dynlink
81 82 83

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

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
85 86 87
###############
# main target
###############
88

89 90 91 92
all: @OCAMLBEST@
plugins: plugins.@OCAMLBEST@
opt: plugins.opt
byte: plugins.byte
Francois Bobot's avatar
Francois Bobot committed
93

94 95 96 97 98
ifeq (@enable_local@,yes)
all: install_local
endif

.PHONY: byte opt clean depend all install install_local install_no_local
99
.PHONY: plugins plugins.byte plugins.opt
100

101 102 103
##############
# Why3 library
##############
104

105
LIBGENERATED = src/util/config.ml \
106
	       src/util/rc.ml src/parser/lexer.ml \
107 108
	       src/parser/parser.mli src/parser/parser.ml \
	       src/driver/driver_parser.mli src/driver/driver_parser.ml \
109 110
	       src/driver/driver_lexer.ml src/session/xml.ml \
	       lib/ocaml/why3__BigInt.ml
111

112
LIB_UTIL = config bigInt util opt lists strings extmap extset exthtbl weakhtbl \
113
	   hashcons stdlib exn_printer pp debug loc print_tree \
114
	   cmdline warning sysutil rc plugin bigInt number pqueue
115

116 117
LIB_CORE = ident ty term pattern decl theory \
	   task pretty dterm env trans printer
118

119
LIB_PARSER = ptree glob parser typing lexer
120

121
LIB_DRIVER = call_provers driver_ast driver_parser driver_lexer driver \
122
	     whyconf autodetection
123

124
LIB_TRANSFORM = simplify_formula inlining split_goal induction \
125
		eliminate_definition eliminate_algebraic \
126
		eliminate_inductive eliminate_let eliminate_if \
127 128 129 130
		libencoding discriminate encoding encoding_select \
		encoding_guards_full encoding_tags_full \
		encoding_guards encoding_tags encoding_twin \
		encoding_sort simplify_array filter_trigger \
131
		introduction abstraction close_epsilon lift_epsilon \
132
		eliminate_epsilon \
133
		eval_match instantiate_predicate smoke_detector
134

135
LIB_PRINTER = alt_ergo why3printer smtv1 smtv2 coq pvs isabelle \
136
	      simplify gappa cvc3 yices mathematica
137

François Bobot's avatar
François Bobot committed
138 139
LIB_SESSION = xml termcode session session_tools session_scheduler

140
LIB_WHYML = mlw_ty mlw_expr mlw_decl mlw_pretty mlw_wp mlw_module \
141
	    mlw_dexpr mlw_typing mlw_driver mlw_ocaml \
142
	    mlw_main mlw_interp
143 144

LIBMODULES =  $(addprefix src/util/, $(LIB_UTIL)) \
145 146 147 148
	      $(addprefix src/core/, $(LIB_CORE)) \
	      $(addprefix src/parser/, $(LIB_PARSER)) \
	      $(addprefix src/driver/, $(LIB_DRIVER)) \
	      $(addprefix src/transform/, $(LIB_TRANSFORM)) \
François Bobot's avatar
François Bobot committed
149
	      $(addprefix src/printer/, $(LIB_PRINTER)) \
150 151
	      $(addprefix src/session/, $(LIB_SESSION)) \
	      $(addprefix src/whyml/, $(LIB_WHYML))
152

153
LIBDIRS = util core parser driver transform printer session whyml
154
LIBINCLUDES = $(addprefix -I src/, $(LIBDIRS))
MARCHE Claude's avatar
MARCHE Claude committed
155

156
LIBDEP = $(addsuffix .dep, $(LIBMODULES))
157 158
LIBCMO = $(addsuffix .cmo, $(LIBMODULES))
LIBCMX = $(addsuffix .cmx, $(LIBMODULES))
159

160
$(LIBDEP): DEPFLAGS += $(LIBINCLUDES)
161
$(LIBCMO) $(LIBCMX): INCLUDES += $(LIBINCLUDES)
162
$(LIBCMX): OFLAGS += -for-pack Why3
163

164 165
$(LIBDEP): $(LIBGENERATED)

166 167 168 169
# Zarith

ifeq (@enable_zarith@,yes)

170 171
lib/ocaml/why3__BigInt.ml: config.status lib/ocaml/why3__BigInt_zarith.ml
	cp lib/ocaml/why3__BigInt_zarith.ml $@
172 173 174

else

175 176
lib/ocaml/why3__BigInt.ml: config.status lib/ocaml/why3__BigInt_num.ml
	cp lib/ocaml/why3__BigInt_num.ml $@
177 178 179

endif

180
clean::
181
	rm -f lib/ocaml/why3__BigInt.ml
182

183
# build targets
184

185 186
byte: lib/why3/why3.cma
opt:  lib/why3/why3.cmxa
187

188
lib/why3/why3.cma: lib/why3/why3.cmo
Andrei Paskevich's avatar
Andrei Paskevich committed
189 190
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) -a $(BFLAGS) -o $@ $^
191

192
lib/why3/why3.cmxa: lib/why3/why3.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
193 194
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLOPT) -a $(OFLAGS) -o $@ $^
195

196
lib/why3/why3.cmo: $(LIBCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
197 198
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $^
199

200
lib/why3/why3.cmx: $(LIBCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
201 202
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLOPT) $(OFLAGS) -pack -o $@ $^
203

204
# clean and depend
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
205

206 207 208
ifneq "$(MAKECMDGOALS)" "clean"
include $(LIBDEP)
endif
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
209

210
depend: $(LIBDEP)
211

Andrei Paskevich's avatar
Andrei Paskevich committed
212
LIBSDIRS = src $(addprefix src/, $(LIBDIRS))
213 214
LIBCLEAN = $(addsuffix /*.cm[iox], $(LIBSDIRS)) \
	   $(addsuffix /*.annot, $(LIBSDIRS)) \
215 216
	   $(addsuffix /*.output, $(LIBSDIRS)) \
	   $(addsuffix /*.automaton, $(LIBSDIRS)) \
217
	   $(addsuffix /*.dep, $(LIBSDIRS)) \
218 219 220 221 222
	   $(addsuffix /*.o, $(LIBSDIRS)) \
	   $(addsuffix /*~, $(LIBSDIRS))

clean::
	rm -f $(LIBCLEAN) $(LIBGENERATED)
223
	rm -f lib/why3/why3.cm* lib/why3/why3.[ao]
224

225 226 227
###############
# installation
###############
228

MARCHE Claude's avatar
MARCHE Claude committed
229 230 231
clean_old_install:
	rm -f $(BINDIR)/why3*
	rm -rf $(DATADIR)/why3
232
	rm -rf $(OCAMLINSTALLLIB)/why3
MARCHE Claude's avatar
MARCHE Claude committed
233

234 235

install_no_local:: clean_old_install
236
	mkdir -p $(BINDIR)
237
	mkdir -p $(DATADIR)/why3
238
	mkdir -p $(DATADIR)/why3/images
239 240
	mkdir -p $(DATADIR)/why3/images/boomy
	mkdir -p $(DATADIR)/why3/images/fatcow
MARCHE Claude's avatar
MARCHE Claude committed
241
	mkdir -p $(DATADIR)/why3/emacs
242
	mkdir -p $(DATADIR)/why3/vim
243
	mkdir -p $(DATADIR)/why3/lang
244
	mkdir -p $(DATADIR)/why3/theories
245
	mkdir -p $(DATADIR)/why3/modules/mach
246 247
	mkdir -p $(DATADIR)/why3/drivers
	cp -f theories/*.why $(DATADIR)/why3/theories
248
	cp -f modules/*.mlw $(DATADIR)/why3/modules
249
	cp -f modules/mach/*.mlw $(DATADIR)/why3/modules/mach
250
	cp -f drivers/*.drv drivers/*.gen $(DATADIR)/why3/drivers
251
	cp -f share/provers-detection-data.conf $(DATADIR)/why3/
252
	cp -f share/images/icons.rc $(DATADIR)/why3/images
253
	cp -f share/images/*.png $(DATADIR)/why3/images
254 255
	cp -f share/images/boomy/*.png $(DATADIR)/why3/images/boomy
	cp -f share/images/fatcow/*.png $(DATADIR)/why3/images/fatcow
256
	cp -f share/why3session.dtd $(DATADIR)/why3
257
	cp -rf share/javascript $(DATADIR)/why3/javascript
258 259 260
	cp -f share/emacs/why3.el $(DATADIR)/why3/emacs/why3.el
	cp -f share/vim/why3.vim $(DATADIR)/why3/vim/why3.vim
	cp -f share/lang/why3.lang $(DATADIR)/why3/lang/why3.lang
261

MARCHE Claude's avatar
MARCHE Claude committed
262
install_no_local_lib::
263
	mkdir -p $(OCAMLINSTALLLIB)/why3
264
	cp -f lib/why3/why3.cm* lib/why3/why3.[ao] \
265
		lib/why3/META $(OCAMLINSTALLLIB)/why3
MARCHE Claude's avatar
MARCHE Claude committed
266

267 268
ifeq (@enable_local@,yes)
install install-lib:
269 270
	@echo "Why3 is configured in local installation mode."
	@echo "To install Why3, run ./configure --disable-local ; make ; make install"
271
else
MARCHE Claude's avatar
MARCHE Claude committed
272
install: clean_old_install install_no_local
MARCHE Claude's avatar
MARCHE Claude committed
273
install-lib: install_no_local_lib
274 275
endif

MARCHE Claude's avatar
MARCHE Claude committed
276 277
install-all: install install-lib

278
##################
279
# Why3 plugins
280 281
##################

Andrei Paskevich's avatar
Andrei Paskevich committed
282
PLUGGENERATED = plugins/tptp/tptp_lexer.ml \
283 284
		plugins/tptp/tptp_parser.ml plugins/tptp/tptp_parser.mli \
		plugins/parser/dimacs.ml \
285

286
PLUG_PARSER = genequlin dimacs
287
PLUG_PRINTER =
288
PLUG_TRANSFORM =
289
PLUG_TPTP = tptp_ast tptp_parser tptp_typing tptp_lexer tptp_printer
290

291
PLUGINS = genequlin dimacs tptp
292

293
TPTPMODULES = $(addprefix plugins/tptp/, $(PLUG_TPTP))
Andrei Paskevich's avatar
Andrei Paskevich committed
294

295 296
TPTPCMO = $(addsuffix .cmo, $(TPTPMODULES))
TPTPCMX = $(addsuffix .cmx, $(TPTPMODULES))
297

298 299 300 301 302 303 304 305 306 307
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

308 309
PLUGMODULES = $(addprefix plugins/parser/, $(PLUG_PARSER)) \
	      $(addprefix plugins/printer/, $(PLUG_PRINTER)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
310
	      $(addprefix plugins/transform/, $(PLUG_TRANSFORM)) \
311
	      $(TPTPMODULES)
312

313
PLUGDEP = $(addsuffix .dep, $(PLUGMODULES))
314 315 316
PLUGCMO = $(addsuffix .cmo, $(PLUGMODULES))
PLUGCMX = $(addsuffix .cmx, $(PLUGMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
317
PLUGDIRS = parser printer transform tptp
318 319
PLUGINCLUDES = $(addprefix -I plugins/, $(PLUGDIRS))

320
$(PLUGDEP): DEPFLAGS += $(PLUGINCLUDES)
321 322
$(PLUGCMO) $(PLUGCMX): INCLUDES += $(PLUGINCLUDES)

323 324
$(PLUGDEP): $(PLUGGENERATED)

325 326 327 328 329
LIBPLUGCMO =  $(addsuffix .cmo,  $(addprefix lib/plugins/, $(PLUGINS)))
LIBPLUGCMXS = $(addsuffix .cmxs, $(addprefix lib/plugins/, $(PLUGINS)))

plugins.byte: $(LIBPLUGCMO)
plugins.opt : $(LIBPLUGCMXS)
330 331

lib/plugins/%.cmxs: plugins/parser/%.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
332
	$(if $(QUIET),@echo 'Linking  $@' &&) \
333 334 335 336 337 338 339
	    $(OCAMLOPT) $(OFLAGS) -shared -o $@ $<

lib/plugins/%.cmo: plugins/parser/%.cmo
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $<

lib/plugins/%.cmxs: plugins/printer/%.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
340
	$(if $(QUIET),@echo 'Linking  $@' &&) \
341 342 343 344 345 346 347
	    $(OCAMLOPT) $(OFLAGS) -shared -o $@ $<

lib/plugins/%.cmo: plugins/printer/%.cmo
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $<

lib/plugins/%.cmxs: plugins/transform/%.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
348
	$(if $(QUIET),@echo 'Linking  $@' &&) \
349 350 351 352 353 354
	    $(OCAMLOPT) $(OFLAGS) -shared -o $@ $<

lib/plugins/%.cmo: plugins/transform/%.cmo
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $<

355
lib/plugins/tptp.cmxs: $(TPTPCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
356
	$(if $(QUIET),@echo 'Linking  $@' &&) \
357
	    $(OCAMLOPT) $(OFLAGS) -shared -o $@ $^
358

359
lib/plugins/tptp.cmo: $(TPTPCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
360
	$(if $(QUIET),@echo 'Linking  $@' &&) \
361
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $^
362 363 364 365 366 367

PLUGSDIRS = plugins $(addprefix plugins/, $(PLUGDIRS))
PLUGCLEAN = $(addsuffix /*.cm[iox], $(PLUGSDIRS)) \
	    $(addsuffix /*.annot, $(PLUGSDIRS)) \
	    $(addsuffix /*.output, $(PLUGSDIRS)) \
	    $(addsuffix /*.automaton, $(PLUGSDIRS)) \
368
	    $(addsuffix /*.dep, $(PLUGSDIRS)) \
369 370 371
	    $(addsuffix /*.o, $(PLUGSDIRS)) \
	    $(addsuffix /*~, $(PLUGSDIRS))

372 373 374 375 376 377
# depend and clean targets

ifneq "$(MAKECMDGOALS)" "clean"
include $(PLUGDEP)
endif

378
depend: $(PLUGDEP)
379

380 381 382 383 384
clean::
	rm -f $(PLUGCLEAN) $(PLUGGENERATED)
	rm -f lib/plugins/*

install_no_local::
385
	rm -rf $(LIBDIR)/why3/plugins
386
	mkdir -p $(LIBDIR)/why3/plugins
387
	cp -f $(foreach f,$(LIBPLUGCMO) $(LIBPLUGCMXS),$(wildcard $(f))) $(LIBDIR)/why3/plugins
388

389 390 391
######
# Why3
######
392

393 394
src/main.cmo: lib/why3/why3.cma
src/main.cmx: lib/why3/why3.cmxa
395

396 397
byte: bin/why3.byte
opt:  bin/why3.opt
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
398

399
bin/why3.opt: lib/why3/why3.cmxa src/main.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
400
	$(if $(QUIET),@echo 'Linking  $@' &&) \
401
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
402

403
bin/why3.byte: lib/why3/why3.cma src/main.cmo
404
	$(if $(QUIET),@echo 'Linking  $@' &&) \
405
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
406

407 408
bin/why3: bin/why3.@OCAMLBEST@
	ln -sf why3.@OCAMLBEST@ $@
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
409

410 411
install_no_local::
	cp -f bin/why3.@OCAMLBEST@ $(BINDIR)/why3$(EXE)
412

413
install_local: bin/why3
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
414

415 416 417 418 419 420
ifneq "$(MAKECMDGOALS)" "clean"
include src/main.dep
endif

depend: src/main.dep

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
421
clean::
422
	rm -f src/main.cm[iox] src/main.annot src/main.o src/main.dep
423
	rm -f bin/why3.byte bin/why3.opt bin/why3
424
	rm -f bin/why3ml.byte bin/why3ml.opt bin/why3ml
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
425

426 427 428
##############
# test targets
##############
429

430 431
%.gui: %.why bin/why3ide.opt
	bin/why3ide.opt $*.why
432

433 434
%: %.mlw bin/why3.opt
	bin/why3.opt $*.mlw
435

436 437
%: %.why bin/why3.opt
	bin/why3.opt $*.why
François Bobot's avatar
François Bobot committed
438

439 440
%.gui: %.mlw bin/why3ide.opt
	bin/why3ide.opt $*.mlw
441

442
%.type: %.mlw bin/why3ide.opt
443
	bin/why3.opt --type-only $*.mlw
444

445 446 447 448
##########
# gallery
##########

449
# we export exactly the programs that have a why3session.xml file
450 451 452

.PHONY: gallery

453 454
gallery::
	@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
Andrei Paskevich's avatar
Andrei Paskevich committed
455
	@for x in examples/*/why3session.xml ; do \
456 457
	  d=`dirname $$x`; \
	  f=`basename $$d`; \
458
	  why3session html $$x; \
459 460
	  echo "exporting $$f"; \
	  mkdir -p $(GALLERYDIR)/$$f; \
461
	  cp examples/$$f.mlw examples/$$f/$$f.html $(GALLERYDIR)/$$f/; \
462
	  rm -f $(GALLERYDIR)/$$f/$$f.zip; \
Andrei Paskevich's avatar
Andrei Paskevich committed
463
	  cd examples/; \
464
	  zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f/$$f.html  $$f; \
465
	  cd ..; \
466
	done
467

468 469 470 471 472 473 474 475
%-gallery::
	@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
	x=$*/why3session.xml; \
	d=`dirname $$x`; \
	f=`basename $$d`; \
	why3session html $$x; \
	echo "exporting $$f"; \
	mkdir -p $(GALLERYDIR)/$$f; \
476 477 478
	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; \
	cp examples/$$f/$$f.html $(GALLERYDIR)/$$f/; \
479 480 481 482
	rm -f $(GALLERYDIR)/$$f/$$f.zip; \
	cd examples/; \
	zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f/$$f.html  $$f

MARCHE Claude's avatar
MARCHE Claude committed
483 484 485 486 487 488 489 490
########
# XML DTD validation
########

.PHONY: xml-validate

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

494 495 496 497 498
xml-validate-local:
	@for x in `find examples/ -name why3session.xml`; do \
	  xmllint --noout --dtdvalid share/why3session.dtd $$x 2>&1 | head -1; \
	done

499 500 501 502
########
# Config
########

503
CONFIG_FILES = why3config
504

505
CONFIGMODULES = $(addprefix src/why3config/, $(CONFIG_FILES))
506

507
CONFIGDEP = $(addsuffix .dep, $(CONFIGMODULES))
508 509 510 511 512
CONFIGCMO = $(addsuffix .cmo, $(CONFIGMODULES))
CONFIGCMX = $(addsuffix .cmx, $(CONFIGMODULES))

# build targets

513 514
byte: bin/why3config.byte
opt:  bin/why3config.opt
515

516
bin/why3config.opt: lib/why3/why3.cmxa $(CONFIGCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
517
	$(if $(QUIET),@echo 'Linking  $@' &&) \
518
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
519

520
bin/why3config.byte: lib/why3/why3.cma $(CONFIGCMO)
521
	$(if $(QUIET),@echo 'Linking  $@' &&) \
522
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
523

524 525 526
bin/why3config: bin/why3config.@OCAMLBEST@
	ln -sf why3config.@OCAMLBEST@ $@

527 528
# depend and clean targets

529 530 531
ifneq "$(MAKECMDGOALS)" "clean"
include $(CONFIGDEP)
endif
532

533
depend: $(CONFIGDEP)
534 535

clean::
536 537 538
	rm -f src/why3config/*.cm[iox] src/why3config/*.o
	rm -f src/why3config/*.annot src/why3config/*.dep src/why3config/*~
	rm -f src/why3config/*.output src/why3config/*.automaton
539
	rm -f bin/why3config.byte bin/why3config.opt bin/why3config
540

541 542
local_config: bin/why3config.@OCAMLBEST@
	WHY3LIB=$(PWD) WHY3DATA=$(PWD)/share bin/why3config.@OCAMLBEST@ \
543
		--detect --conf_file why3.conf
544

545
install_no_local::
546
	cp -f bin/why3config.@OCAMLBEST@ $(BINDIR)/why3config$(EXE)
547

548
install_local: bin/why3config
549

MARCHE Claude's avatar
MARCHE Claude committed
550 551 552 553
###############
# IDE
###############

554 555
ifeq (@enable_ide@,yes)

François Bobot's avatar
François Bobot committed
556
IDE_FILES = gconfig gmain
MARCHE Claude's avatar
MARCHE Claude committed
557 558 559

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

560
IDEDEP = $(addsuffix .dep, $(IDEMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
561 562 563
IDECMO = $(addsuffix .cmo, $(IDEMODULES))
IDECMX = $(addsuffix .cmx, $(IDEMODULES))

564
$(IDEDEP): DEPFLAGS += -I src/ide
565
$(IDECMO) $(IDECMX): INCLUDES += -I src/ide
MARCHE Claude's avatar
MARCHE Claude committed
566

567
# build targets
MARCHE Claude's avatar
MARCHE Claude committed
568

569 570
byte: bin/why3ide.byte
opt:  bin/why3ide.opt
MARCHE Claude's avatar
MARCHE Claude committed
571

572
bin/why3ide.opt bin/why3ide.byte: INCLUDES += -I @LABLGTK2LIB@
573
bin/why3ide.opt bin/why3ide.byte: EXTLIBS += lablgtk lablgtksourceview2
MARCHE Claude's avatar
MARCHE Claude committed
574

575
bin/why3ide.opt: lib/why3/why3.cmxa src/ide/resetgc.o $(IDECMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
576
	$(if $(QUIET),@echo 'Linking  $@' &&) \
577
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
578

579
bin/why3ide.byte: lib/why3/why3.cma src/ide/resetgc.o $(IDECMO)
MARCHE Claude's avatar
MARCHE Claude committed
580
	$(if $(QUIET),@echo 'Linking  $@' &&) \
581
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) -custom $^
MARCHE Claude's avatar
MARCHE Claude committed
582

583 584 585
bin/why3ide: bin/why3ide.@OCAMLBEST@
	ln -sf why3ide.@OCAMLBEST@ $@

586
src/ide/resetgc.o: src/ide/resetgc.c
587
	$(OCAMLC) -c -ccopt "-Wall -o $@" $<
588

MARCHE Claude's avatar
MARCHE Claude committed
589 590
# depend and clean targets

591 592 593
ifneq "$(MAKECMDGOALS)" "clean"
include $(IDEDEP)
endif
MARCHE Claude's avatar
MARCHE Claude committed
594

595
depend: $(IDEDEP)
MARCHE Claude's avatar
MARCHE Claude committed
596 597

clean::
598
	rm -f src/ide/xml.ml
MARCHE Claude's avatar
MARCHE Claude committed
599
	rm -f src/ide/*.cm[iox] src/ide/*.o
600
	rm -f src/ide/*.annot src/ide/*.dep src/ide/*~
601
	rm -f bin/why3ide.byte bin/why3ide.opt bin/why3ide
MARCHE Claude's avatar
MARCHE Claude committed
602

603
install_no_local::
604
	cp -f bin/why3ide.@OCAMLBEST@ $(BINDIR)/why3ide$(EXE)
605 606

install_local: bin/why3ide
607

608
endif
MARCHE Claude's avatar
d  
MARCHE Claude committed
609

610

MARCHE Claude's avatar
MARCHE Claude committed
611 612 613 614
###############
# Replayer
###############

François Bobot's avatar
François Bobot committed
615
REPLAYER_FILES = replay
MARCHE Claude's avatar
MARCHE Claude committed
616

617
REPLAYERMODULES = $(addprefix src/why3replayer/, $(REPLAYER_FILES))
MARCHE Claude's avatar
MARCHE Claude committed
618

619
REPLAYERDEP = $(addsuffix .dep, $(REPLAYERMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
620 621 622
REPLAYERCMO = $(addsuffix .cmo, $(REPLAYERMODULES))
REPLAYERCMX = $(addsuffix .cmx, $(REPLAYERMODULES))

623 624
$(REPLAYERDEP): DEPFLAGS += -I src/why3replayer
$(REPLAYERCMO) $(REPLAYERCMX): INCLUDES += -I src/why3replayer
MARCHE Claude's avatar
MARCHE Claude committed
625 626 627 628 629 630

# build targets

byte: bin/why3replayer.byte
opt:  bin/why3replayer.opt

631
bin/why3replayer.opt: lib/why3/why3.cmxa $(REPLAYERCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
632
	$(if $(QUIET),@echo 'Linking  $@' &&) \
633
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
634

635
bin/why3replayer.byte: lib/why3/why3.cma $(REPLAYERCMO)
MARCHE Claude's avatar
MARCHE Claude committed
636
	$(if $(QUIET),@echo 'Linking  $@' &&) \
637
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
638 639 640 641 642 643

bin/why3replayer: bin/why3replayer.@OCAMLBEST@
	ln -sf why3replayer.@OCAMLBEST@ $@

# depend and clean targets

644 645 646
ifneq "$(MAKECMDGOALS)" "clean"
include $(REPLAYERDEP)
endif
MARCHE Claude's avatar
MARCHE Claude committed
647

648
depend: $(REPLAYERDEP)
MARCHE Claude's avatar
MARCHE Claude committed
649 650

clean::
651 652
	rm -f src/why3replayer/*.cm[iox] src/why3replayer/*.o
	rm -f src/why3replayer/*.annot src/why3replayer/*.dep src/why3replayer/*~
MARCHE Claude's avatar
MARCHE Claude committed
653 654 655
	rm -f bin/why3replayer.byte bin/why3replayer.opt bin/why3replayer

install_no_local::
656
	cp -f bin/why3replayer.@OCAMLBEST@ $(BINDIR)/why3replayer$(EXE)
MARCHE Claude's avatar
MARCHE Claude committed
657 658 659

install_local: bin/why3replayer

660 661 662 663 664

###############
# Session
###############

665 666
SESSION_FILES = why3session_lib why3session_copy why3session_info	\
		why3session_latex why3session_html why3session_rm	\
667 668
		why3session_output why3session_run why3session_csv	\
		why3session
669 670 671

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

672
SESSIONDEP = $(addsuffix .dep, $(SESSIONMODULES))
673 674 675
SESSIONCMO = $(addsuffix .cmo, $(SESSIONMODULES))
SESSIONCMX = $(addsuffix .cmx, $(SESSIONMODULES))

676
$(SESSIONDEP): DEPFLAGS += -I src/why3session
677 678 679 680 681 682 683
$(SESSIONCMO) $(SESSIONCMX): INCLUDES += -I src/why3session

# build targets

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

684
bin/why3session.opt: lib/why3/why3.cmxa $(SESSIONCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
685
	$(if $(QUIET),@echo 'Linking  $@' &&) \
686
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
687

688
bin/why3session.byte: lib/why3/why3.cma $(SESSIONCMO)
689
	$(if $(QUIET),@echo 'Linking  $@' &&) \
690
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
691 692 693 694 695 696

bin/why3session: bin/why3session.@OCAMLBEST@
	ln -sf why3session.@OCAMLBEST@ $@

# depend and clean targets

697 698 699
ifneq "$(MAKECMDGOALS)" "clean"
include $(SESSIONDEP)
endif
700

701
depend: $(SESSIONDEP)
702 703

clean::
704 705
	rm -f src/why3session/*.cm[iox] src/why3session/*.o
	rm -f src/why3session/*.annot src/why3session/*.dep src/why3session/*~
706 707 708 709 710 711 712
	rm -f bin/why3session.byte bin/why3session.opt bin/why3session

install_no_local::
	cp -f bin/why3session.@OCAMLBEST@ $(BINDIR)/why3session$(EXE)

install_local: bin/why3session

MARCHE Claude's avatar
MARCHE Claude committed
713

714
###############
715
# Bench
716 717
###############

718 719
ifeq (@enable_bench@,yes)

720
BENCH_FILES = worker db bench benchrc benchdb why3bench
721

722
BENCHMODULES := $(addprefix src/why3bench/, $(BENCH_FILES))
723

724
BENCHDEP = $(addsuffix .dep, $(BENCHMODULES))
725 726 727
BENCHCMO = $(addsuffix .cmo, $(BENCHMODULES))
BENCHCMX = $(addsuffix .cmx, $(BENCHMODULES))

728 729
$(BENCHDEP): DEPFLAGS += -I src/why3bench
$(BENCHCMO) $(BENCHCMX): INCLUDES += -I src/why3bench -I @SQLITE3LIB@
730 731 732

# build targets

733 734
byte: bin/why3bench.byte
opt:  bin/why3bench.opt
735

736
bin/why3bench.opt bin/why3bench.byte: INCLUDES += -thread -I +threads -I @SQLITE3LIB@
737
bin/why3bench.opt bin/why3bench.byte: EXTLIBS += threads sqlite3
738

739
bin/why3bench.opt: lib/why3/why3.cmxa $(BENCHCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
740
	$(if $(QUIET),@echo 'Linking  $@' &&) \
741
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
742

743
bin/why3bench.byte: lib/why3/why3.cma $(BENCHCMO)
744
	$(if $(QUIET),@echo 'Linking  $@' &&) \
745
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
746

747 748 749
bin/why3bench: bin/why3bench.@OCAMLBEST@
	ln -sf why3bench.@OCAMLBEST@ $@

750 751
# depend and clean targets

752 753 754
ifneq "$(MAKECMDGOALS)" "clean"
include $(BENCHDEP)
endif
755

756
depend: $(BENCHDEP)
757 758

clean::
759 760
	rm -f src/why3bench/*.cm[iox] src/why3bench/*.o
	rm -f src/why3bench/*.annot src/why3bench/*.dep src/why3bench/*~
761
	rm -f bin/why3bench.byte bin/why3bench.opt bin/why3bench
762 763

install_no_local::
764
	cp -f bin/why3bench.@OCAMLBEST@ $(BINDIR)/why3bench$(EXE)
765 766

install_local: bin/why3bench
767

768 769
endif

770 771 772
##############
# Coq plugin
##############
773

774
ifeq (@enable_coq_tactic@,yes)
775

Claude Marche's avatar
Claude Marche committed
776
COQPGENERATED = src/coq-tactic/coqCompat.ml src/coq-tactic/g_why3tac.ml
777

Claude Marche's avatar
Claude Marche committed
778
COQP_FILES = coqCompat why3tac g_why3tac
779

780
COQPMODULES = $(addprefix src/coq-tactic/, $(COQP_FILES))
781

782 783 784
COQPDEP = $(addsuffix .dep, $(COQPMODULES))
COQPCMO = $(addsuffix .cmo, $(COQPMODULES))
COQPCMX = $(addsuffix .cmx, $(COQPMODULES))
785

786
COQPTREES = kernel lib interp parsing proofs pretyping tactics library toplevel
787
COQPINCLUDES = -I src/coq-tactic -I +camlp5 $(addprefix -I @COQLIB@/, $(COQPTREES))
788

789
$(COQPDEP): DEPFLAGS += -I src/coq-tactic
790
$(COQPCMO) $(COQPCMX): INCLUDES += $(COQPINCLUDES)
791 792
$(COQPCMO) $(COQPCMX): BFLAGS += -rectypes
$(COQPCMX): OFLAGS += -rectypes
793

794
$(COQPDEP): $(COQPGENERATED)
795

796 797
byte: src/coq-tactic/.why3-vo-byte
opt:  src/coq-tactic/.why3-vo-opt
798

799 800
src/coq-tactic/coqCompat.ml: src/coq-tactic/coqCompat@coq_compat_version@.ml
	cp -f $< $@
801

802
lib/coq-tactic/why3tac.cmxs: lib/why3/why3.cmxa $(COQPCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
803
	$(if $(QUIET),@echo 'Linking  $@' &&) \
804
	    $(OCAMLOPT) $(OFLAGS) -o $@ -shared $^
805

806
lib/coq-tactic/why3tac.cma: lib/why3/why3.cma $(COQPCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
807
	$(if $(QUIET),@echo 'Linking  $@' &&) \
808
	    $(OCAMLC) -a $(BFLAGS) -o $@ $^
809

810
src/coq-tactic/g_why3tac.ml: src/coq-tactic/g_why3tac.ml4
Andrei Paskevich's avatar
Andrei Paskevich committed
811 812
	$(if $(QUIET),@echo 'Camlp5   $<' &&) \
	    $(CAMLP5O) pr_o.cmo @COQLIB@/parsing/grammar.cma -impl $^ -o $@
813

814
src/coq-tactic/.why3-vo-byte: lib/coq-tactic/Why3.v lib/coq-tactic/why3tac.cma
Andrei Paskevich's avatar
Andrei Paskevich committed
815
	$(if $(QUIET),@echo 'Coqc     $<' &&) \
816
	    WHY3CONFIG="" $(COQC) -byte -I lib/coq-tactic/ $< && \
817
	    touch src/coq-tactic/.why3-vo-byte
818

819
src/coq-tactic/.why3-vo-opt: lib/coq-tactic/Why3.v lib/coq-tactic/why3tac.cmxs
Andrei Paskevich's avatar
Andrei Paskevich committed
820
	$(if $(QUIET),@echo 'Coqc     $<' &&) \
821
	    WHY3CONFIG="" $(COQC) -opt -I lib/coq-tactic/ $< && \
822
	    touch src/coq-tactic/.why3-vo-opt
823

824
# depend and clean targets
Andrei Paskevich's avatar
Andrei Paskevich committed
825

826
ifneq "$(MAKECMDGOALS)" "clean"
827
include $(COQPDEP)
828
endif
829

830
depend: $(COQPDEP)
831 832

clean::
833 834 835 836 837
	rm -f src/coq-tactic/*.cm[iox] src/coq-tactic/*.o
	rm -f lib/coq-tactic/*.cma lib/coq-tactic/*.cmxs
	rm -f lib/coq-tactic/*.vo lib/coq-tactic/*.glob
	rm -f src/coq-tactic/*.annot src/coq-tactic/*.dep src/coq-tactic/*~
	rm -f src/coq-tactic/.why3-vo-*
838
	rm -f $(COQPGENERATED)
839

840
install_no_local::
841 842
	mkdir -p $(LIBDIR)/why3/coq-tactic
	cp -f lib/coq-tactic/* $(LIBDIR)/why3/coq-tactic
843

844 845 846 847 848 849 850 851
endif

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

ifeq (@enable_coq_libs@,yes)

852
COQLIBS_INT_FILES = Abs ComputerDivision Div2 EuclideanDivision Int MinMax Power
853 854
COQLIBS_INT_ALL_FILES = Exponentiation $(COQLIBS_INT_FILES)
COQLIBS_INT = $(addprefix lib/coq/int/, $(COQLIBS_INT_ALL_FILES))
855

856 857 858
COQLIBS_BOOL_FILES = Bool
COQLIBS_BOOL = $(addprefix lib/coq/bool/, $(COQLIBS_BOOL_FILES))

859
COQLIBS_REAL_FILES = Abs ExpLog FromInt MinMax PowerInt Real Square RealInfix
860 861
COQLIBS_REAL = $(addprefix lib/coq/real/, $(COQLIBS_REAL_FILES))

862
COQLIBS_NUMBER_FILES = Divisibility Gcd Parity Prime Coprime
863 864
COQLIBS_NUMBER = $(addprefix lib/coq/number/, $(COQLIBS_NUMBER_FILES))

865 866 867
COQLIBS_SET_FILES = Set
COQLIBS_SET = $(addprefix lib/coq/set/, $(COQLIBS_SET_FILES))

868
COQLIBS_MAP_FILES = Map Occ MapPermut MapInjection
869 870
COQLIBS_MAP = $(addprefix lib/coq/map/, $(COQLIBS_MAP_FILES))

871
COQLIBS_LIST_FILES = List Length Mem Nth NthLength HdTl NthHdTl Append NthLengthAppend Reverse
872 873 874 875 876
COQLIBS_LIST = $(addprefix lib/coq/list/, $(COQLIBS_LIST_FILES))

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

877
ifeq (@enable_coq_fp_libs@,yes)
878
COQLIBS_FP_FILES = Rounding SingleFormat Single DoubleFormat Double
879 880 881
COQLIBS_FP_ALL_FILES = GenFloat $(COQLIBS_FP_FILES)
COQLIBS_FP = $(addprefix lib/coq/floating_point/, $(COQLIBS_FP_ALL_FILES))
endif
882

883
COQLIBS_FILES = lib/coq/BuiltIn $(COQLIBS_INT) $(COQLIBS_BOOL) $(COQLIBS_REAL) $(COQLIBS_NUMBER) $(COQLIBS_SET) $(COQLIBS_MAP) $(COQLIBS_LIST) $(COQLIBS_OPTION) $(COQLIBS_FP)
884 885 886

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

%.vo: %.v
Andrei Paskevich's avatar
Andrei Paskevich committed
890 891
	$(if $(QUIET),@echo 'Coqc     $<' &&) \
	    $(COQC) -R lib/coq Why3 $<
892 893

%.vd: %.v
Andrei Paskevich's avatar
Andrei Paskevich committed
894 895
	$(if $(QUIET),@echo 'Coqdep   $<' &&) \
	    $(COQDEP) -slash -R lib/coq Why3 $< > $@
896

897 898 899
drivers/coq-realizations.aux: Makefile
	$(if $(QUIET),@echo 'Generate $@' &&) \
	(echo "(* generated automatically at compilation time *)"; \
Andrei Paskevich's avatar
Andrei Paskevich committed
900
	echo 'theory BuiltIn meta "realized_theory" "BuiltIn", "" end'; \
Andrei Paskevich's avatar
Andrei Paskevich committed
901
	for f in $(COQLIBS_INT_FILES); do \
Andrei Paskevich's avatar
Andrei Paskevich committed
902
	echo 'theory int.'"$$f"' meta "realized_theory" "int.'"$$f"'", "" end'; done; \
903 904
	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
905
	for f in $(COQLIBS_REAL_FILES); do \
Andrei Paskevich's avatar
Andrei Paskevich committed
906
	echo 'theory real.'"$$f"' meta "realized_theory" "real.'"$$f"'", "" end'; done; \
907
	for f in $(COQLIBS_NUMBER_FILES); do \
Andrei Paskevich's avatar
Andrei Paskevich committed
908
	echo 'theory number.'"$$f"' meta "realized_theory" "number.'"$$f"'", "" end'; done; \
909
	for f in $(COQLIBS_SET_FILES); do \
Andrei Paskevich's avatar
Andrei Paskevich committed
910
	echo 'theory set.'"$$f"' meta "realized_theory" "set.'"$$f"'", "" end'; done; \
911 912
	for f in $(COQLIBS_MAP_FILES); do \
	echo 'theory map.'"$$f"' meta "realized_theory" "map.'"$$f"'", "" end'; done; \
913 914 915 916
	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; \
Andrei Paskevich's avatar
Andrei Paskevich committed
917
	for f in $(COQLIBS_FP_FILES); do \
Andrei Paskevich's avatar
Andrei Paskevich committed
918
	echo 'theory floating_point.'"$$f"' meta "realized_theory" "floating_point.'"$$f"'", "" end'; done; \
919
	) > $@
920

921
opt byte: $(COQVO)
922 923 924

install_no_local::
	mkdir -p $(LIBDIR)/why3/coq
925
	cp lib/coq/BuiltIn.vo $(LIBDIR)/why3/coq/
926
	mkdir -p $(LIBDIR)/why3/coq/int
927
	cp $(addsuffix .vo, $(COQLIBS_INT)) $(LIBDIR)/why3/coq/int/
928 929
	mkdir -p $(LIBDIR)/why3/coq/bool
	cp $(addsuffix .vo, $(COQLIBS_BOOL)) $(LIBDIR)/why3/coq/bool/
930
	mkdir -p $(LIBDIR)/why3/coq/real
931
	cp $(addsuffix .vo, $(COQLIBS_REAL)) $(LIBDIR)/why3/coq/real/
932 933
	mkdir -p $(LIBDIR)/why3/coq/number
	cp $(addsuffix .vo, $(COQLIBS_NUMBER)) $(LIBDIR)/why3/coq/number/
934 935
	mkdir -p $(LIBDIR)/why3/coq/set
	cp $(addsuffix .vo, $(COQLIBS_SET)) $(LIBDIR)/why3/coq/set/
936 937
	mkdir -p $(LIBDIR)/why3/coq/map
	cp $(addsuffix .vo, $(COQLIBS_MAP)) $(LIBDIR)/why3/coq/map/
938 939 940 941
	mkdir -p $(LIBDIR)/why3/coq/list
	cp $(addsuffix .vo, $(COQLIBS_LIST)) $(LIBDIR)/why3/coq/list/
	mkdir -p $(LIBDIR)/why3/coq/option
	cp $(addsuffix .vo, $(COQLIBS_OPTION)) $(LIBDIR)/why3/coq/option/
942 943
ifeq (@enable_coq_fp_libs@,yes)
	mkdir -p $(LIBDIR)/why3/coq/floating_point
944
	cp $(addsuffix .vo, $(COQLIBS_FP)) $(LIBDIR)/why3/coq/floating_point/
945
endif
946
	cp drivers/coq-realizations.aux $(DATADIR)/why3/drivers/
947

948
install_local: $(COQVO) drivers/coq-realizations.aux
949

950
ifneq "$(MAKECMDGOALS)" "clean"
951
ifneq "$(MAKECMDGOALS:update-coq%=update-coq)" "update-coq"
952
include $(COQVD)
953
endif
954
endif
955

956
depend: $(COQVD)
957 958

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

961
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
962 963

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

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

969
update-coq-real: bin/why3 drivers/coq-realizations.aux theories/real.why
970
	for f in $(COQLIBS_REAL_FILES); do WHY3CONFIG="" bin/why3.@OCAMLBEST@ --realize -L theories -D drivers/coq-realize.drv -T real.$$f -o lib/coq/real/; done
971 972

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

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

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

981 982 983 984 985 986
update-coq-list: bin/why3 drivers/coq-realizations.aux theories/list.why
	for f in $(COQLIBS_LIST_FILES); do WHY3CONFIG="" bin/why3.@OCAMLBEST@ --realize -L theories -D drivers/coq-realize.drv -T list.$$f -o lib/coq/list/; done

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

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

990 991
else

992 993
drivers/coq-realizations.aux:
	echo "(* generated automatically at compilation time *)" > $@
994

995 996 997
install_no_local::
	cp drivers/coq-realizations.aux $(DATADIR)/why3/drivers/

998
endif
999

1000 1001 1002 1003 1004
opt byte: drivers/coq-realizations.aux

clean::
	rm -f drivers/coq-realizations.aux

Jean-Christophe's avatar
Jean-Christophe committed
1005 1006 1007 1008 1009 1010
####################
# PVS realizations
####################

ifeq (@enable_pvs_libs@,yes)

Jean-Christophe's avatar
Jean-Christophe committed
1011
PVSLIBS_INT_FILES = Int Abs MinMax ComputerDivision EuclideanDivision
Jean-Christophe's avatar
Jean-Christophe committed
1012 1013
PVSLIBS_INT = $(addprefix lib/pvs/int/, $(PVSLIBS_INT_FILES))

Jean-Christophe's avatar
Jean-Christophe committed
1014 1015 1016
PVSLIBS_REAL_FILES = Abs FromInt MinMax Real Square ExpLog Trigonometry \
                     PowerInt
 # RealInfix
Jean-Christophe's avatar
Jean-Christophe committed
1017 1018
PVSLIBS_REAL = $(addprefix lib/pvs/real/, $(PVSLIBS_REAL_FILES))

1019
PVSLIBS_LIST_FILES =
1020
  # Nth
1021 1022
PVSLIBS_LIST = $(addprefix lib/pvs/int/, $(PVSLIBS_LIST_FILES))

Jean-Christophe's avatar
Jean-Christophe committed
1023
PVSLIBS_NUMBER_FILES = # Divisibility Gcd Parity Prime
Jean-Christophe's avatar
Jean-Christophe committed
1024 1025 1026
PVSLIBS_NUMBER = $(addprefix lib/pvs/number/, $(PVSLIBS_NUMBER_FILES))

PVSLIBS_FP_FILES = Rounding SingleFormat Single DoubleFormat Double
1027
PVSLIBS_FP_ALL_FILES = $(PVSLIBS_FP_FILES)
Jean-Christophe's avatar
Jean-Christophe committed
1028 1029
PVSLIBS_FP = $(addprefix lib/pvs/floating_point/, $(PVSLIBS_FP_ALL_FILES))