Makefile.in 46.2 KB
Newer Older
1 2
##########################################################################
#                                                                        #
MARCHE Claude's avatar
MARCHE Claude committed
3
#  Copyright (C) 2010-2012                                               #
4 5 6
#    François Bobot                                                      #
#    Jean-Christophe Filliâtre                                           #
#    Claude Marché                                                       #
MARCHE Claude's avatar
MARCHE Claude committed
7
#    Guillaume Melquiond                                                 #
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
8
#    Andrei Paskevich                                                    #
9 10 11
#                                                                        #
#  This software is free software; you can redistribute it and/or        #
#  modify it under the terms of the GNU Library General Public           #
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
12
#  License version 2.1, with the special exception on linking            #
13 14 15 16 17 18 19 20
#  described in file LICENSE.                                            #
#                                                                        #
#  This software is distributed in the hope that it will be useful,      #
#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                  #
#                                                                        #
##########################################################################

Andrei Paskevich's avatar
Andrei Paskevich committed
21
include Version
22

23 24 25 26 27 28
VERBOSEMAKE ?= @enable_verbose_make@

ifeq ($(VERBOSEMAKE),yes)
  QUIET =
else
  QUIET = yes
29 30
endif

31
# install the binaries
32
DESTDIR =
33

34
prefix	    = @prefix@
35 36 37 38 39
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@

BINDIR  = $(DESTDIR)@bindir@
LIBDIR  = $(DESTDIR)@libdir@
40
DATADIR = $(DESTDIR)@datarootdir@
41
MANDIR  = $(DESTDIR)@mandir@
42

Andrei Paskevich's avatar
Andrei Paskevich committed
43
# OS specific stuff
44
EXE   = @EXE@
45 46

# other variables
47
CC        = @CC@
48 49 50 51 52 53 54 55 56
OCAMLC    = @OCAMLC@
OCAMLOPT  = @OCAMLOPT@
OCAMLDEP  = @OCAMLDEP@
OCAMLLEX  = @OCAMLLEX@
OCAMLYACC = @OCAMLYACC@
OCAMLDOC  = @OCAMLDOC@
OCAMLLIB  = @OCAMLLIB@
OCAMLBEST = @OCAMLBEST@
OCAMLVERSION = @OCAMLVERSION@
57 58
COQC      = @COQC@
COQDEP    = @COQDEP@
59 60
CAMLP5O   = @CAMLP5O@

61
DEPFLAGS  = -slash -I src
62
ifeq (@OCAMLBEST@,opt)
63
DEPFLAGS += -native
64 65
endif

66
RUBBER = @RUBBER@
67
HEVEA = @HEVEA@
68
HACHA = @HACHA@
69

70
#PSVIEWER  = @PSVIEWER@
Andrei Paskevich's avatar
Andrei Paskevich committed
71
#PDFVIEWER = @PDFVIEWER@
72

73
OFLAGS = -w Aer-29 -dtypes    -I src $(INCLUDES)
74 75 76 77
BFLAGS = -w Aer-29 -dtypes -g -I src $(INCLUDES)

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

79 80 81 82
ifeq (@enable_debug@,yes)
OFLAGS += -g
endif

83
ifeq (@enable_profiling@,yes)
84 85 86
OFLAGS += -g -p
endif

87 88
# external libraries common to all binaries

89
EXTOBJS =
Andrei Paskevich's avatar
Andrei Paskevich committed
90
EXTLIBS = str unix nums dynlink
91 92 93

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

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
95 96 97
###############
# main target
###############
98

99 100 101 102
all: @OCAMLBEST@
plugins: plugins.@OCAMLBEST@
opt: plugins.opt
byte: plugins.byte
Francois Bobot's avatar
Francois Bobot committed
103

104 105 106 107 108
ifeq (@enable_local@,yes)
all: install_local
endif

.PHONY: byte opt clean depend all install install_local install_no_local
109
.PHONY: plugins plugins.byte plugins.opt
110

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
111
#############
112
# Why library
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
113
#############
114

115
LIBGENERATED = src/util/rc.ml src/parser/lexer.ml \
116 117
	       src/parser/parser.mli src/parser/parser.ml \
	       src/driver/driver_parser.mli src/driver/driver_parser.ml \
118
	       src/driver/driver_lexer.ml src/session/xml.ml
119

Andrei Paskevich's avatar
Andrei Paskevich committed
120
LIB_UTIL = stdlib exn_printer pp debug loc print_tree \
121
	   cmdline hashweak hashcons util warning sysutil rc plugin
122

123
LIB_CORE = ident ty term pattern decl theory task pretty env trans printer
124

125
LIB_PARSER = ptree denv glob parser typing lexer
126

127
LIB_DRIVER = call_provers driver_ast driver_parser driver_lexer driver \
128
	     whyconf autodetection
129

130
LIB_TRANSFORM = simplify_recursive_definition simplify_formula \
Leon Gondelman's avatar
Leon Gondelman committed
131
		inlining split_goal induction \
132
		eliminate_definition eliminate_algebraic \
133
		eliminate_inductive eliminate_let eliminate_if \
134
		libencoding discriminate protect_finite \
135
		encoding encoding_select \
136
		encoding_decorate encoding_decoexp encoding_twin \
137
		encoding_explicit encoding_guard encoding_sort \
138
		encoding_instantiate simplify_array filter_trigger \
139
		introduction abstraction close_epsilon lift_epsilon \
140
		eval_match instantiate_predicate smoke_detector
141

Andrei Paskevich's avatar
Andrei Paskevich committed
142 143
LIB_PRINTER = print_number alt_ergo why3printer smtv1 smtv2 coq pvs \
		simplify gappa cvc3 yices
144

François Bobot's avatar
François Bobot committed
145 146
LIB_SESSION = xml termcode session session_tools session_scheduler

