Makefile.in 63.7 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@
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
31

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

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

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

57
RUBBER = @RUBBER@
58
HEVEA = @HEVEA@
59
HACHA = @HACHA@
60
EMACS = @EMACS@
61

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

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

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

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

76 77
# external libraries common to all binaries

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

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
83

84 85
TARGET_EMACS = share/emacs/why3.elc

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

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

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

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

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

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

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

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

120
LIB_PARSER = ptree glob parser typing lexer
121

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

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

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

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

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

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

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

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

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

165 166
$(LIBDEP): $(LIBGENERATED)

167 168 169 170
# Zarith

ifeq (@enable_zarith@,yes)

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

else

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

endif

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

184
# build targets
185

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

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

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

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

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

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

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

211
depend: $(LIBDEP)
212

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

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

226 227 228
###############
# installation
###############
229

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

235

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

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

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

MARCHE Claude's avatar
MARCHE Claude committed
282 283
install-all: install install-lib

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
284 285 286 287 288 289
##################
# Uninstallation
##################

uninstall: clean_old_install

290 291 292 293 294 295 296
##################
# Why3 emacs mode
##################

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

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
297 298 299 300 301 302 303 304 305 306 307 308 309
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


310
##################
311
# Why3 plugins
312 313
##################

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

318
PLUG_PARSER = genequlin dimacs
319
PLUG_PRINTER =
320
PLUG_TRANSFORM =
321
PLUG_TPTP = tptp_ast tptp_parser tptp_typing tptp_lexer tptp_printer
322

323
PLUGINS = genequlin dimacs tptp
324

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

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

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

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

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

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

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

355 356
$(PLUGDEP): $(PLUGGENERATED)

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

