Makefile.in 65.5 KB
Newer Older
Andrei Paskevich's avatar
Andrei Paskevich committed
1 2 3
####################################################################
#                                                                  #
#  The Why3 Verification Platform   /   The Why3 Development Team  #
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
4
#  Copyright 2010-2014   --   INRIA - CNRS - Paris-Sud University  #
Andrei Paskevich's avatar
Andrei Paskevich committed
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.                           #
#                                                                  #
####################################################################
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
11

12 13 14 15 16 17
VERBOSEMAKE ?= @enable_verbose_make@

ifeq ($(VERBOSEMAKE),yes)
  QUIET =
else
  QUIET = yes
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
18 19
endif

20
# install the binaries
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
21
DESTDIR =
22

23
prefix	    = @prefix@
24 25 26 27 28
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@

BINDIR  = $(DESTDIR)@bindir@
LIBDIR  = $(DESTDIR)@libdir@
29
DATADIR = $(DESTDIR)@datarootdir@
30
MANDIR  = $(DESTDIR)@mandir@
31
TOOLDIR = $(LIBDIR)/why3/commands
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
32

Andrei Paskevich's avatar
Andrei Paskevich committed
33
# OS specific stuff
34
EXE   = @EXE@
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
35 36

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

53
DEPFLAGS  = -slash -I lib/why3
54
ifeq (@OCAMLBEST@,opt)
Andrei Paskevich's avatar
Andrei Paskevich committed
55
DEPFLAGS += -native
56 57
endif

58
RUBBER = @RUBBER@
59
HEVEA = @HEVEA@
60
HACHA = @HACHA@
61
EMACS = @EMACS@
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))
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
84

85 86
TARGET_EMACS = share/emacs/why3.elc

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
87 88 89
###############
# main target
###############
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
90

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

96 97 98 99 100
ifeq (@enable_local@,yes)
all: install_local
endif

.PHONY: byte opt clean depend all install install_local install_no_local
101
.PHONY: plugins plugins.byte plugins.opt
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
102

103 104 105
##############
# Why3 library
##############
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
106

107
LIBGENERATED = src/util/config.ml \
108
	       src/util/rc.ml src/parser/lexer.ml \
109 110
	       src/parser/parser.mli src/parser/parser.ml \
	       src/driver/driver_parser.mli src/driver/driver_parser.ml \
111
	       src/driver/driver_lexer.ml src/session/xml.ml \
112
	       lib/ocaml/why3__BigInt_compat.ml
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
113

114
LIB_UTIL = config bigInt util opt lists strings extmap extset exthtbl weakhtbl \
115
	   hashcons stdlib exn_printer pp debug loc print_tree \
116
	   cmdline warning sysutil rc plugin bigInt number pqueue
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
117

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

121
LIB_PARSER = ptree glob parser typing lexer
122

123
LIB_DRIVER = call_provers driver_ast driver_parser driver_lexer driver \
124
	     whyconf autodetection
125

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

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

François Bobot's avatar
François Bobot committed
140 141
LIB_SESSION = xml termcode session session_tools session_scheduler

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

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

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

Andrei Paskevich's avatar
Andrei Paskevich committed
158
LIBDEP = $(addsuffix .dep, $(LIBMODULES))
159 160
LIBCMO = $(addsuffix .cmo, $(LIBMODULES))
LIBCMX = $(addsuffix .cmx, $(LIBMODULES))
161

Andrei Paskevich's avatar
Andrei Paskevich committed
162
$(LIBDEP): DEPFLAGS += $(LIBINCLUDES)
163
$(LIBCMO) $(LIBCMX): INCLUDES += $(LIBINCLUDES)
164
$(LIBCMX): OFLAGS += -for-pack Why3
165

166 167
$(LIBDEP): $(LIBGENERATED)

168 169 170 171
# Zarith

ifeq (@enable_zarith@,yes)

172
lib/ocaml/why3__BigInt_compat.ml: config.status lib/ocaml/why3__BigInt_zarith.ml
173
	cp lib/ocaml/why3__BigInt_zarith.ml $@
174 175 176

else

177
lib/ocaml/why3__BigInt_compat.ml: config.status lib/ocaml/why3__BigInt_num.ml
178
	cp lib/ocaml/why3__BigInt_num.ml $@