147
LIBMODULES = src/config \
148 149 150 151 152
	      $(addprefix src/util/, $(LIB_UTIL)) \
	      $(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
153 154
	      $(addprefix src/printer/, $(LIB_PRINTER)) \
	      $(addprefix src/session/, $(LIB_SESSION))
155

François Bobot's avatar
François Bobot committed
156
LIBDIRS = util core parser driver transform printer session
157
LIBINCLUDES = $(addprefix -I src/, $(LIBDIRS))
MARCHE Claude's avatar
MARCHE Claude committed
158

159
LIBDEP = $(addsuffix .dep, $(LIBMODULES))
160 161
LIBCMO = $(addsuffix .cmo, $(LIBMODULES))
LIBCMX = $(addsuffix .cmx, $(LIBMODULES))
162

163
$(LIBDEP): DEPFLAGS += $(LIBINCLUDES)
164
$(LIBCMO) $(LIBCMX): INCLUDES += $(LIBINCLUDES)
165
$(LIBCMX): OFLAGS += -for-pack Why3
166

167 168
$(LIBDEP): $(LIBGENERATED)

169
# build targets
170

171 172
byte: src/why3.cma
opt:  src/why3.cmxa
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
173

174
src/why3.cma: src/why3.cmo
Andrei Paskevich's avatar
Andrei Paskevich committed
175 176
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) -a $(BFLAGS) -o $@ $^
177

178
src/why3.cmxa: src/why3.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
179 180
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLOPT) -a $(OFLAGS) -o $@ $^
181