plugins.byte: $(LIBPLUGCMO)
plugins.opt : $(LIBPLUGCMXS)
362 363

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

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

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
400
	    $(addsuffix /*.dep, $(PLUGSDIRS)) \
401 402 403
	    $(addsuffix /*.o, $(PLUGSDIRS)) \
	    $(addsuffix /*~, $(PLUGSDIRS))

Andrei Paskevich's avatar
Andrei Paskevich committed
404 405 406 407 408 409
# depend and clean targets

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

410
depend: $(PLUGDEP)
Andrei Paskevich's avatar
Andrei Paskevich committed
411

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

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

420 421 422
######
# Why3
######
423

424 425
src/main.cmo: lib/why3/why3.cma
src/main.cmx: lib/why3/why3.cmxa
426

427 428
byte: bin/why3.byte
opt:  bin/why3.opt
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
429

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

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

438 439
bin/why3: bin/why3.@OCAMLBEST@
	ln -sf why3.@OCAMLBEST@ $@
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
440

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
441 442 443
clean_old_install::
	rm -f $(BINDIR)/why3$(EXE)

444 445
install_no_local::
	cp -f bin/why3.@OCAMLBEST@ $(BINDIR)/why3$(EXE)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
446

447
install_local: bin/why3
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
448

449 450 451 452 453 454
ifneq "$(MAKECMDGOALS)" "clean"
include src/main.dep
endif

depend: src/main.dep

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
455
clean::
456
	rm -f src/main.cm[iox] src/main.annot src/main.o src/main.dep
457
	rm -f bin/why3.byte bin/why3.opt bin/why3
458
	rm -f bin/why3ml.byte bin/why3ml.opt bin/why3ml
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
459

460 461 462
##############
# test targets
##############
463

464 465
%.gui: %.why bin/why3ide.opt
	bin/why3ide.opt $*.why
466

467 468
%: %.mlw bin/why3.opt
	bin/why3.opt $*.mlw
469

470 471
%: %.why bin/why3.opt
	bin/why3.opt $*.why
François Bobot's avatar
François Bobot committed
472

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

476
%.type: %.mlw bin/why3ide.opt
477
	bin/why3.opt --type-only $*.mlw
478

479 480 481 482
##########
# gallery
##########

483
# we export exactly the programs that have a why3session.xml file
484 485 486

.PHONY: gallery

487 488
gallery::
	@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
Andrei Paskevich's avatar
Andrei Paskevich committed
489
	@for x in examples/*/why3session.xml ; do \
490 491
	  d=`dirname $$x`; \
	  f=`basename $$d`; \
492
	  why3session html $$x; \
493 494
	  echo "exporting $$f"; \
	  mkdir -p $(GALLERYDIR)/$$f; \
495
	  cp examples/$$f.mlw examples/$$f/why3session.html $(GALLERYDIR)/$$f/; \
496
	  rm -f $(GALLERYDIR)/$$f/$$f.zip; \
Andrei Paskevich's avatar
Andrei Paskevich committed
497
	  cd examples/; \
498
	  zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f; \
499
	  cd ..; \
500
	done
501

502 503 504 505 506 507 508 509
%-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; \
510 511
	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; \
512
	cp examples/$$f/why3session.html $(GALLERYDIR)/$$f/; \
513 514
	rm -f $(GALLERYDIR)/$$f/$$f.zip; \
	cd examples/; \
515
	zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f
516

MARCHE Claude's avatar
MARCHE Claude committed
517 518 519 520 521 522 523 524
########
# XML DTD validation
########

.PHONY: xml-validate

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

528 529 530 531 532
xml-validate-local:
	@for x in `find examples/ -name why3session.xml`; do \
	  xmllint --noout --dtdvalid share/why3session.dtd $$x 2>&1 | head -1; \
	done

533 534 535 536
########
# Config
########

537
CONFIG_FILES = why3config
538

539
CONFIGMODULES = $(addprefix src/why3config/, $(CONFIG_FILES))
540

Andrei Paskevich's avatar
Andrei Paskevich committed
541
CONFIGDEP = $(addsuffix .dep, $(CONFIGMODULES))
542 543 544 545 546
CONFIGCMO = $(addsuffix .cmo, $(CONFIGMODULES))
CONFIGCMX = $(addsuffix .cmx, $(CONFIGMODULES))

# build targets

547 548
byte: bin/why3config.byte
opt:  bin/why3config.opt
549

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

554
bin/why3config.byte: lib/why3/why3.cma $(CONFIGCMO)
555
	$(if $(QUIET),@echo 'Linking  $@' &&) \
556
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
557

558 559 560
bin/why3config: bin/why3config.@OCAMLBEST@
	ln -sf why3config.@OCAMLBEST@ $@

561 562
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
563 564 565
ifneq "$(MAKECMDGOALS)" "clean"
include $(CONFIGDEP)
endif
566

Andrei Paskevich's avatar
Andrei Paskevich committed
567
depend: $(CONFIGDEP)
568 569

clean::
570 571 572
	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
573
	rm -f bin/why3config.byte bin/why3config.opt bin/why3config
574

575 576
local_config: bin/why3config.@OCAMLBEST@
	WHY3LIB=$(PWD) WHY3DATA=$(PWD)/share bin/why3config.@OCAMLBEST@ \
577
		--detect --conf_file why3.conf
578

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
579 580 581
clean_old_install::
	rm -f $(BINDIR)/why3config$(EXE)

582
install_no_local::
583
	cp -f bin/why3config.@OCAMLBEST@ $(BINDIR)/why3config$(EXE)
584

585
install_local: bin/why3config
586

MARCHE Claude's avatar
MARCHE Claude committed
587 588 589 590
###############
# IDE
###############

591 592
ifeq (@enable_ide@,yes)

François Bobot's avatar
François Bobot committed
593
IDE_FILES = gconfig gmain
MARCHE Claude's avatar
MARCHE Claude committed
594 595 596

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

Andrei Paskevich's avatar
Andrei Paskevich committed
597
IDEDEP = $(addsuffix .dep, $(IDEMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
598 599 600
IDECMO = $(addsuffix .cmo, $(IDEMODULES))
IDECMX = $(addsuffix .cmx, $(IDEMODULES))

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

604
# build targets
MARCHE Claude's avatar
MARCHE Claude committed
605

606 607
byte: bin/why3ide.byte
opt:  bin/why3ide.opt
MARCHE Claude's avatar
MARCHE Claude committed
608

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

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

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

620 621 622
bin/why3ide: bin/why3ide.@OCAMLBEST@
	ln -sf why3ide.@OCAMLBEST@ $@

623
src/ide/resetgc.o: src/ide/resetgc.c
624
	$(OCAMLC) -c -ccopt "-Wall -o $@" $<
625

MARCHE Claude's avatar
MARCHE Claude committed
626 627
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
628 629 630
ifneq "$(MAKECMDGOALS)" "clean"
include $(IDEDEP)
endif
MARCHE Claude's avatar
MARCHE Claude committed
631

Andrei Paskevich's avatar
Andrei Paskevich committed
632
depend: $(IDEDEP)
MARCHE Claude's avatar
MARCHE Claude committed
633 634

clean::
635
	rm -f src/ide/xml.ml
MARCHE Claude's avatar
MARCHE Claude committed
636
	rm -f src/ide/*.cm[iox] src/ide/*.o
Andrei Paskevich's avatar
Andrei Paskevich committed
637
	rm -f src/ide/*.annot src/ide/*.dep src/ide/*~
638
	rm -f bin/why3ide.byte bin/why3ide.opt bin/why3ide
MARCHE Claude's avatar
MARCHE Claude committed
639

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
640 641 642
clean_old_install::
	rm -f $(BINDIR)/why3ide$(EXE)

643
install_no_local::
644
	cp -f bin/why3ide.@OCAMLBEST@ $(BINDIR)/why3ide$(EXE)
645 646

install_local: bin/why3ide
647

648
endif
MARCHE Claude's avatar
d  
MARCHE Claude committed
649

650

MARCHE Claude's avatar
MARCHE Claude committed
651 652 653 654
###############
# Replayer
###############

François Bobot's avatar
François Bobot committed
655
REPLAYER_FILES = replay
MARCHE Claude's avatar
MARCHE Claude committed
656

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

Andrei Paskevich's avatar
Andrei Paskevich committed
659
REPLAYERDEP = $(addsuffix .dep, $(REPLAYERMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
660 661 662
REPLAYERCMO = $(addsuffix .cmo, $(REPLAYERMODULES))
REPLAYERCMX = $(addsuffix .cmx, $(REPLAYERMODULES))

663 664
$(REPLAYERDEP): DEPFLAGS += -I src/why3replayer
$(REPLAYERCMO) $(REPLAYERCMX): INCLUDES += -I src/why3replayer
MARCHE Claude's avatar
MARCHE Claude committed
665 666 667 668 669 670

# build targets

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

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

675
bin/why3replayer.byte: lib/why3/why3.cma $(REPLAYERCMO)
MARCHE Claude's avatar
MARCHE Claude committed
676
	$(if $(QUIET),@echo 'Linking  $@' &&) \
677
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
678 679 680 681 682 683

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

# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
684 685 686
ifneq "$(MAKECMDGOALS)" "clean"
include $(REPLAYERDEP)
endif
MARCHE Claude's avatar
MARCHE Claude committed
687

Andrei Paskevich's avatar
Andrei Paskevich committed
688
depend: $(REPLAYERDEP)
MARCHE Claude's avatar
MARCHE Claude committed
689 690

clean::
691 692
	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
693 694
	rm -f bin/why3replayer.byte bin/why3replayer.opt bin/why3replayer

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
695 696 697
clean_old_install::
	rm -f $(BINDIR)/why3replayer$(EXE)

MARCHE Claude's avatar
MARCHE Claude committed
698
install_no_local::
699
	cp -f bin/why3replayer.@OCAMLBEST@ $(BINDIR)/why3replayer$(EXE)
MARCHE Claude's avatar
MARCHE Claude committed
700 701 702

install_local: bin/why3replayer

703 704 705 706 707

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

708 709
SESSION_FILES = why3session_lib why3session_copy why3session_info	\
		why3session_latex why3session_html why3session_rm	\
710 711
		why3session_output why3session_run why3session_csv	\
		why3session
712 713 714

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

Andrei Paskevich's avatar
Andrei Paskevich committed
715
SESSIONDEP = $(addsuffix .dep, $(SESSIONMODULES))
716 717 718
SESSIONCMO = $(addsuffix .cmo, $(SESSIONMODULES))
SESSIONCMX = $(addsuffix .cmx, $(SESSIONMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
719
$(SESSIONDEP): DEPFLAGS += -I src/why3session
720 721 722 723 724 725 726
$(SESSIONCMO) $(SESSIONCMX): INCLUDES += -I src/why3session

# build targets

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

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

731
bin/why3session.byte: lib/why3/why3.cma $(SESSIONCMO)
732
	$(if $(QUIET),@echo 'Linking  $@' &&) \
733
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
734 735 736 737 738 739

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

# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
740 741 742
ifneq "$(MAKECMDGOALS)" "clean"
include $(SESSIONDEP)
endif
743

Andrei Paskevich's avatar
Andrei Paskevich committed
744
depend: $(SESSIONDEP)
745 746

clean::
Andrei Paskevich's avatar
Andrei Paskevich committed
747 748
	rm -f src/why3session/*.cm[iox] src/why3session/*.o
	rm -f src/why3session/*.annot src/why3session/*.dep src/why3session/*~
749 750
	rm -f bin/why3session.byte bin/why3session.opt bin/why3session

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
751 752 753
clean_old_install::
	rm -f $(BINDIR)/why3session$(EXE)

754 755 756 757 758
install_no_local::
	cp -f bin/why3session.@OCAMLBEST@ $(BINDIR)/why3session$(EXE)

install_local: bin/why3session

MARCHE Claude's avatar
MARCHE Claude committed
759

760
###############
761
# Bench
762 763
###############

764 765
ifeq (@enable_bench@,yes)

766
BENCH_FILES = worker db bench benchrc benchdb why3bench
767

768
BENCHMODULES := $(addprefix src/why3bench/, $(BENCH_FILES))
769

Andrei Paskevich's avatar
Andrei Paskevich committed
770
BENCHDEP = $(addsuffix .dep, $(BENCHMODULES))
771 772 773
BENCHCMO = $(addsuffix .cmo, $(BENCHMODULES))
BENCHCMX = $(addsuffix .cmx, $(BENCHMODULES))

774 775
$(BENCHDEP): DEPFLAGS += -I src/why3bench
$(BENCHCMO) $(BENCHCMX): INCLUDES += -I src/why3bench -I @SQLITE3LIB@
776 777 778

# build targets

779 780
byte: bin/why3bench.byte
opt:  bin/why3bench.opt
781

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

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

789
bin/why3bench.byte: lib/why3/why3.cma $(BENCHCMO)
790
	$(if $(QUIET),@echo 'Linking  $@' &&) \
791
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
792

793 794 795
bin/why3bench: bin/why3bench.@OCAMLBEST@
	ln -sf why3bench.@OCAMLBEST@ $@

796 797
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
798 799 800
ifneq "$(MAKECMDGOALS)" "clean"
include $(BENCHDEP)
endif
801

Andrei Paskevich's avatar
Andrei Paskevich committed
802
depend: $(BENCHDEP)
803 804

clean::
805 806
	rm -f src/why3bench/*.cm[iox] src/why3bench/*.o
	rm -f src/why3bench/*.annot src/why3bench/*.dep src/why3bench/*~
807
	rm -f bin/why3bench.byte bin/why3bench.opt bin/why3bench
808

Jacques-Pascal Deplaix's avatar
Jacques-Pascal Deplaix committed
809 810 811
clean_old_install::
	rm -f $(BINDIR)/why3bench$(EXE)

812
install_no_local::
813
	cp -f bin/why3bench.@OCAMLBEST@ $(BINDIR)/why3bench$(EXE)
814 815

install_local: bin/why3bench
816

817 818
endif

819 820 821
##############
# Coq plugin
##############
822

Andrei Paskevich's avatar
Andrei Paskevich committed
823
ifeq (@enable_coq_tactic@,yes)
824

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

Claude Marche's avatar
Claude Marche committed
827
COQP_FILES = coqCompat why3tac g_why3tac
828