179 180 181

endif

182
clean::
183
	rm -f lib/ocaml/why3__BigInt_compat.ml
184

185
# build targets
186

187 188
byte: lib/why3/why3.cma
opt:  lib/why3/why3.cmxa
189

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

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

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

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

Andrei Paskevich's avatar
Andrei Paskevich committed
206
# clean and depend
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
207

Andrei Paskevich's avatar
Andrei Paskevich committed
208 209 210
ifneq "$(MAKECMDGOALS)" "clean"
include $(LIBDEP)
endif
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
211

212
depend: $(LIBDEP)
213

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

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

227 228 229
###############
# installation
###############
230

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
231 232
clean_old_install::
	rm -rf $(LIBDIR)/why3
MARCHE Claude's avatar
MARCHE Claude committed
233
	rm -rf $(DATADIR)/why3
234
	rm -rf $(OCAMLINSTALLLIB)/why3
MARCHE Claude's avatar
MARCHE Claude committed
235

236

237
ifeq ($(EMACS),no)
238
install_no_local:: clean_old_install
239 240 241
else
install_no_local:: clean_old_install $(TARGET_EMACS)
endif
242
	mkdir -p $(BINDIR)
Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
243
	mkdir -p $(LIBDIR)/why3
244
	mkdir -p $(TOOLDIR)
245
	mkdir -p $(DATADIR)/why3
246
	mkdir -p $(DATADIR)/why3/images
247 248
	mkdir -p $(DATADIR)/why3/images/boomy
	mkdir -p $(DATADIR)/why3/images/fatcow
MARCHE Claude's avatar
MARCHE Claude committed
249
	mkdir -p $(DATADIR)/why3/emacs
250
	mkdir -p $(DATADIR)/why3/vim
251
	mkdir -p $(DATADIR)/why3/lang
MARCHE Claude's avatar
MARCHE Claude committed
252
	mkdir -p $(DATADIR)/why3/theories
253
	mkdir -p $(DATADIR)/why3/modules/mach
MARCHE Claude's avatar
MARCHE Claude committed
254
	mkdir -p $(DATADIR)/why3/drivers
255
	mkdir -p $(DATADIR)/emacs/site-lisp/
