Makefile.in 63 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

Andrei Paskevich's avatar
Andrei Paskevich committed
12
include Version
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
13

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

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

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

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

BINDIR  = $(DESTDIR)@bindir@
LIBDIR  = $(DESTDIR)@libdir@
31
DATADIR = $(DESTDIR)@datarootdir@
32
MANDIR  = $(DESTDIR)@mandir@
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
33

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

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

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

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

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

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

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

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

78
79
# external libraries common to all binaries

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

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
85

86
87
TARGET_EMACS = share/emacs/why3.elc

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

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

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

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

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

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

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

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

122
LIB_PARSER = ptree glob parser typing lexer
123

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

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

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

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

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

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

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

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

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

167
168
$(LIBDEP): $(LIBGENERATED)

169
170
171
172
# Zarith

ifeq (@enable_zarith@,yes)

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

else

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

endif

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

186
# build targets
187

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

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

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

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

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

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

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

213
depend: $(LIBDEP)
214

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

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

228
229
230
###############
# installation
###############
231

232
# TODO: Clean this madness
MARCHE Claude's avatar
MARCHE Claude committed
233
234
235
clean_old_install:
	rm -f $(BINDIR)/why3*
	rm -rf $(DATADIR)/why3
236
	rm -rf $(OCAMLINSTALLLIB)/why3
237
	rm -rf $(LIBDIR)/why3/plugins
MARCHE Claude's avatar
MARCHE Claude committed
238

239

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

MARCHE Claude's avatar
MARCHE Claude committed
275
install_no_local_lib::
276
	mkdir -p $(OCAMLINSTALLLIB)/why3
Andrei Paskevich's avatar
Andrei Paskevich committed
277
	cp -f lib/why3/why3.cm* lib/why3/why3.[ao] \
278
		lib/why3/META $(OCAMLINSTALLLIB)/why3
MARCHE Claude's avatar
MARCHE Claude committed
279

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

MARCHE Claude's avatar
MARCHE Claude committed
289
290
install-all: install install-lib

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

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

298
##################
299
# Why3 plugins
300
301
##################

Andrei Paskevich's avatar
Andrei Paskevich committed
302
PLUGGENERATED = plugins/tptp/tptp_lexer.ml \
303
304
		plugins/tptp/tptp_parser.ml plugins/tptp/tptp_parser.mli \
		plugins/parser/dimacs.ml \
305

306
PLUG_PARSER = genequlin dimacs
307
PLUG_PRINTER =
308
PLUG_TRANSFORM =
309
PLUG_TPTP = tptp_ast tptp_parser tptp_typing tptp_lexer tptp_printer
310

311
PLUGINS = genequlin dimacs tptp
312

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

Andrei Paskevich's avatar
Andrei Paskevich committed
315
316
TPTPCMO = $(addsuffix .cmo, $(TPTPMODULES))
TPTPCMX = $(addsuffix .cmx, $(TPTPMODULES))
317

318
319
320
321
322
323
324
325
326
327
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