182
src/why3.cmo: $(LIBCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
183 184
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $^
185

186
src/why3.cmx: $(LIBCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
187 188
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLOPT) $(OFLAGS) -pack -o $@ $^
189

190
# clean and depend
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
191

192 193 194
ifneq "$(MAKECMDGOALS)" "clean"
include $(LIBDEP)
endif
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
195

196
depend: $(LIBDEP)
197

Andrei Paskevich's avatar
Andrei Paskevich committed
198
LIBSDIRS = src $(addprefix src/, $(LIBDIRS))
199 200
LIBCLEAN = $(addsuffix /*.cm[iox], $(LIBSDIRS)) \
	   $(addsuffix /*.annot, $(LIBSDIRS)) \
201 202
	   $(addsuffix /*.output, $(LIBSDIRS)) \
	   $(addsuffix /*.automaton, $(LIBSDIRS)) \
203
	   $(addsuffix /*.dep, $(LIBSDIRS)) \
204 205 206 207 208
	   $(addsuffix /*.o, $(LIBSDIRS)) \
	   $(addsuffix /*~, $(LIBSDIRS))

clean::
	rm -f $(LIBCLEAN) $(LIBGENERATED)
209
	rm -f src/why3.cm[aiox] src/why3.[ao] src/why3.cmxa
210

211 212 213
###############
# installation
###############
214

215
install_no_local::
216
	mkdir -p $(BINDIR)
217 218
	rm -rf $(DATADIR)/why3
	mkdir -p $(DATADIR)/why3
219
	mkdir -p $(DATADIR)/why3/images
220 221
	mkdir -p $(DATADIR)/why3/images/boomy
	mkdir -p $(DATADIR)/why3/images/fatcow
MARCHE Claude's avatar
MARCHE Claude committed
222
	mkdir -p $(DATADIR)/why3/emacs
223
	mkdir -p $(DATADIR)/why3/lang
224
	mkdir -p $(DATADIR)/why3/theories
225
	mkdir -p $(DATADIR)/why3/modules
226 227
	mkdir -p $(DATADIR)/why3/drivers
	cp -f theories/*.why $(DATADIR)/why3/theories
228
	cp -f modules/*.mlw $(DATADIR)/why3/modules
229
	cp -f drivers/*.drv drivers/*.gen $(DATADIR)/why3/drivers
230
	cp -f share/provers-detection-data.conf $(DATADIR)/why3/
231
	cp -f share/images/icons.rc $(DATADIR)/why3/images
232
	cp -f share/images/*.png $(DATADIR)/why3/images
233 234
	cp -f share/images/boomy/*.png $(DATADIR)/why3/images/boomy
	cp -f share/images/fatcow/*.png $(DATADIR)/why3/images/fatcow
235
	cp -f share/why3session.dtd $(DATADIR)/why3
236
	cp -rf share/javascript $(DATADIR)/why3/javascript
MARCHE Claude's avatar
MARCHE Claude committed
237
	cp -f share/emacs/why.el $(DATADIR)/why3/emacs/why.el
238
	cp -f share/lang/why.lang $(DATADIR)/why3/lang/why.lang
239
#	if test -d /etc/bash_completion.d; then cp -f share/bash/why3 /etc/bash_completion.d; fi
240

MARCHE Claude's avatar
MARCHE Claude committed
241
install_no_local_lib::
242
	rm -rf $(OCAMLLIB)/why3
MARCHE Claude's avatar
MARCHE Claude committed
243
	mkdir -p $(OCAMLLIB)/why3
244
	cp -f src/why3.cm* $(OCAMLLIB)/why3
245
	cp -f META $(OCAMLLIB)/why3
246
	if test -f src/why3.a; then cp -f src/why3.a $(OCAMLLIB)/why3; fi
MARCHE Claude's avatar
MARCHE Claude committed
247
	if test -f src/why3.o; then cp -f src/why3.o $(OCAMLLIB)/why3; fi
MARCHE Claude's avatar
MARCHE Claude committed
248

249 250 251 252 253
ifeq (@enable_local@,yes)
install install-lib:
	@echo "Why is configured in local installation mode."
	@echo "To install Why, run ./configure --disable-local ; make ; make install"
else
254
install: install_no_local
MARCHE Claude's avatar
MARCHE Claude committed
255
install-lib: install_no_local_lib
256 257
endif

MARCHE Claude's avatar
MARCHE Claude committed
258 259
install-all: install install-lib

260 261 262 263
##################
# Why plugins
##################

Andrei Paskevich's avatar
Andrei Paskevich committed
264 265
PLUGGENERATED = plugins/tptp/tptp_lexer.ml \
		plugins/tptp/tptp_parser.ml plugins/tptp/tptp_parser.mli
266 267

PLUG_PARSER = genequlin
268
PLUG_PRINTER =
269
PLUG_TRANSFORM =
270
PLUG_TPTP = tptp_ast tptp_parser tptp_typing tptp_lexer tptp_printer
271

272
PLUGINS = genequlin tptp
273

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

276 277
TPTPCMO = $(addsuffix .cmo, $(TPTPMODULES))
TPTPCMX = $(addsuffix .cmx, $(TPTPMODULES))
278

279 280 281 282 283 284 285 286 287 288
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

289 290
PLUGMODULES = $(addprefix plugins/parser/, $(PLUG_PARSER)) \
	      $(addprefix plugins/printer/, $(PLUG_PRINTER)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
291
	      $(addprefix plugins/transform/, $(PLUG_TRANSFORM)) \
292
	      $(TPTPMODULES)
293

294
PLUGDEP = $(addsuffix .dep, $(PLUGMODULES))
295 296 297
PLUGCMO = $(addsuffix .cmo, $(PLUGMODULES))
PLUGCMX = $(addsuffix .cmx, $(PLUGMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
298
PLUGDIRS = parser printer transform tptp
299 300
PLUGINCLUDES = $(addprefix -I plugins/, $(PLUGDIRS))

301
$(PLUGDEP): DEPFLAGS += $(PLUGINCLUDES)
302 303
$(PLUGCMO) $(PLUGCMX): INCLUDES += $(PLUGINCLUDES)

304 305
$(PLUGDEP): $(PLUGGENERATED)

306 307 308 309 310
LIBPLUGCMO =  $(addsuffix .cmo,  $(addprefix lib/plugins/, $(PLUGINS)))
LIBPLUGCMXS = $(addsuffix .cmxs, $(addprefix lib/plugins/, $(PLUGINS)))

plugins.byte: $(LIBPLUGCMO)
plugins.opt : $(LIBPLUGCMXS)
311 312

lib/plugins/%.cmxs: plugins/parser/%.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
313
	$(if $(QUIET),@echo 'Linking  $@' &&) \
314 315 316 317 318 319 320
	    $(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
321
	$(if $(QUIET),@echo 'Linking  $@' &&) \
322 323 324 325 326 327 328
	    $(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
329
	$(if $(QUIET),@echo 'Linking  $@' &&) \
330 331 332 333 334 335
	    $(OCAMLOPT) $(OFLAGS) -shared -o $@ $<

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

336
lib/plugins/tptp.cmxs: $(TPTPCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
337
	$(if $(QUIET),@echo 'Linking  $@' &&) \
338
	    $(OCAMLOPT) $(OFLAGS) -shared -o $@ $^
339

340
lib/plugins/tptp.cmo: $(TPTPCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
341
	$(if $(QUIET),@echo 'Linking  $@' &&) \
342
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $^
343 344 345 346 347 348

PLUGSDIRS = plugins $(addprefix plugins/, $(PLUGDIRS))
PLUGCLEAN = $(addsuffix /*.cm[iox], $(PLUGSDIRS)) \
	    $(addsuffix /*.annot, $(PLUGSDIRS)) \
	    $(addsuffix /*.output, $(PLUGSDIRS)) \
	    $(addsuffix /*.automaton, $(PLUGSDIRS)) \
349
	    $(addsuffix /*.dep, $(PLUGSDIRS)) \
350 351 352
	    $(addsuffix /*.o, $(PLUGSDIRS)) \
	    $(addsuffix /*~, $(PLUGSDIRS))

353 354 355 356 357 358
# depend and clean targets

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

359
depend: $(PLUGDEP)
360

361 362 363 364 365 366
clean::
	rm -f $(PLUGCLEAN) $(PLUGGENERATED)
	rm -f lib/plugins/*

install_no_local::
	mkdir -p $(LIBDIR)/why3/plugins
367
	cp -f $(foreach f,$(LIBPLUGCMO) $(LIBPLUGCMXS),$(wildcard $(f))) $(LIBDIR)/why3/plugins
368

369

370 371 372
########
# Whyml (old API)
########
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
373

374
PGM_FILES = pgm_ttree pgm_types pgm_pretty \
375
	    pgm_module pgm_wp pgm_typing pgm_main
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
376

377
PGMMODULES = $(addprefix src/programs/, $(PGM_FILES))
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
378

379 380 381
PGMDEP = $(addsuffix .dep, $(PGMMODULES))
PGMCMO = $(addsuffix .cmo, $(PGMMODULES))
PGMCMX = $(addsuffix .cmx, $(PGMMODULES))
382

383 384
$(PGMDEP): DEPFLAGS += -I src/programs
$(PGMCMO) $(PGMCMX): INCLUDES += -I src/programs
385

386
# depend and clean targets
387

388 389 390
ifneq "$(MAKECMDGOALS)" "clean"
include $(PGMDEP)
endif
391

392
depend: $(PGMDEP)
393

394 395 396
clean::
	rm -f src/programs/*.cm[iox] src/programs/*.o
	rm -f src/programs/*.annot src/programs/*.dep src/programs/*~
397

398 399 400 401
########
# Whyml (new API)
########

402
MLW_FILES = mlw_ty mlw_expr mlw_decl mlw_pretty mlw_wp mlw_module \
403
	    mlw_dtree mlw_dty mlw_typing mlw_driver mlw_ocaml mlw_main
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425

MLWMODULES = $(addprefix src/whyml/, $(MLW_FILES))

MLWDEP = $(addsuffix .dep, $(MLWMODULES))
MLWCMO = $(addsuffix .cmo, $(MLWMODULES))
MLWCMX = $(addsuffix .cmx, $(MLWMODULES))

$(MLWDEP): DEPFLAGS += -I src/whyml
$(MLWCMO) $(MLWCMX): INCLUDES += -I src/whyml

# depend and clean targets

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

depend: $(MLWDEP)

clean::
	rm -f src/whyml/*.cm[iox] src/whyml/*.o
	rm -f src/whyml/*.annot src/whyml/*.dep src/whyml/*~

426 427 428
######
# Why3
######
429

430 431
src/main.cmo: src/why3.cma
src/main.cmx: src/why3.cmxa
432

433 434 435
src/main.cmo src/main.cmx: INCLUDES += -I src/whyml
src/main.dep: DEPFLAGS += -I src/whyml

436 437
byte: bin/why3.byte
opt:  bin/why3.opt
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
438

439
bin/why3.opt: src/why3.cmxa $(PGMCMX) $(MLWCMX) src/main.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
440
	$(if $(QUIET),@echo 'Linking  $@' &&) \
441
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
442

443
bin/why3.byte: src/why3.cma $(PGMCMO) $(MLWCMO) src/main.cmo
444
	$(if $(QUIET),@echo 'Linking  $@' &&) \
445
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
446

447 448
bin/why3: bin/why3.@OCAMLBEST@
	ln -sf why3.@OCAMLBEST@ $@
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
449

450 451
install_no_local::
	cp -f bin/why3.@OCAMLBEST@ $(BINDIR)/why3$(EXE)
452

453
install_local: bin/why3
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
454

455 456 457 458 459 460
ifneq "$(MAKECMDGOALS)" "clean"
include src/main.dep
endif

depend: src/main.dep

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
461
clean::
462 463
	rm -f src/main.cm[iox] src/main.annot src/main.o
	rm -f bin/why3.byte bin/why3.opt bin/why3
464
	rm -f bin/why3ml.byte bin/why3ml.opt bin/why3ml
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
465

466 467 468
##############
# test targets
##############
469

470 471
%.gui: %.why bin/why3ide.opt
	bin/why3ide.opt $*.why
472

473 474
%: %.mlw bin/why3.opt
	bin/why3.opt $*.mlw
475

476 477
%: %.why bin/why3.opt
	bin/why3.opt $*.why
François Bobot's avatar
François Bobot committed
478

479 480
%.gui: %.mlw bin/why3ide.opt
	bin/why3ide.opt $*.mlw
481

482
%.type: %.mlw bin/why3ide.opt
483
	bin/why3.opt --type-only $*.mlw
484

485 486 487 488
##########
# gallery
##########

489
# we export exactly the programs that have a why3session.xml file
490 491 492

.PHONY: gallery

493 494
gallery::
	@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
495 496 497
	@for x in `find examples/programs/ -name why3session.xml`; do \
	  d=`dirname $$x`; \
	  f=`basename $$d`; \
498 499 500
	  echo "exporting $$f"; \
	  mkdir -p $(GALLERYDIR)/$$f; \
	  cp examples/programs/$$f.mlw $(GALLERYDIR)/$$f/; \
501 502 503 504
	  rm -f $(GALLERYDIR)/$$f/$$f.zip; \
	  cd examples/programs/; \
	  zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f; \
	  cd ../..; \
505
	done
506

MARCHE Claude's avatar
MARCHE Claude committed
507 508 509 510 511 512 513 514
########
# XML DTD validation
########

.PHONY: xml-validate

xml-validate:
	@for x in `find examples/ -name why3session.xml`; do \
MARCHE Claude's avatar
MARCHE Claude committed
515 516
	  xmllint --noout --dtdvalid share/why3session.dtd \
			$$x 2>&1 | head -1; \
MARCHE Claude's avatar
MARCHE Claude committed
517 518
	done

519 520 521 522 523 524 525 526
########
# Config
########

CONFIG_FILES = whyconfig

CONFIGMODULES = $(addprefix src/config/, $(CONFIG_FILES))

527
CONFIGDEP = $(addsuffix .dep, $(CONFIGMODULES))
528 529 530
CONFIGCMO = $(addsuffix .cmo, $(CONFIGMODULES))
CONFIGCMX = $(addsuffix .cmx, $(CONFIGMODULES))

531
$(CONFIGDEP): DEPFLAGS += -I src/programs
532 533 534 535
$(CONFIGCMO) $(CONFIGCMX): INCLUDES += -I src/programs

# build targets

536 537
byte: bin/why3config.byte
opt:  bin/why3config.opt
538

539
bin/why3config.opt: src/why3.cmxa $(CONFIGCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
540
	$(if $(QUIET),@echo 'Linking  $@' &&) \
541
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
542

543
bin/why3config.byte: src/why3.cma $(CONFIGCMO)
544
	$(if $(QUIET),@echo 'Linking  $@' &&) \
545
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
546

547 548 549
bin/why3config: bin/why3config.@OCAMLBEST@
	ln -sf why3config.@OCAMLBEST@ $@

550 551
# depend and clean targets

552 553 554
ifneq "$(MAKECMDGOALS)" "clean"
include $(CONFIGDEP)
endif
555

556
depend: $(CONFIGDEP)
557 558 559

clean::
	rm -f src/config/*.cm[iox] src/config/*.o
560
	rm -f src/config/*.annot src/config/*.dep src/config/*~
561
	rm -f src/config/*.output src/config/*.automaton
562
	rm -f bin/why3config.byte bin/why3config.opt bin/why3config
563

564 565
local_config: bin/why3config.@OCAMLBEST@
	WHY3LIB=$(PWD) WHY3DATA=$(PWD)/share bin/why3config.@OCAMLBEST@ \
566
		--detect --conf_file why.conf
567

568
install_no_local::
569
	cp -f bin/why3config.@OCAMLBEST@ $(BINDIR)/why3config$(EXE)
570

571
install_local: bin/why3config
572

MARCHE Claude's avatar
MARCHE Claude committed
573 574 575 576
###############
# IDE
###############

577 578
ifeq (@enable_ide@,yes)

François Bobot's avatar
François Bobot committed
579
IDE_FILES = gconfig gmain
MARCHE Claude's avatar
MARCHE Claude committed
580 581 582

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

583
IDEDEP = $(addsuffix .dep, $(IDEMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
584 585 586
IDECMO = $(addsuffix .cmo, $(IDEMODULES))
IDECMX = $(addsuffix .cmx, $(IDEMODULES))

587
$(IDEDEP): DEPFLAGS += -I src/ide
588
$(IDECMO) $(IDECMX): INCLUDES += -I src/ide
MARCHE Claude's avatar
MARCHE Claude committed
589

590
# build targets
MARCHE Claude's avatar
MARCHE Claude committed
591

592 593
byte: bin/why3ide.byte
opt:  bin/why3ide.opt
MARCHE Claude's avatar
MARCHE Claude committed
594

595
bin/why3ide.opt bin/why3ide.byte: INCLUDES += -I @LABLGTK2LIB@
596
bin/why3ide.opt bin/why3ide.byte: EXTLIBS += lablgtk lablgtksourceview2
MARCHE Claude's avatar
MARCHE Claude committed
597

598
bin/why3ide.opt: src/why3.cmxa $(PGMCMX) $(MLWCMX) $(IDECMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
599
	$(if $(QUIET),@echo 'Linking  $@' &&) \
600
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
601

602
bin/why3ide.byte: src/why3.cma $(PGMCMO) $(MLWCMO) $(IDECMO)
MARCHE Claude's avatar
MARCHE Claude committed
603
	$(if $(QUIET),@echo 'Linking  $@' &&) \
604
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
605

606 607 608
bin/why3ide: bin/why3ide.@OCAMLBEST@
	ln -sf why3ide.@OCAMLBEST@ $@

MARCHE Claude's avatar
MARCHE Claude committed
609 610
# depend and clean targets

611 612 613
ifneq "$(MAKECMDGOALS)" "clean"
include $(IDEDEP)
endif
MARCHE Claude's avatar
MARCHE Claude committed
614

615
depend: $(IDEDEP)
MARCHE Claude's avatar
MARCHE Claude committed
616 617

clean::
618
	rm -f src/ide/xml.ml
MARCHE Claude's avatar
MARCHE Claude committed
619
	rm -f src/ide/*.cm[iox] src/ide/*.o
620
	rm -f src/ide/*.annot src/ide/*.dep src/ide/*~
621
	rm -f bin/why3ide.byte bin/why3ide.opt bin/why3ide
MARCHE Claude's avatar
MARCHE Claude committed
622

623
install_no_local::
624
	cp -f bin/why3ide.@OCAMLBEST@ $(BINDIR)/why3ide$(EXE)
625 626

install_local: bin/why3ide
627

628
endif
MARCHE Claude's avatar
d  
MARCHE Claude committed
629

630

MARCHE Claude's avatar
MARCHE Claude committed
631 632 633 634
###############
# Replayer
###############

François Bobot's avatar
François Bobot committed
635
REPLAYER_FILES = replay
MARCHE Claude's avatar
MARCHE Claude committed
636 637 638

REPLAYERMODULES = $(addprefix src/ide/, $(REPLAYER_FILES))

639
REPLAYERDEP = $(addsuffix .dep, $(REPLAYERMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
640 641 642
REPLAYERCMO = $(addsuffix .cmo, $(REPLAYERMODULES))
REPLAYERCMX = $(addsuffix .cmx, $(REPLAYERMODULES))

643
$(REPLAYERDEP): DEPFLAGS += -I src/ide
644
$(REPLAYERCMO) $(REPLAYERCMX): INCLUDES += -I src/ide
MARCHE Claude's avatar
MARCHE Claude committed
645 646 647 648 649 650

# build targets

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

651
bin/why3replayer.opt: src/why3.cmxa $(PGMCMX) $(MLWCMX) $(REPLAYERCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
652
	$(if $(QUIET),@echo 'Linking  $@' &&) \
653
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
654

655
bin/why3replayer.byte: src/why3.cma $(PGMCMO) $(MLWCMO) $(REPLAYERCMO)
MARCHE Claude's avatar
MARCHE Claude committed
656
	$(if $(QUIET),@echo 'Linking  $@' &&) \
657
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
658 659 660 661 662 663

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

# depend and clean targets

664 665 666
ifneq "$(MAKECMDGOALS)" "clean"
include $(REPLAYERDEP)
endif
MARCHE Claude's avatar
MARCHE Claude committed
667

668
depend: $(REPLAYERDEP)
MARCHE Claude's avatar
MARCHE Claude committed
669 670 671 672 673

clean::
	rm -f bin/why3replayer.byte bin/why3replayer.opt bin/why3replayer

install_no_local::
674
	cp -f bin/why3replayer.@OCAMLBEST@ $(BINDIR)/why3replayer$(EXE)
MARCHE Claude's avatar
MARCHE Claude committed
675 676 677

install_local: bin/why3replayer

678 679 680 681 682

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

683
SESSION_FILES = why3session_lib why3session_copy why3session_info \
684 685
		why3session_latex why3session_html why3session_rm \
		why3session
686 687 688

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

689
SESSIONDEP = $(addsuffix .dep, $(SESSIONMODULES))
690 691 692
SESSIONCMO = $(addsuffix .cmo, $(SESSIONMODULES))
SESSIONCMX = $(addsuffix .cmx, $(SESSIONMODULES))

693
$(SESSIONDEP): DEPFLAGS += -I src/why3session
694 695 696 697 698 699 700
$(SESSIONCMO) $(SESSIONCMX): INCLUDES += -I src/why3session

# build targets

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

701
bin/why3session.opt: src/why3.cmxa $(PGMCMX) $(MLWCMX) $(SESSIONCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
702
	$(if $(QUIET),@echo 'Linking  $@' &&) \
703
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
704

705
bin/why3session.byte: src/why3.cma $(PGMCMO) $(MLWCMO) $(SESSIONCMO)
706
	$(if $(QUIET),@echo 'Linking  $@' &&) \
707
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
708 709 710 711 712 713

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

# depend and clean targets

714 715 716
ifneq "$(MAKECMDGOALS)" "clean"
include $(SESSIONDEP)
endif
717

718
depend: $(SESSIONDEP)
719 720

clean::
721 722
	rm -f src/why3session/*.cm[iox] src/why3session/*.o
	rm -f src/why3session/*.annot src/why3session/*.dep src/why3session/*~
723 724 725 726 727 728 729
	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
730

731
###############
732
# Bench
733 734
###############

735 736
ifeq (@enable_bench@,yes)

737
BENCH_FILES = worker db bench benchrc benchdb whybench
738 739 740

BENCHMODULES := $(addprefix src/bench/, $(BENCH_FILES))

741
BENCHDEP = $(addsuffix .dep, $(BENCHMODULES))
742 743 744
BENCHCMO = $(addsuffix .cmo, $(BENCHMODULES))
BENCHCMX = $(addsuffix .cmx, $(BENCHMODULES))

745
$(BENCHDEP): DEPFLAGS += -I src/bench
746
$(BENCHCMO) $(BENCHCMX): INCLUDES += -I src/bench -I @SQLITE3LIB@
747 748 749

# build targets

750 751
byte: bin/why3bench.byte
opt:  bin/why3bench.opt
752

753
bin/why3bench.opt bin/why3bench.byte: INCLUDES += -thread -I +threads -I @SQLITE3LIB@
754
bin/why3bench.opt bin/why3bench.byte: EXTLIBS += threads sqlite3
755

756
bin/why3bench.opt: src/why3.cmxa $(PGMCMX) $(MLWCMX) $(BENCHCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
757
	$(if $(QUIET),@echo 'Linking  $@' &&) \
758
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
759

760
bin/why3bench.byte: src/why3.cma  $(PGMCMO) $(MLWCMO) $(BENCHCMO)
761
	$(if $(QUIET),@echo 'Linking  $@' &&) \
762
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
763

764 765 766
bin/why3bench: bin/why3bench.@OCAMLBEST@
	ln -sf why3bench.@OCAMLBEST@ $@

767 768
# depend and clean targets

769 770 771
ifneq "$(MAKECMDGOALS)" "clean"
include $(BENCHDEP)
endif
772

773
depend: $(BENCHDEP)
774 775 776

clean::
	rm -f src/bench/*.cm[iox] src/bench/*.o
777
	rm -f src/bench/*.annot src/bench/*.dep src/bench/*~
778
	rm -f bin/why3bench.byte bin/why3bench.opt bin/why3bench
779 780

install_no_local::
781
	cp -f bin/why3bench.@OCAMLBEST@ $(BINDIR)/why3bench$(EXE)
782 783

install_local: bin/why3bench
784

785 786
endif

787 788 789
##############
# Coq plugin
##############
790

791
ifeq (@enable_coq_plugin@,yes)
792

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

Claude Marche's avatar
Claude Marche committed
795
COQP_FILES = coqCompat why3tac g_why3tac
796

797
COQPMODULES = $(addprefix src/coq-tactic/, $(COQP_FILES))
798

799 800 801
COQPDEP = $(addsuffix .dep, $(COQPMODULES))
COQPCMO = $(addsuffix .cmo, $(COQPMODULES))
COQPCMX = $(addsuffix .cmx, $(COQPMODULES))
802

803
COQPTREES = kernel lib interp parsing proofs pretyping tactics library toplevel
804
COQPINCLUDES = -I src/coq-tactic $(addprefix -I @COQLIB@/, $(COQPTREES))
805

806
$(COQPDEP): DEPFLAGS += -I src/coq-tactic
807
$(COQPCMO) $(COQPCMX): INCLUDES += $(COQPINCLUDES)
808

809
$(COQPDEP): $(COQPGENERATED)
810

811 812
byte: src/coq-tactic/.why3-vo-byte
opt:  src/coq-tactic/.why3-vo-opt
813

814 815
src/coq-tactic/coqCompat.cmi: BFLAGS+=-rectypes 
src/coq-tactic/coqCompat.cmo: BFLAGS+=-rectypes 
Claude Marche's avatar
Claude Marche committed
816
src/coq-tactic/coqCompat.cmx: OFLAGS+=-rectypes 
817 818 819 820
src/coq-tactic/why3tac.cmi: BFLAGS+=-rectypes -I +camlp5
src/coq-tactic/why3tac.cmo: BFLAGS+=-rectypes -I +camlp5
src/coq-tactic/why3tac.cmx: OFLAGS+=-rectypes -I +camlp5
lib/coq-tactic/why3tac.cma: BFLAGS+=-rectypes -I +camlp5
821
lib/coq-tactic/why3tac.cmxs: OFLAGS+=-rectypes -I +camlp5
822

823
lib/coq-tactic/why3tac.cmxs: src/why3.cmxa $(COQPCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
824 825
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLOPT) $(OFLAGS) -o $@ -shared $^
826

827
lib/coq-tactic/why3tac.cma: src/why3.cma $(COQPCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
828 829
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) -a $(BFLAGS) -o $@ $^
830

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

835
src/coq-tactic/.why3-vo-byte: lib/coq-tactic/Why3.v lib/coq-tactic/why3tac.cma
Andrei Paskevich's avatar
Andrei Paskevich committed
836
	$(if $(QUIET),@echo 'Coqc     $<' &&) \
837
	    WHY3CONFIG="" $(COQC) -byte -I lib/coq-tactic/ $< && \
838
	    touch src/coq-tactic/.why3-vo-byte
839

840
src/coq-tactic/.why3-vo-opt: lib/coq-tactic/Why3.v lib/coq-tactic/why3tac.cmxs
Andrei Paskevich's avatar
Andrei Paskevich committed
841
	$(if $(QUIET),@echo 'Coqc     $<' &&) \
842
	    WHY3CONFIG="" $(COQC) -opt -I lib/coq-tactic/ $< && \
843
	    touch src/coq-tactic/.why3-vo-opt
844

845 846 847 848 849 850
test-coq-tactic.byte: src/coq-tactic/.why3-vo-byte
	$(COQC) -byte -I lib/coq-tactic/ src/coq-tactic/test.v

test-coq-tactic.opt: src/coq-tactic/.why3-vo-opt
	$(COQC) -opt -I lib/coq-tactic/ src/coq-tactic/test.v

851
# depend and clean targets
Andrei Paskevich's avatar
Andrei Paskevich committed
852

853
ifneq "$(MAKECMDGOALS)" "clean"
854
include $(COQPDEP)
855
endif
856

857
depend: $(COQPDEP)
858 859

clean::
860 861 862 863 864
	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-*
865
	rm -f $(COQPGENERATED)
866

867
install_no_local::
868 869
	mkdir -p $(LIBDIR)/why3/coq-tactic
	cp -f lib/coq-tactic/* $(LIBDIR)/why3/coq-tactic
870

871 872 873 874 875 876 877 878
endif

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

ifeq (@enable_coq_libs@,yes)

879
COQLIBS_INT_FILES = Abs ComputerDivision Div2 EuclideanDivision Int MinMax Power
880 881
COQLIBS_INT_ALL_FILES = Exponentiation $(COQLIBS_INT_FILES)
COQLIBS_INT = $(addprefix lib/coq/int/, $(COQLIBS_INT_ALL_FILES))
882

883
COQLIBS_REAL_FILES = Abs ExpLog FromInt MinMax PowerInt Real Square RealInfix
884 885
COQLIBS_REAL = $(addprefix lib/coq/real/, $(COQLIBS_REAL_FILES))

886
COQLIBS_NUMBER_FILES = Divisibility Gcd Parity Prime
887 888
COQLIBS_NUMBER = $(addprefix lib/coq/number/, $(COQLIBS_NUMBER_FILES))

889 890 891
COQLIBS_SET_FILES = Set
COQLIBS_SET = $(addprefix lib/coq/set/, $(COQLIBS_SET_FILES))

892
COQLIBS_SETTHEORY_FILES = Interval PowerSet Relation Identity Image \
893
	InverseDomRan Function 
894 895
COQLIBS_SETTHEORY = $(addprefix lib/coq/settheory/, $(COQLIBS_SETTHEORY_FILES))

896
ifeq (@enable_coq_fp_libs@,yes)
897
COQLIBS_FP_FILES = Rounding SingleFormat Single DoubleFormat Double
898 899 900
COQLIBS_FP_ALL_FILES = GenFloat $(COQLIBS_FP_FILES)
COQLIBS_FP = $(addprefix lib/coq/floating_point/, $(COQLIBS_FP_ALL_FILES))
endif
901

902
COQLIBS_FILES = lib/coq/BuiltIn $(COQLIBS_INT) $(COQLIBS_REAL) $(COQLIBS_NUMBER) $(COQLIBS_SET) $(COQLIBS_SETTHEORY) $(COQLIBS_FP)
903 904 905

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

%.vo: %.v
Andrei Paskevich's avatar
Andrei Paskevich committed
909 910
	$(if $(QUIET),@echo 'Coqc     $<' &&) \
	    $(COQC) -R lib/coq Why3 $<
911 912

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

916 917 918
drivers/coq-realizations.aux: Makefile
	$(if $(QUIET),@echo 'Generate $@' &&) \
	(echo "(* generated automatically at compilation time *)"; \
919
	echo 'theory BuiltIn meta "realized" "BuiltIn", "" end'; \
Andrei Paskevich's avatar
Andrei Paskevich committed
920 921 922 923
	for f in $(COQLIBS_INT_FILES); do \
	echo 'theory int.'"$$f"' meta "realized" "int.'"$$f"'", "" end'; done; \
	for f in $(COQLIBS_REAL_FILES); do \
	echo 'theory real.'"$$f"' meta "realized" "real.'"$$f"'", "" end'; done; \
924 925
	for f in $(COQLIBS_NUMBER_FILES); do \
	echo 'theory number.'"$$f"' meta "realized" "number.'"$$f"'", "" end'; done; \
926 927
	for f in $(COQLIBS_SET_FILES); do \
	echo 'theory set.'"$$f"' meta "realized" "set.'"$$f"'", "" end'; done; \
928 929
	for f in $(COQLIBS_SETTHEORY_FILES); do \
	echo 'theory settheory.'"$$f"' meta "realized" "settheory.'"$$f"'", "" end'; done; \
Andrei Paskevich's avatar
Andrei Paskevich committed
930 931
	for f in $(COQLIBS_FP_FILES); do \
	echo 'theory floating_point.'"$$f"' meta "realized" "floating_point.'"$$f"'", "" end'; done; \
932
	) > $@
933

934
opt byte: $(COQVO)
935 936 937

install_no_local::
	mkdir -p $(LIBDIR)/why3/coq
938
	mkdir -p $(LIBDIR)/why3/coq/int
939
	cp lib/coq/BuiltIn.vo $(LIBDIR)/why3/coq/
940
	cp $(addsuffix .vo, $(COQLIBS_INT)) $(LIBDIR)/why3/coq/int/
941
	mkdir -p $(LIBDIR)/why3/coq/real
942
	cp $(addsuffix .vo, $(COQLIBS_REAL)) $(LIBDIR)/why3/coq/real/
943 944
	mkdir -p $(LIBDIR)/why3/coq/number
	cp $(addsuffix .vo, $(COQLIBS_NUMBER)) $(LIBDIR)/why3/coq/number/
945 946
	mkdir -p $(LIBDIR)/why3/coq/set
	cp $(addsuffix .vo, $(COQLIBS_SET)) $(LIBDIR)/why3/coq/set/
947
	mkdir -p $(LIBDIR)/why3/coq/settheory
948
	cp $(addsuffix .vo, $(COQLIBS_SETTHEORY)) $(LIBDIR)/why3/coq/settheory/
949 950
ifeq (@enable_coq_fp_libs@,yes)
	mkdir -p $(LIBDIR)/why3/coq/floating_point
951
	cp $(addsuffix .vo, $(COQLIBS_FP)) $(LIBDIR)/why3/coq/floating_point/
952
endif
953
	cp drivers/coq-realizations.aux $(DATADIR)/why3/drivers/
954

955
install_local: $(COQVO) drivers/coq-realizations.aux
956

957
ifneq "$(MAKECMDGOALS)" "clean"
958
ifneq "$(MAKECMDGOALS)" "update-coq"
959
include $(COQVD)
960
endif
961
endif
962

963
depend: $(COQVD)
964 965

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

968
update-coq: bin/why3 drivers/coq-realizations.aux
969 970 971 972
	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
	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
	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
	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
973
	for f in $(COQLIBS_SETTHEORY_FILES); do WHY3CONFIG="" bin/why3.@OCAMLBEST@ --realize -L theories -D drivers/coq-realize.drv -T settheory.$$f -o lib/coq/settheory/; done
974
	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
975

976 977
else

978 979
drivers/coq-realizations.aux:
	echo "(* generated automatically at compilation time *)" > $@
980

981
endif
982

983 984 985 986 987
opt byte: drivers/coq-realizations.aux

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

Jean-Christophe's avatar
Jean-Christophe committed
988 989 990 991 992 993
####################
# PVS realizations
####################

ifeq (@enable_pvs_libs@,yes)

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

Jean-Christophe's avatar
Jean-Christophe committed
997 998 999
PVSLIBS_REAL_FILES = Abs FromInt MinMax Real Square ExpLog Trigonometry \
                     PowerInt
 # RealInfix
Jean-Christophe's avatar
Jean-Christophe committed
1000 1001
PVSLIBS_REAL = $(addprefix lib/pvs/real/, $(PVSLIBS_REAL_FILES))

1002
PVSLIBS_LIST_FILES =
1003
  # Nth
1004 1005
PVSLIBS_LIST = $(addprefix lib/pvs/int/, $(PVSLIBS_LIST_FILES))

Jean-Christophe's avatar
Jean-Christophe committed
1006
PVSLIBS_NUMBER_FILES = # Divisibility Gcd Parity Prime
Jean-Christophe's avatar
Jean-Christophe committed
1007 1008
PVSLIBS_NUMBER = $(addprefix lib/pvs/number/, $(PVSLIBS_NUMBER_FILES))

1009
ifeq (@enable_pvs_nasa_libs@,yes)
Jean-Christophe's avatar
Jean-Christophe committed
1010 1011 1012 1013 1014
PVSLIBS_FP_FILES = Rounding SingleFormat Single DoubleFormat Double
PVSLIBS_FP_ALL_FILES = GenFloat $(PVSLIBS_FP_FILES)
PVSLIBS_FP = $(addprefix lib/pvs/floating_point/, $(PVSLIBS_FP_ALL_FILES))
endif

1015 1016
PVSLIBS_FILES = $(PVSLIBS_INT) $(PVSLIBS_REAL) $(PVSLIBS_LIST) \
                $(PVSLIBS_NUMBER) $(PVSLIBS_FP)
Jean-Christophe's avatar
Jean-Christophe committed
1017 1018 1019 1020 1021 1022 1023 1024

drivers/pvs-realizations.aux: Makefile
	$(if $(QUIET),@echo 'Generate $@' &&) \
	(echo "(* generated automatically at compilation time *)"; \
	for f in $(PVSLIBS_INT_FILES); do \
	echo 'theory int.'"$$f"' meta "realized" "int.'"$$f"'", "" end'; done; \
	for f in $(PVSLIBS_REAL_FILES); do \
	echo 'theory real.'"$$f"' meta "realized" "real.'"$$f"'", "" end'; done; \
1025 1026
	for f in $(PVSLIBS_LIST_FILES); do \
	echo 'theory list.'"$$f"' meta "realized" "list.'"$$f"'", "" end'; done; \
Jean-Christophe's avatar
Jean-Christophe committed
1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037
	for f in $(PVSLIBS_NUMBER_FILES); do \
	echo 'theory number.'"$$f"' meta "realized" "number.'"$$f"'", "" end'; done; \
	for f in $(PVSLIBS_FP_FILES); do \
	echo 'theory floating_point.'"$$f"' meta "realized" "floating_point.'"$$f"'", "" end'; done; \
	) > $@

install_no_local::
	mkdir -p $(LIBDIR)/why3/pvs/int
	cp $(PVSLIBS_INT) $(LIBDIR)/why3/pvs/int/
	mkdir -p $(LIBDIR)/why3/pvs/real
	cp $(PVSLIBS_REAL) $(LIBDIR)/why3/pvs/real/
1038 1039
	mkdir -p $(LIBDIR)/why3/pvs/list
	cp $(PVSLIBS_LIST) $(LIBDIR)/why3/pvs/list/
Jean-Christophe's avatar
Jean-Christophe committed
1040 1041
	mkdir -p $(LIBDIR)/why3/pvs/number
	cp $(PVSLIBS_NUMBER) $(LIBDIR)/why3/pvs/number/
1042
ifeq (@enable_pvs_nasa_libs@,yes)
Jean-Christophe's avatar
Jean-Christophe committed
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052
	mkdir -p $(LIBDIR)/why3/pvs/floating_point/
	cp $(PVSLIBS_FP) $(LIBDIR)/why3/pvs/
endif
	cp drivers/pvs-realizations.aux $(DATADIR)/why3/drivers/

install_local: drivers/pvs-realizations.aux

update-pvs: bin/why3 drivers/pvs-realizations.aux
	for f in $(PVSLIBS_INT_FILES); do bin/why3 --realize -D drivers/pvs-realize.drv -T int.$$f -o lib/pvs/int/; done
	for f in $(PVSLIBS_REAL_FILES); do bin/why3 --realize -D drivers/pvs-realize.drv -T real.$$f -o lib/pvs/real/; done
1053
	for f in $(PVSLIBS_LIST_FILES); do bin/why3 --realize -D drivers/pvs-realize.drv -T list.$$f -o lib/pvs/list/; done
Jean-Christophe's avatar
Jean-Christophe committed
1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068
	for f in $(PVSLIBS_NUMBER_FILES); do bin/why3 --realize -D drivers/pvs-realize.drv -T number.$$f -o lib/pvs/number/; done
	for f in $(PVSLIBS_FP_FILES); do bin/why3 --realize -D drivers/pvs-realize.drv -T floating_point.$$f -o lib/pvs/floating_point/; done

else

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

endif

opt byte: drivers/pvs-realizations.aux

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

1069 1070 1071 1072
#######
# tools
#######

1073
TOOLS = bin/why3-cpulimit$(EXE)
1074 1075 1076

byte opt: $(TOOLS)

1077
bin/why3-cpulimit$(EXE): src/tools/@CPULIMIT@.c
1078
	$(CC) -Wall -o $@ $^
1079 1080

clean::
1081
	rm -f bin/why3-cpulimit$(EXE) src/tools/*~
1082

1083
install_no_local::
1084
	cp -f bin/why3-cpulimit$(EXE) $(BINDIR)/why3-cpulimit$(EXE)
1085

1086 1087 1088 1089
#########
# why3doc
#########