MARCHE Claude's avatar
MARCHE Claude committed
256
	cp -f theories/*.why $(DATADIR)/why3/theories
257
	cp -f modules/*.mlw $(DATADIR)/why3/modules
258
	cp -f modules/mach/*.mlw $(DATADIR)/why3/modules/mach
Andrei Paskevich's avatar
Andrei Paskevich committed
259
	cp -f drivers/*.drv drivers/*.gen $(DATADIR)/why3/drivers
260
	cp -f share/provers-detection-data.conf $(DATADIR)/why3/
261
	cp -f share/images/icons.rc $(DATADIR)/why3/images
262
	cp -f share/images/*.png $(DATADIR)/why3/images
263 264
	cp -f share/images/boomy/*.png $(DATADIR)/why3/images/boomy
	cp -f share/images/fatcow/*.png $(DATADIR)/why3/images/fatcow
265
	cp -f share/why3session.dtd $(DATADIR)/why3
266
	cp -rf share/javascript $(DATADIR)/why3/javascript
267 268
	cp -f share/vim/why3.vim $(DATADIR)/why3/vim/why3.vim
	cp -f share/lang/why3.lang $(DATADIR)/why3/lang/why3.lang
269

MARCHE Claude's avatar
MARCHE Claude committed
270
install_no_local_lib::
271
	mkdir -p $(OCAMLINSTALLLIB)/why3
Andrei Paskevich's avatar
Andrei Paskevich committed
272
	cp -f lib/why3/why3.cm* lib/why3/why3.[ao] \
273
		lib/why3/META $(OCAMLINSTALLLIB)/why3
MARCHE Claude's avatar
MARCHE Claude committed
274

275 276
ifeq (@enable_local@,yes)
install install-lib:
277 278
	@echo "Why3 is configured in local installation mode."
	@echo "To install Why3, run ./configure --disable-local ; make ; make install"
279
else
MARCHE Claude's avatar
MARCHE Claude committed
280
install: clean_old_install install_no_local
MARCHE Claude's avatar
MARCHE Claude committed
281
install-lib: install_no_local_lib
282 283
endif

MARCHE Claude's avatar
MARCHE Claude committed
284 285
install-all: install install-lib

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
286 287 288 289 290 291
##################
# Uninstallation
##################

uninstall: clean_old_install

292 293 294 295 296 297 298
##################
# Why3 emacs mode
##################

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

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
299 300 301 302 303 304 305 306 307 308 309 310 311
clean_old_install::
	rm -f $(DATADIR)/emacs/site-lisp/why3.el
ifneq ($(EMACS),no)
	rm -f $(DATADIR)/emacs/site-lisp/why3.elc
endif

install_no_local::
	cp -f share/emacs/why3.el $(DATADIR)/emacs/site-lisp/why3.el
ifneq ($(EMACS),no)
	cp -f share/emacs/why3.elc $(DATADIR)/emacs/site-lisp/why3.elc
endif


312
##################
313
# Why3 plugins
314 315
##################

Andrei Paskevich's avatar
Andrei Paskevich committed
316
PLUGGENERATED = plugins/tptp/tptp_lexer.ml \
317 318
		plugins/tptp/tptp_parser.ml plugins/tptp/tptp_parser.mli \
		plugins/parser/dimacs.ml \
319

320
PLUG_PARSER = genequlin dimacs
321
PLUG_PRINTER =
322
PLUG_TRANSFORM =
323
PLUG_TPTP = tptp_ast tptp_parser tptp_typing tptp_lexer tptp_printer
324

325
PLUGINS = genequlin dimacs tptp
326

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

Andrei Paskevich's avatar
Andrei Paskevich committed
329 330
TPTPCMO = $(addsuffix .cmo, $(TPTPMODULES))
TPTPCMX = $(addsuffix .cmx, $(TPTPMODULES))
331

332 333 334 335 336 337 338 339 340 341
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

342 343
PLUGMODULES = $(addprefix plugins/parser/, $(PLUG_PARSER)) \
	      $(addprefix plugins/printer/, $(PLUG_PRINTER)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
344
	      $(addprefix plugins/transform/, $(PLUG_TRANSFORM)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
345
	      $(TPTPMODULES)
346

Andrei Paskevich's avatar
Andrei Paskevich committed
347
PLUGDEP = $(addsuffix .dep, $(PLUGMODULES))
348 349 350
PLUGCMO = $(addsuffix .cmo, $(PLUGMODULES))
PLUGCMX = $(addsuffix .cmx, $(PLUGMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
351
PLUGDIRS = parser printer transform tptp
352 353
PLUGINCLUDES = $(addprefix -I plugins/, $(PLUGDIRS))

Andrei Paskevich's avatar
Andrei Paskevich committed
354
$(PLUGDEP): DEPFLAGS += $(PLUGINCLUDES)
355 356
$(PLUGCMO) $(PLUGCMX): INCLUDES += $(PLUGINCLUDES)

357 358
$(PLUGDEP): $(PLUGGENERATED)

359 360 361 362 363
LIBPLUGCMO =  $(addsuffix .cmo,  $(addprefix lib/plugins/, $(PLUGINS)))
LIBPLUGCMXS = $(addsuffix .cmxs, $(addprefix lib/plugins/, $(PLUGINS)))

plugins.byte: $(LIBPLUGCMO)
plugins.opt : $(LIBPLUGCMXS)
364 365

lib/plugins/%.cmxs: plugins/parser/%.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
366
	$(if $(QUIET),@echo 'Linking  $@' &&) \
367 368 369 370 371 372 373
	    $(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
374
	$(if $(QUIET),@echo 'Linking  $@' &&) \
375 376 377 378 379 380 381
	    $(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
382
	$(if $(QUIET),@echo 'Linking  $@' &&) \
383 384 385 386 387 388
	    $(OCAMLOPT) $(OFLAGS) -shared -o $@ $<

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

Andrei Paskevich's avatar
Andrei Paskevich committed
389
lib/plugins/tptp.cmxs: $(TPTPCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
390
	$(if $(QUIET),@echo 'Linking  $@' &&) \
Andrei Paskevich's avatar
Andrei Paskevich committed
391
	    $(OCAMLOPT) $(OFLAGS) -shared -o $@ $^
392

Andrei Paskevich's avatar
Andrei Paskevich committed
393
lib/plugins/tptp.cmo: $(TPTPCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
394
	$(if $(QUIET),@echo 'Linking  $@' &&) \
Andrei Paskevich's avatar
Andrei Paskevich committed
395
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $^
396 397 398 399 400 401

PLUGSDIRS = plugins $(addprefix plugins/, $(PLUGDIRS))
PLUGCLEAN = $(addsuffix /*.cm[iox], $(PLUGSDIRS)) \
	    $(addsuffix /*.annot, $(PLUGSDIRS)) \
	    $(addsuffix /*.output, $(PLUGSDIRS)) \
	    $(addsuffix /*.automaton, $(PLUGSDIRS)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
402
	    $(addsuffix /*.dep, $(PLUGSDIRS)) \
403 404 405
	    $(addsuffix /*.o, $(PLUGSDIRS)) \
	    $(addsuffix /*~, $(PLUGSDIRS))

Andrei Paskevich's avatar
Andrei Paskevich committed
406 407 408 409 410 411
# depend and clean targets

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

412
depend: $(PLUGDEP)
Andrei Paskevich's avatar
Andrei Paskevich committed
413

414 415 416 417 418 419
clean::
	rm -f $(PLUGCLEAN) $(PLUGGENERATED)
	rm -f lib/plugins/*

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

422 423 424
######
# Why3
######
425

426 427
src/tools/main.cmo: lib/why3/why3.cma
src/tools/main.cmx: lib/why3/why3.cmxa
428

429 430
src/tools/why3contraption.cmo: lib/why3/why3.cma
src/tools/why3contraption.cmx: lib/why3/why3.cmxa
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
431

432 433 434 435 436
src/tools/why3prove.cmo: lib/why3/why3.cma
src/tools/why3prove.cmx: lib/why3/why3.cmxa

byte: bin/why3.byte bin/why3contraption.byte bin/why3prove.byte
opt:  bin/why3.opt bin/why3contraption.opt bin/why3prove.opt
437 438

bin/why3.opt: lib/why3/why3.cmxa src/tools/main.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
439
	$(if $(QUIET),@echo 'Linking  $@' &&) \
440
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
441

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

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

449 450 451 452 453 454 455 456 457 458 459
bin/why3contraption.opt: lib/why3/why3.cmxa src/tools/why3contraption.cmx
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^

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

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

460 461 462 463 464 465 466 467 468 469 470
bin/why3prove.opt: lib/why3/why3.cmxa src/tools/why3prove.cmx
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^

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

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

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
471
clean_old_install::
472
	rm -f $(BINDIR)/why3$(EXE) $(BINDIR)/why3contraption$(EXE) $(BINDIR)/why3prove$(EXE)
Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
473

474 475
install_no_local::
	cp -f bin/why3.@OCAMLBEST@ $(BINDIR)/why3$(EXE)
476
	cp -f bin/why3contraption.@OCAMLBEST@ $(BINDIR)/why3contraption$(EXE)
477
	cp -f bin/why3prove.@OCAMLBEST@ $(TOOLDIR)/why3prove$(EXE)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
478

479
install_local: bin/why3 bin/why3contraption bin/why3prove
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
480

481
ifneq "$(MAKECMDGOALS)" "clean"
482 483
include src/tools/main.dep
include src/tools/why3contraption.dep
484
include src/tools/why3prove.dep
485 486
endif

487
depend: src/tools/main.dep src/tools/why3contraption.dep src/tools/why3prove.dep
488

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
489
clean::
490 491
	rm -f src/tools/main.cm[iox] src/tools/main.annot src/tools/main.o src/tools/main.dep
	rm -f src/tools/why3contraption.cm[iox] src/tools/why3contraption.annot src/tools/why3contraption.o src/tools/why3contraption.dep
492
	rm -f src/tools/why3prove.cm[iox] src/tools/why3prove.annot src/tools/why3prove.o src/tools/why3prove.dep
493
	rm -f bin/why3.byte bin/why3.opt bin/why3
494
	rm -f bin/why3contraption.byte bin/why3contraption.opt bin/why3contraption
495
	rm -f bin/why3prove.byte bin/why3prove.opt bin/why3prove
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
496

497 498 499
##############
# test targets
##############
500

501 502
%.gui: %.why bin/why3ide.opt
	bin/why3ide.opt $*.why
503

504 505
%: %.mlw bin/why3.opt
	bin/why3.opt $*.mlw
506

507 508
%: %.why bin/why3.opt
	bin/why3.opt $*.why
François Bobot's avatar
François Bobot committed
509

510 511
%.gui: %.mlw bin/why3ide.opt
	bin/why3ide.opt $*.mlw
512

513
%.type: %.mlw bin/why3ide.opt
514
	bin/why3.opt --type-only $*.mlw
515

516 517 518 519
##########
# gallery
##########

520
# we export exactly the programs that have a why3session.xml file
521 522 523

.PHONY: gallery

524 525
gallery::
	@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
Andrei Paskevich's avatar
Andrei Paskevich committed
526
	@for x in examples/*/why3session.xml ; do \