328
329
PLUGMODULES = $(addprefix plugins/parser/, $(PLUG_PARSER)) \
	      $(addprefix plugins/printer/, $(PLUG_PRINTER)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
330
	      $(addprefix plugins/transform/, $(PLUG_TRANSFORM)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
331
	      $(TPTPMODULES)
332

Andrei Paskevich's avatar
Andrei Paskevich committed
333
PLUGDEP = $(addsuffix .dep, $(PLUGMODULES))
334
335
336
PLUGCMO = $(addsuffix .cmo, $(PLUGMODULES))
PLUGCMX = $(addsuffix .cmx, $(PLUGMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
337
PLUGDIRS = parser printer transform tptp
338
339
PLUGINCLUDES = $(addprefix -I plugins/, $(PLUGDIRS))

Andrei Paskevich's avatar
Andrei Paskevich committed
340
$(PLUGDEP): DEPFLAGS += $(PLUGINCLUDES)
341
342
$(PLUGCMO) $(PLUGCMX): INCLUDES += $(PLUGINCLUDES)

343
344
$(PLUGDEP): $(PLUGGENERATED)

345
346
347
348
349
LIBPLUGCMO =  $(addsuffix .cmo,  $(addprefix lib/plugins/, $(PLUGINS)))
LIBPLUGCMXS = $(addsuffix .cmxs, $(addprefix lib/plugins/, $(PLUGINS)))

plugins.byte: $(LIBPLUGCMO)
plugins.opt : $(LIBPLUGCMXS)
350
351

lib/plugins/%.cmxs: plugins/parser/%.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
352
	$(if $(QUIET),@echo 'Linking  $@' &&) \
353
354
355
356
357
358
359
	    $(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
360
	$(if $(QUIET),@echo 'Linking  $@' &&) \
361
362
363
364
365
366
367
	    $(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
368
	$(if $(QUIET),@echo 'Linking  $@' &&) \
369
370
371
372
373
374
	    $(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
375
lib/plugins/tptp.cmxs: $(TPTPCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
376
	$(if $(QUIET),@echo 'Linking  $@' &&) \
Andrei Paskevich's avatar
Andrei Paskevich committed
377
	    $(OCAMLOPT) $(OFLAGS) -shared -o $@ $^
378

Andrei Paskevich's avatar
Andrei Paskevich committed
379
lib/plugins/tptp.cmo: $(TPTPCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
380
	$(if $(QUIET),@echo 'Linking  $@' &&) \
Andrei Paskevich's avatar
Andrei Paskevich committed
381
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $^
382
383
384
385
386
387

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
388
	    $(addsuffix /*.dep, $(PLUGSDIRS)) \
389
390
391
	    $(addsuffix /*.o, $(PLUGSDIRS)) \
	    $(addsuffix /*~, $(PLUGSDIRS))

Andrei Paskevich's avatar
Andrei Paskevich committed
392
393
394
395
396
397
# depend and clean targets

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

398
depend: $(PLUGDEP)
Andrei Paskevich's avatar
Andrei Paskevich committed
399

400
401
402
403
404
405
clean::
	rm -f $(PLUGCLEAN) $(PLUGGENERATED)
	rm -f lib/plugins/*

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

408
409
410
######
# Why3
######
411

412
413
src/main.cmo: lib/why3/why3.cma
src/main.cmx: lib/why3/why3.cmxa
414

415
416
byte: bin/why3.byte
opt:  bin/why3.opt
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
417

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

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

426
427
bin/why3: bin/why3.@OCAMLBEST@
	ln -sf why3.@OCAMLBEST@ $@
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
428

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

432
install_local: bin/why3
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
433

434
435
436
437
438
439
ifneq "$(MAKECMDGOALS)" "clean"
include src/main.dep
endif

depend: src/main.dep

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
440
clean::
441
	rm -f src/main.cm[iox] src/main.annot src/main.o src/main.dep
442
	rm -f bin/why3.byte bin/why3.opt bin/why3
443
	rm -f bin/why3ml.byte bin/why3ml.opt bin/why3ml
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
444

445
446
447
##############
# test targets
##############
448

449
450
%.gui: %.why bin/why3ide.opt
	bin/why3ide.opt $*.why
451

452
453
%: %.mlw bin/why3.opt
	bin/why3.opt $*.mlw
454

455
456
%: %.why bin/why3.opt
	bin/why3.opt $*.why
François Bobot's avatar
François Bobot committed
457

458
459
%.gui: %.mlw bin/why3ide.opt
	bin/why3ide.opt $*.mlw
460

461
%.type: %.mlw bin/why3ide.opt
462
	bin/why3.opt --type-only $*.mlw
463

464
465
466
467
##########
# gallery
##########

468
# we export exactly the programs that have a why3session.xml file
469
470
471

.PHONY: gallery

472
473
gallery::
	@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
Andrei Paskevich's avatar
Andrei Paskevich committed
474
	@for x in examples/*/why3session.xml ; do \
475
476
	  d=`dirname $$x`; \
	  f=`basename $$d`; \
477
	  why3session html $$x; \
478
479
	  echo "exporting $$f"; \
	  mkdir -p $(GALLERYDIR)/$$f; \
480
	  cp examples/$$f.mlw examples/$$f/why3session.html $(GALLERYDIR)/$$f/; \
481
	  rm -f $(GALLERYDIR)/$$f/$$f.zip; \
Andrei Paskevich's avatar
Andrei Paskevich committed
482
	  cd examples/; \
483
	  zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f; \
484
	  cd ..; \
485
	done
486

487
488
489
490
491
492
493
494
%-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; \
495
496
	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; \
497
	cp examples/$$f/why3session.html $(GALLERYDIR)/$$f/; \
498
499
	rm -f $(GALLERYDIR)/$$f/$$f.zip; \
	cd examples/; \
500
	zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f
501

MARCHE Claude's avatar
MARCHE Claude committed
502
503
504
505
506
507
508
509
########
# XML DTD validation
########

.PHONY: xml-validate

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

513
514
515
516
517
xml-validate-local:
	@for x in `find examples/ -name why3session.xml`; do \
	  xmllint --noout --dtdvalid share/why3session.dtd $$x 2>&1 | head -1; \
	done

518
519
520
521
########
# Config
########

522
CONFIG_FILES = why3config
523

524
CONFIGMODULES = $(addprefix src/why3config/, $(CONFIG_FILES))
525

Andrei Paskevich's avatar
Andrei Paskevich committed
526
CONFIGDEP = $(addsuffix .dep, $(CONFIGMODULES))
527
528
529
530
531
CONFIGCMO = $(addsuffix .cmo, $(CONFIGMODULES))
CONFIGCMX = $(addsuffix .cmx, $(CONFIGMODULES))

# build targets

532
533
byte: bin/why3config.byte
opt:  bin/why3config.opt
534

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

539
bin/why3config.byte: lib/why3/why3.cma $(CONFIGCMO)
540
	$(if $(QUIET),@echo 'Linking  $@' &&) \
541
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
542

543
544
545
bin/why3config: bin/why3config.@OCAMLBEST@
	ln -sf why3config.@OCAMLBEST@ $@

546
547
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
548
549
550
ifneq "$(MAKECMDGOALS)" "clean"
include $(CONFIGDEP)
endif
551

Andrei Paskevich's avatar
Andrei Paskevich committed
552
depend: $(CONFIGDEP)
553
554

clean::
555
556
557
	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
558
	rm -f bin/why3config.byte bin/why3config.opt bin/why3config
559

560
561
local_config: bin/why3config.@OCAMLBEST@
	WHY3LIB=$(PWD) WHY3DATA=$(PWD)/share bin/why3config.@OCAMLBEST@ \
562
		--detect --conf_file why3.conf
563

564
install_no_local::
565
	cp -f bin/why3config.@OCAMLBEST@ $(BINDIR)/why3config$(EXE)
566

567
install_local: bin/why3config
568

MARCHE Claude's avatar
MARCHE Claude committed
569
570
571
572
###############
# IDE
###############

573
574
ifeq (@enable_ide@,yes)

François Bobot's avatar
François Bobot committed
575
IDE_FILES = gconfig gmain
MARCHE Claude's avatar
MARCHE Claude committed
576
577
578

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

Andrei Paskevich's avatar
Andrei Paskevich committed
579
IDEDEP = $(addsuffix .dep, $(IDEMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
580
581
582
IDECMO = $(addsuffix .cmo, $(IDEMODULES))
IDECMX = $(addsuffix .cmx, $(IDEMODULES))

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

586
# build targets
MARCHE Claude's avatar
MARCHE Claude committed
587

588
589
byte: bin/why3ide.byte
opt:  bin/why3ide.opt
MARCHE Claude's avatar
MARCHE Claude committed
590

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

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

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

602
603
604
bin/why3ide: bin/why3ide.@OCAMLBEST@
	ln -sf why3ide.@OCAMLBEST@ $@

605
src/ide/resetgc.o: src/ide/resetgc.c
606
	$(OCAMLC) -c -ccopt "-Wall -o $@" $<
607

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

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

Andrei Paskevich's avatar
Andrei Paskevich committed
614
depend: $(IDEDEP)
MARCHE Claude's avatar
MARCHE Claude committed
615
616

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

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

install_local: bin/why3ide
626

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

629

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

François Bobot's avatar
François Bobot committed
634
REPLAYER_FILES = replay
MARCHE Claude's avatar
MARCHE Claude committed
635

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

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

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

# build targets

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

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

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

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

# depend and clean targets

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

Andrei Paskevich's avatar
Andrei Paskevich committed
667
depend: $(REPLAYERDEP)
MARCHE Claude's avatar
MARCHE Claude committed
668
669

clean::
670
671
	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
672
673
674
	rm -f bin/why3replayer.byte bin/why3replayer.opt bin/why3replayer

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

install_local: bin/why3replayer

679
680
681
682
683

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

684
685
SESSION_FILES = why3session_lib why3session_copy why3session_info	\
		why3session_latex why3session_html why3session_rm	\
686
687
		why3session_output why3session_run why3session_csv	\
		why3session
688
689
690

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

Andrei Paskevich's avatar
Andrei Paskevich committed
691
SESSIONDEP = $(addsuffix .dep, $(SESSIONMODULES))
692
693
694
SESSIONCMO = $(addsuffix .cmo, $(SESSIONMODULES))
SESSIONCMX = $(addsuffix .cmx, $(SESSIONMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
695
$(SESSIONDEP): DEPFLAGS += -I src/why3session
696
697
698
699
700
701
702
$(SESSIONCMO) $(SESSIONCMX): INCLUDES += -I src/why3session

# build targets

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

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

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

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

# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
716
717
718
ifneq "$(MAKECMDGOALS)" "clean"
include $(SESSIONDEP)
endif
719

Andrei Paskevich's avatar
Andrei Paskevich committed
720
depend: $(SESSIONDEP)
721
722

clean::
Andrei Paskevich's avatar
Andrei Paskevich committed
723
724
	rm -f src/why3session/*.cm[iox] src/why3session/*.o
	rm -f src/why3session/*.annot src/why3session/*.dep src/why3session/*~
725
726
727
728
729
730
731
	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
732

733
###############
734
# Bench
735
736
###############

737
738
ifeq (@enable_bench@,yes)

739
BENCH_FILES = worker db bench benchrc benchdb why3bench
740

741
BENCHMODULES := $(addprefix src/why3bench/, $(BENCH_FILES))
742

Andrei Paskevich's avatar
Andrei Paskevich committed
743
BENCHDEP = $(addsuffix .dep, $(BENCHMODULES))
744
745
746
BENCHCMO = $(addsuffix .cmo, $(BENCHMODULES))
BENCHCMX = $(addsuffix .cmx, $(BENCHMODULES))

747
748
$(BENCHDEP): DEPFLAGS += -I src/why3bench
$(BENCHCMO) $(BENCHCMX): INCLUDES += -I src/why3bench -I @SQLITE3LIB@
749
750
751

# build targets

752
753
byte: bin/why3bench.byte
opt:  bin/why3bench.opt
754

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

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

762
bin/why3bench.byte: lib/why3/why3.cma $(BENCHCMO)
763
	$(if $(QUIET),@echo 'Linking  $@' &&) \
764
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
765

766
767
768
bin/why3bench: bin/why3bench.@OCAMLBEST@
	ln -sf why3bench.@OCAMLBEST@ $@

769
770
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
771
772
773
ifneq "$(MAKECMDGOALS)" "clean"
include $(BENCHDEP)
endif
774

Andrei Paskevich's avatar
Andrei Paskevich committed
775
depend: $(BENCHDEP)
776
777

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

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

install_local: bin/why3bench
786

787
788
endif

789
790
791
##############
# Coq plugin
##############
792

Andrei Paskevich's avatar
Andrei Paskevich committed
793
ifeq (@enable_coq_tactic@,yes)
794

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

Claude Marche's avatar
Claude Marche committed
797
COQP_FILES = coqCompat why3tac g_why3tac
798

799
COQPMODULES = $(addprefix src/coq-tactic/, $(COQP_FILES))
800

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

805
COQPTREES = kernel lib interp parsing proofs pretyping tactics library toplevel
Andrei Paskevich's avatar
Andrei Paskevich committed
806
COQPINCLUDES = -I src/coq-tactic -I +camlp5 $(addprefix -I @COQLIB@/, $(COQPTREES))
807

808
$(COQPDEP): DEPFLAGS += -I src/coq-tactic
809
$(COQPCMO) $(COQPCMX): INCLUDES += $(COQPINCLUDES)
Andrei Paskevich's avatar
Andrei Paskevich committed
810
811
$(COQPCMO) $(COQPCMX): BFLAGS += -rectypes
$(COQPCMX): OFLAGS += -rectypes
812

813
$(COQPDEP): $(COQPGENERATED)
814

815
816
byte: src/coq-tactic/.why3-vo-byte
opt:  src/coq-tactic/.why3-vo-opt
817

Andrei Paskevich's avatar
Andrei Paskevich committed
818
819
src/coq-tactic/coqCompat.ml: src/coq-tactic/coqCompat@coq_compat_version@.ml
	cp -f $< $@
820

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

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