527 528
	  d=`dirname $$x`; \
	  f=`basename $$d`; \
529
	  why3session html $$x; \
530 531
	  echo "exporting $$f"; \
	  mkdir -p $(GALLERYDIR)/$$f; \
532
	  cp examples/$$f.mlw examples/$$f/why3session.html $(GALLERYDIR)/$$f/; \
533
	  rm -f $(GALLERYDIR)/$$f/$$f.zip; \
Andrei Paskevich's avatar
Andrei Paskevich committed
534
	  cd examples/; \
535
	  zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f; \
536
	  cd ..; \
537
	done
538

539 540 541 542 543 544 545 546
%-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; \
547 548
	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; \
549
	cp examples/$$f/why3session.html $(GALLERYDIR)/$$f/; \
550 551
	rm -f $(GALLERYDIR)/$$f/$$f.zip; \
	cd examples/; \
552
	zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f
553

MARCHE Claude's avatar
MARCHE Claude committed
554 555 556 557 558 559 560 561
########
# XML DTD validation
########

.PHONY: xml-validate

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

565 566 567 568 569
xml-validate-local:
	@for x in `find examples/ -name why3session.xml`; do \
	  xmllint --noout --dtdvalid share/why3session.dtd $$x 2>&1 | head -1; \
	done

570 571 572 573
########
# Config
########

574
CONFIG_FILES = why3config
575

576
CONFIGMODULES = $(addprefix src/why3config/, $(CONFIG_FILES))
577

Andrei Paskevich's avatar
Andrei Paskevich committed
578
CONFIGDEP = $(addsuffix .dep, $(CONFIGMODULES))
579 580 581 582 583
CONFIGCMO = $(addsuffix .cmo, $(CONFIGMODULES))
CONFIGCMX = $(addsuffix .cmx, $(CONFIGMODULES))

# build targets

584 585
byte: bin/why3config.byte
opt:  bin/why3config.opt
586

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

591
bin/why3config.byte: lib/why3/why3.cma $(CONFIGCMO)
592
	$(if $(QUIET),@echo 'Linking  $@' &&) \
593
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
594

595 596 597
bin/why3config: bin/why3config.@OCAMLBEST@
	ln -sf why3config.@OCAMLBEST@ $@

598 599
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
600 601 602
ifneq "$(MAKECMDGOALS)" "clean"
include $(CONFIGDEP)
endif
603

Andrei Paskevich's avatar
Andrei Paskevich committed
604
depend: $(CONFIGDEP)
605 606

clean::
607 608 609
	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
610
	rm -f bin/why3config.byte bin/why3config.opt bin/why3config
611

612 613
local_config: bin/why3config.@OCAMLBEST@
	WHY3LIB=$(PWD) WHY3DATA=$(PWD)/share bin/why3config.@OCAMLBEST@ \
614
		--detect --conf_file why3.conf
615

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
616 617 618
clean_old_install::
	rm -f $(BINDIR)/why3config$(EXE)

619
install_no_local::
620
	cp -f bin/why3config.@OCAMLBEST@ $(TOOLDIR)/why3config$(EXE)
621

622
install_local: bin/why3config
623

MARCHE Claude's avatar
MARCHE Claude committed
624 625 626 627
###############
# IDE
###############

628 629
ifeq (@enable_ide@,yes)

François Bobot's avatar
François Bobot committed
630
IDE_FILES = gconfig gmain
MARCHE Claude's avatar
MARCHE Claude committed
631 632 633

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

Andrei Paskevich's avatar
Andrei Paskevich committed
634
IDEDEP = $(addsuffix .dep, $(IDEMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
635 636 637
IDECMO = $(addsuffix .cmo, $(IDEMODULES))
IDECMX = $(addsuffix .cmx, $(IDEMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
638
$(IDEDEP): DEPFLAGS += -I src/ide
639
$(IDECMO) $(IDECMX): INCLUDES += -I src/ide
MARCHE Claude's avatar
MARCHE Claude committed
640

641
# build targets
MARCHE Claude's avatar
MARCHE Claude committed
642

643 644
byte: bin/why3ide.byte
opt:  bin/why3ide.opt
MARCHE Claude's avatar
MARCHE Claude committed
645

646
bin/why3ide.opt bin/why3ide.byte: INCLUDES += -I @LABLGTK2LIB@
Andrei Paskevich's avatar
Andrei Paskevich committed
647
bin/why3ide.opt bin/why3ide.byte: EXTLIBS += lablgtk lablgtksourceview2
MARCHE Claude's avatar
MARCHE Claude committed
648

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

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

657 658 659
bin/why3ide: bin/why3ide.@OCAMLBEST@
	ln -sf why3ide.@OCAMLBEST@ $@

660
src/ide/resetgc.o: src/ide/resetgc.c
661
	$(OCAMLC) -c -ccopt "-Wall -o $@" $<
662

MARCHE Claude's avatar
MARCHE Claude committed
663 664
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
665 666 667
ifneq "$(MAKECMDGOALS)" "clean"
include $(IDEDEP)
endif
MARCHE Claude's avatar
MARCHE Claude committed
668

Andrei Paskevich's avatar
Andrei Paskevich committed
669
depend: $(IDEDEP)
MARCHE Claude's avatar
MARCHE Claude committed
670 671

clean::
672
	rm -f src/ide/xml.ml
MARCHE Claude's avatar
MARCHE Claude committed
673
	rm -f src/ide/*.cm[iox] src/ide/*.o
Andrei Paskevich's avatar
Andrei Paskevich committed
674
	rm -f src/ide/*.annot src/ide/*.dep src/ide/*~
675
	rm -f bin/why3ide.byte bin/why3ide.opt bin/why3ide
MARCHE Claude's avatar
MARCHE Claude committed
676

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
677 678 679
clean_old_install::
	rm -f $(BINDIR)/why3ide$(EXE)

680
install_no_local::
681
	cp -f bin/why3ide.@OCAMLBEST@ $(TOOLDIR)/why3ide$(EXE)
682 683

install_local: bin/why3ide
684

685
endif
MARCHE Claude's avatar
d  
MARCHE Claude committed
686

687

MARCHE Claude's avatar
MARCHE Claude committed
688 689 690 691
###############
# Replayer
###############

François Bobot's avatar
François Bobot committed
692
REPLAYER_FILES = replay
MARCHE Claude's avatar
MARCHE Claude committed
693

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

Andrei Paskevich's avatar
Andrei Paskevich committed
696
REPLAYERDEP = $(addsuffix .dep, $(REPLAYERMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
697 698 699
REPLAYERCMO = $(addsuffix .cmo, $(REPLAYERMODULES))
REPLAYERCMX = $(addsuffix .cmx, $(REPLAYERMODULES))

700 701
$(REPLAYERDEP): DEPFLAGS += -I src/why3replayer
$(REPLAYERCMO) $(REPLAYERCMX): INCLUDES += -I src/why3replayer
MARCHE Claude's avatar
MARCHE Claude committed
702 703 704 705 706 707

# build targets

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

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

712
bin/why3replayer.byte: lib/why3/why3.cma $(REPLAYERCMO)
MARCHE Claude's avatar
MARCHE Claude committed
713
	$(if $(QUIET),@echo 'Linking  $@' &&) \
714
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
715 716 717 718 719 720

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

# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
721 722 723
ifneq "$(MAKECMDGOALS)" "clean"
include $(REPLAYERDEP)
endif
MARCHE Claude's avatar
MARCHE Claude committed
724

Andrei Paskevich's avatar
Andrei Paskevich committed
725
depend: $(REPLAYERDEP)
MARCHE Claude's avatar
MARCHE Claude committed
726 727

clean::
728 729
	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
730 731
	rm -f bin/why3replayer.byte bin/why3replayer.opt bin/why3replayer

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
732 733 734
clean_old_install::
	rm -f $(BINDIR)/why3replayer$(EXE)

MARCHE Claude's avatar
MARCHE Claude committed
735
install_no_local::
736
	cp -f bin/why3replayer.@OCAMLBEST@ $(TOOLDIR)/why3replayer$(EXE)
MARCHE Claude's avatar
MARCHE Claude committed
737 738 739

install_local: bin/why3replayer

740 741 742 743 744

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

745 746
SESSION_FILES = why3session_lib why3session_copy why3session_info	\
		why3session_latex why3session_html why3session_rm	\
747 748
		why3session_output why3session_run why3session_csv	\
		why3session
749 750 751

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

Andrei Paskevich's avatar
Andrei Paskevich committed
752
SESSIONDEP = $(addsuffix .dep, $(SESSIONMODULES))
753 754 755
SESSIONCMO = $(addsuffix .cmo, $(SESSIONMODULES))
SESSIONCMX = $(addsuffix .cmx, $(SESSIONMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
756
$(SESSIONDEP): DEPFLAGS += -I src/why3session
757 758 759 760 761 762 763
$(SESSIONCMO) $(SESSIONCMX): INCLUDES += -I src/why3session

# build targets

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

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

768
bin/why3session.byte: lib/why3/why3.cma $(SESSIONCMO)
769
	$(if $(QUIET),@echo 'Linking  $@' &&) \
770
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
771 772 773 774 775 776

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

# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
777 778 779
ifneq "$(MAKECMDGOALS)" "clean"
include $(SESSIONDEP)
endif
780

Andrei Paskevich's avatar
Andrei Paskevich committed
781
depend: $(SESSIONDEP)
782 783

clean::
Andrei Paskevich's avatar
Andrei Paskevich committed
784 785
	rm -f src/why3session/*.cm[iox] src/why3session/*.o
	rm -f src/why3session/*.annot src/why3session/*.dep src/why3session/*~
786 787
	rm -f bin/why3session.byte bin/why3session.opt bin/why3session

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
788 789 790
clean_old_install::
	rm -f $(BINDIR)/why3session$(EXE)

791
install_no_local::
792
	cp -f bin/why3session.@OCAMLBEST@ $(TOOLDIR)/why3session$(EXE)
793 794 795

install_local: bin/why3session

MARCHE Claude's avatar
MARCHE Claude committed
796

797
###############
798
# Bench
799 800
###############

801 802
ifeq (@enable_bench@,yes)

803
BENCH_FILES = worker db bench benchrc benchdb why3bench
804

805
BENCHMODULES := $(addprefix src/why3bench/, $(BENCH_FILES))
806

Andrei Paskevich's avatar
Andrei Paskevich committed
807
BENCHDEP = $(addsuffix .dep, $(BENCHMODULES))
808 809 810
BENCHCMO = $(addsuffix .cmo, $(BENCHMODULES))
BENCHCMX = $(addsuffix .cmx, $(BENCHMODULES))

811 812
$(BENCHDEP): DEPFLAGS += -I src/why3bench
$(BENCHCMO) $(BENCHCMX): INCLUDES += -I src/why3bench -I @SQLITE3LIB@
813 814 815

# build targets

816 817
byte: bin/why3bench.byte
opt:  bin/why3bench.opt
818

Andrei Paskevich's avatar
Andrei Paskevich committed
819
bin/why3bench.opt bin/why3bench.byte: INCLUDES += -thread -I +threads -I @SQLITE3LIB@
820
bin/why3bench.opt bin/why3bench.byte: EXTLIBS += threads sqlite3
821

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

826
bin/why3bench.byte: lib/why3/why3.cma $(BENCHCMO)
827
	$(if $(QUIET),@echo 'Linking  $@' &&) \
828
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
829

830 831 832
bin/why3bench: bin/why3bench.@OCAMLBEST@
	ln -sf why3bench.@OCAMLBEST@ $@