Makefile.in 48.1 KB
Newer Older
Andrei Paskevich's avatar
Andrei Paskevich committed
1 2 3
####################################################################
#                                                                  #
#  The Why3 Verification Platform   /   The Why3 Development Team  #
Andrei Paskevich's avatar
Andrei Paskevich committed
4
#  Copyright 2010-2013   --   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 46 47
OCAMLC    = @OCAMLC@
OCAMLOPT  = @OCAMLOPT@
OCAMLDEP  = @OCAMLDEP@
OCAMLLEX  = @OCAMLLEX@
OCAMLYACC = @OCAMLYACC@
OCAMLDOC  = @OCAMLDOC@
OCAMLLIB  = @OCAMLLIB@
OCAMLBEST = @OCAMLBEST@
OCAMLVERSION = @OCAMLVERSION@
48 49
COQC      = @COQC@
COQDEP    = @COQDEP@
50
CAMLP5O   = @CAMLP5O@
51
FRAMAC_LIBDIR = @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

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

Andrei Paskevich's avatar
Andrei Paskevich committed
65
OFLAGS = -w Aer-29 -dtypes -g -I lib/why3 $(INCLUDES)
66
BFLAGS = -w Aer-29 -dtypes -g -I lib/why3 $(INCLUDES)
67 68 69

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

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

75 76
# external libraries common to all binaries

77
EXTOBJS =
Andrei Paskevich's avatar
Andrei Paskevich committed
78
EXTLIBS = str unix nums dynlink
79 80 81

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
82

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
83 84 85
###############
# main target
###############
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
86

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

92 93 94 95 96
ifeq (@enable_local@,yes)
all: install_local
endif

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

99 100 101
##############
# Why3 library
##############
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
102

103
LIBGENERATED = src/util/config.ml src/util/rc.ml src/parser/lexer.ml \
104 105
	       src/parser/parser.mli src/parser/parser.ml \
	       src/driver/driver_parser.mli src/driver/driver_parser.ml \
106
	       src/driver/driver_lexer.ml src/session/xml.ml
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
107

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

112
LIB_CORE = ident ty term pattern decl theory task pretty env trans printer
113

114
LIB_PARSER = ptree denv glob parser typing lexer
115

116
LIB_DRIVER = call_provers driver_ast driver_parser driver_lexer driver \
117
	     whyconf autodetection
118

119
LIB_TRANSFORM = simplify_recursive_definition simplify_formula \
Leon Gondelman's avatar
Leon Gondelman committed
120
		inlining split_goal induction \
121
		eliminate_definition eliminate_algebraic \
122
		eliminate_inductive eliminate_let eliminate_if \
123
		libencoding discriminate protect_finite \
124
		encoding encoding_select \
125
		encoding_decorate encoding_decoexp encoding_twin \
François Bobot's avatar
François Bobot committed
126
		encoding_explicit encoding_guard encoding_sort \
127
		encoding_instantiate simplify_array filter_trigger \
128
		introduction abstraction close_epsilon lift_epsilon \
129
		eval_match instantiate_predicate smoke_detector
130

131
LIB_PRINTER = alt_ergo why3printer smtv1 smtv2 coq pvs \
Daisuke Ishii's avatar
Daisuke Ishii committed
132
		simplify gappa cvc3 yices mathematica
133

François Bobot's avatar
François Bobot committed
134 135
LIB_SESSION = xml termcode session session_tools session_scheduler

136 137 138 139
LIB_WHYML = mlw_ty mlw_expr mlw_decl mlw_pretty mlw_wp mlw_module \
	    mlw_dtree mlw_dty mlw_typing mlw_driver mlw_ocaml mlw_main

LIBMODULES =  $(addprefix src/util/, $(LIB_UTIL)) \
140 141 142 143
	      $(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
144
	      $(addprefix src/printer/, $(LIB_PRINTER)) \
145 146
	      $(addprefix src/session/, $(LIB_SESSION)) \
	      $(addprefix src/whyml/, $(LIB_WHYML))
147

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

Andrei Paskevich's avatar
Andrei Paskevich committed
151
LIBDEP = $(addsuffix .dep, $(LIBMODULES))
152 153
LIBCMO = $(addsuffix .cmo, $(LIBMODULES))
LIBCMX = $(addsuffix .cmx, $(LIBMODULES))
154

Andrei Paskevich's avatar
Andrei Paskevich committed
155
$(LIBDEP): DEPFLAGS += $(LIBINCLUDES)
156
$(LIBCMO) $(LIBCMX): INCLUDES += $(LIBINCLUDES)
157
$(LIBCMX): OFLAGS += -for-pack Why3
158

159 160
$(LIBDEP): $(LIBGENERATED)

161
# build targets
162

163 164
byte: lib/why3/why3.cma
opt:  lib/why3/why3.cmxa
165

166
lib/why3/why3.cma: lib/why3/why3.cmo
Andrei Paskevich's avatar
Andrei Paskevich committed
167 168
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) -a $(BFLAGS) -o $@ $^
169

170
lib/why3/why3.cmxa: lib/why3/why3.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
171 172
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLOPT) -a $(OFLAGS) -o $@ $^
173

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

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

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

Andrei Paskevich's avatar
Andrei Paskevich committed
184 185 186
ifneq "$(MAKECMDGOALS)" "clean"
include $(LIBDEP)
endif
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
187

188
depend: $(LIBDEP)
189

Andrei Paskevich's avatar
Andrei Paskevich committed
190
LIBSDIRS = src $(addprefix src/, $(LIBDIRS))
191 192
LIBCLEAN = $(addsuffix /*.cm[iox], $(LIBSDIRS)) \
	   $(addsuffix /*.annot, $(LIBSDIRS)) \
193 194
	   $(addsuffix /*.output, $(LIBSDIRS)) \
	   $(addsuffix /*.automaton, $(LIBSDIRS)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
195
	   $(addsuffix /*.dep, $(LIBSDIRS)) \
196 197 198 199 200
	   $(addsuffix /*.o, $(LIBSDIRS)) \
	   $(addsuffix /*~, $(LIBSDIRS))

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

203 204 205
###############
# installation
###############
206

MARCHE Claude's avatar
MARCHE Claude committed
207 208 209 210
clean_old_install:
	rm -f $(BINDIR)/why3*
	rm -rf $(DATADIR)/why3

211
install_no_local::
212
	mkdir -p $(BINDIR)
213
	mkdir -p $(DATADIR)/why3
214
	mkdir -p $(DATADIR)/why3/images
215 216
	mkdir -p $(DATADIR)/why3/images/boomy
	mkdir -p $(DATADIR)/why3/images/fatcow
MARCHE Claude's avatar
MARCHE Claude committed
217
	mkdir -p $(DATADIR)/why3/emacs
218
	mkdir -p $(DATADIR)/why3/vim
219
	mkdir -p $(DATADIR)/why3/lang
MARCHE Claude's avatar
MARCHE Claude committed
220
	mkdir -p $(DATADIR)/why3/theories
221
	mkdir -p $(DATADIR)/why3/modules
MARCHE Claude's avatar
MARCHE Claude committed
222 223
	mkdir -p $(DATADIR)/why3/drivers
	cp -f theories/*.why $(DATADIR)/why3/theories
224
	cp -f modules/*.mlw $(DATADIR)/why3/modules
Andrei Paskevich's avatar
Andrei Paskevich committed
225
	cp -f drivers/*.drv drivers/*.gen $(DATADIR)/why3/drivers
226
	cp -f share/provers-detection-data.conf $(DATADIR)/why3/
227
	cp -f share/images/icons.rc $(DATADIR)/why3/images
228
	cp -f share/images/*.png $(DATADIR)/why3/images
229 230
	cp -f share/images/boomy/*.png $(DATADIR)/why3/images/boomy
	cp -f share/images/fatcow/*.png $(DATADIR)/why3/images/fatcow
231
	cp -f share/why3session.dtd $(DATADIR)/why3
232
	cp -rf share/javascript $(DATADIR)/why3/javascript
233 234 235
	cp -f share/emacs/why3.el $(DATADIR)/why3/emacs/why3.el
	cp -f share/vim/why3.vim $(DATADIR)/why3/vim/why3.vim
	cp -f share/lang/why3.lang $(DATADIR)/why3/lang/why3.lang
236

MARCHE Claude's avatar
MARCHE Claude committed
237
install_no_local_lib::
238
	rm -rf $(OCAMLLIB)/why3
MARCHE Claude's avatar
MARCHE Claude committed
239
	mkdir -p $(OCAMLLIB)/why3
Andrei Paskevich's avatar
Andrei Paskevich committed
240 241
	cp -f lib/why3/why3.cm* lib/why3/why3.[ao] \
		lib/why3/META $(OCAMLLIB)/why3
MARCHE Claude's avatar
MARCHE Claude committed
242

243 244
ifeq (@enable_local@,yes)
install install-lib:
245 246
	@echo "Why3 is configured in local installation mode."
	@echo "To install Why3, run ./configure --disable-local ; make ; make install"
247
else
MARCHE Claude's avatar
MARCHE Claude committed
248
install: clean_old_install install_no_local
MARCHE Claude's avatar
MARCHE Claude committed
249
install-lib: install_no_local_lib
250 251
endif

MARCHE Claude's avatar
MARCHE Claude committed
252 253
install-all: install install-lib

254
##################
255
# Why3 plugins
256 257
##################

Andrei Paskevich's avatar
Andrei Paskevich committed
258
PLUGGENERATED = plugins/tptp/tptp_lexer.ml \
259 260
		plugins/tptp/tptp_parser.ml plugins/tptp/tptp_parser.mli \
		plugins/parser/dimacs.ml \
261

262
PLUG_PARSER = genequlin dimacs
263
PLUG_PRINTER =
264
PLUG_TRANSFORM =
265
PLUG_TPTP = tptp_ast tptp_parser tptp_typing tptp_lexer tptp_printer
266

267
PLUGINS = genequlin dimacs tptp
268

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

Andrei Paskevich's avatar
Andrei Paskevich committed
271 272
TPTPCMO = $(addsuffix .cmo, $(TPTPMODULES))
TPTPCMX = $(addsuffix .cmx, $(TPTPMODULES))
273

274 275 276 277 278 279 280 281 282 283
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

284 285
PLUGMODULES = $(addprefix plugins/parser/, $(PLUG_PARSER)) \
	      $(addprefix plugins/printer/, $(PLUG_PRINTER)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
286
	      $(addprefix plugins/transform/, $(PLUG_TRANSFORM)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
287
	      $(TPTPMODULES)
288

Andrei Paskevich's avatar
Andrei Paskevich committed
289
PLUGDEP = $(addsuffix .dep, $(PLUGMODULES))
290 291 292
PLUGCMO = $(addsuffix .cmo, $(PLUGMODULES))
PLUGCMX = $(addsuffix .cmx, $(PLUGMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
293
PLUGDIRS = parser printer transform tptp
294 295
PLUGINCLUDES = $(addprefix -I plugins/, $(PLUGDIRS))

Andrei Paskevich's avatar
Andrei Paskevich committed
296
$(PLUGDEP): DEPFLAGS += $(PLUGINCLUDES)
297 298
$(PLUGCMO) $(PLUGCMX): INCLUDES += $(PLUGINCLUDES)

299 300
$(PLUGDEP): $(PLUGGENERATED)

301 302 303 304 305
LIBPLUGCMO =  $(addsuffix .cmo,  $(addprefix lib/plugins/, $(PLUGINS)))
LIBPLUGCMXS = $(addsuffix .cmxs, $(addprefix lib/plugins/, $(PLUGINS)))

plugins.byte: $(LIBPLUGCMO)
plugins.opt : $(LIBPLUGCMXS)
306 307

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

Andrei Paskevich's avatar
Andrei Paskevich committed
335
lib/plugins/tptp.cmo: $(TPTPCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
336
	$(if $(QUIET),@echo 'Linking  $@' &&) \
Andrei Paskevich's avatar
Andrei Paskevich committed
337
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $^
338 339 340 341 342 343

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
344
	    $(addsuffix /*.dep, $(PLUGSDIRS)) \
345 346 347
	    $(addsuffix /*.o, $(PLUGSDIRS)) \
	    $(addsuffix /*~, $(PLUGSDIRS))

Andrei Paskevich's avatar
Andrei Paskevich committed
348 349 350 351 352 353
# depend and clean targets

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

354
depend: $(PLUGDEP)
Andrei Paskevich's avatar
Andrei Paskevich committed
355

356 357 358 359 360
clean::
	rm -f $(PLUGCLEAN) $(PLUGGENERATED)
	rm -f lib/plugins/*

install_no_local::
361
	rm -rf $(LIBDIR)/why3/plugins
362
	mkdir -p $(LIBDIR)/why3/plugins
363
	cp -f $(foreach f,$(LIBPLUGCMO) $(LIBPLUGCMXS),$(wildcard $(f))) $(LIBDIR)/why3/plugins
364

365 366 367
######
# Why3
######
368

369 370
src/main.cmo: lib/why3/why3.cma
src/main.cmx: lib/why3/why3.cmxa
371

372 373
byte: bin/why3.byte
opt:  bin/why3.opt
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
374

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

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

383 384
bin/why3: bin/why3.@OCAMLBEST@
	ln -sf why3.@OCAMLBEST@ $@
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
385

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

389
install_local: bin/why3
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
390

391 392 393 394 395 396
ifneq "$(MAKECMDGOALS)" "clean"
include src/main.dep
endif

depend: src/main.dep

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
397
clean::
398
	rm -f src/main.cm[iox] src/main.annot src/main.o src/main.dep
399
	rm -f bin/why3.byte bin/why3.opt bin/why3
400
	rm -f bin/why3ml.byte bin/why3ml.opt bin/why3ml
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
401

402 403 404
##############
# test targets
##############
405

406 407
%.gui: %.why bin/why3ide.opt
	bin/why3ide.opt $*.why
408

409 410
%: %.mlw bin/why3.opt
	bin/why3.opt $*.mlw
411

412 413
%: %.why bin/why3.opt
	bin/why3.opt $*.why
François Bobot's avatar
François Bobot committed
414

415 416
%.gui: %.mlw bin/why3ide.opt
	bin/why3ide.opt $*.mlw
417

418
%.type: %.mlw bin/why3ide.opt
419
	bin/why3.opt --type-only $*.mlw
420

421 422 423 424
##########
# gallery
##########

425
# we export exactly the programs that have a why3session.xml file
426 427 428

.PHONY: gallery

429 430
gallery::
	@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
Andrei Paskevich's avatar
Andrei Paskevich committed
431
	@for x in examples/*/why3session.xml ; do \
432 433
	  d=`dirname $$x`; \
	  f=`basename $$d`; \
434
	  why3session html $$x; \
435 436
	  echo "exporting $$f"; \
	  mkdir -p $(GALLERYDIR)/$$f; \
437
	  cp examples/$$f.mlw examples/$$f/$$f.html $(GALLERYDIR)/$$f/; \
438
	  rm -f $(GALLERYDIR)/$$f/$$f.zip; \
Andrei Paskevich's avatar
Andrei Paskevich committed
439
	  cd examples/; \
440
	  zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f/$$f.html  $$f; \
441
	  cd ..; \
442
	done
443

MARCHE Claude's avatar
MARCHE Claude committed
444 445 446 447 448 449 450 451
########
# XML DTD validation
########

.PHONY: xml-validate

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

455 456 457 458 459
xml-validate-local:
	@for x in `find examples/ -name why3session.xml`; do \
	  xmllint --noout --dtdvalid share/why3session.dtd $$x 2>&1 | head -1; \
	done

460 461 462 463
########
# Config
########

464
CONFIG_FILES = why3config
465

466
CONFIGMODULES = $(addprefix src/why3config/, $(CONFIG_FILES))
467

Andrei Paskevich's avatar
Andrei Paskevich committed
468
CONFIGDEP = $(addsuffix .dep, $(CONFIGMODULES))
469 470 471 472 473
CONFIGCMO = $(addsuffix .cmo, $(CONFIGMODULES))
CONFIGCMX = $(addsuffix .cmx, $(CONFIGMODULES))

# build targets

474 475
byte: bin/why3config.byte
opt:  bin/why3config.opt
476

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

481
bin/why3config.byte: lib/why3/why3.cma $(CONFIGCMO)
482
	$(if $(QUIET),@echo 'Linking  $@' &&) \
483
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
484

485 486 487
bin/why3config: bin/why3config.@OCAMLBEST@
	ln -sf why3config.@OCAMLBEST@ $@

488 489
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
490 491 492
ifneq "$(MAKECMDGOALS)" "clean"
include $(CONFIGDEP)
endif
493

Andrei Paskevich's avatar
Andrei Paskevich committed
494
depend: $(CONFIGDEP)
495 496

clean::
497 498 499
	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
500
	rm -f bin/why3config.byte bin/why3config.opt bin/why3config
501

502 503
local_config: bin/why3config.@OCAMLBEST@
	WHY3LIB=$(PWD) WHY3DATA=$(PWD)/share bin/why3config.@OCAMLBEST@ \
504
		--detect --conf_file why3.conf
505

506
install_no_local::
507
	cp -f bin/why3config.@OCAMLBEST@ $(BINDIR)/why3config$(EXE)
508

509
install_local: bin/why3config
510

MARCHE Claude's avatar
MARCHE Claude committed
511 512 513 514
###############
# IDE
###############

515 516
ifeq (@enable_ide@,yes)

François Bobot's avatar
François Bobot committed
517
IDE_FILES = gconfig gmain
MARCHE Claude's avatar
MARCHE Claude committed
518 519 520

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

Andrei Paskevich's avatar
Andrei Paskevich committed
521
IDEDEP = $(addsuffix .dep, $(IDEMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
522 523 524
IDECMO = $(addsuffix .cmo, $(IDEMODULES))
IDECMX = $(addsuffix .cmx, $(IDEMODULES))

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

528
# build targets
MARCHE Claude's avatar
MARCHE Claude committed
529

530 531
byte: bin/why3ide.byte
opt:  bin/why3ide.opt
MARCHE Claude's avatar
MARCHE Claude committed
532

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

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

540
bin/why3ide.byte: lib/why3/why3.cma $(IDECMO)
MARCHE Claude's avatar
MARCHE Claude committed
541
	$(if $(QUIET),@echo 'Linking  $@' &&) \
542
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
543

544 545 546
bin/why3ide: bin/why3ide.@OCAMLBEST@
	ln -sf why3ide.@OCAMLBEST@ $@

MARCHE Claude's avatar
MARCHE Claude committed
547 548
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
549 550 551
ifneq "$(MAKECMDGOALS)" "clean"
include $(IDEDEP)
endif
MARCHE Claude's avatar
MARCHE Claude committed
552

Andrei Paskevich's avatar
Andrei Paskevich committed
553
depend: $(IDEDEP)
MARCHE Claude's avatar
MARCHE Claude committed
554 555

clean::
556
	rm -f src/ide/xml.ml
MARCHE Claude's avatar
MARCHE Claude committed
557
	rm -f src/ide/*.cm[iox] src/ide/*.o
Andrei Paskevich's avatar
Andrei Paskevich committed
558
	rm -f src/ide/*.annot src/ide/*.dep src/ide/*~
559
	rm -f bin/why3ide.byte bin/why3ide.opt bin/why3ide
MARCHE Claude's avatar
MARCHE Claude committed
560

561
install_no_local::
562
	cp -f bin/why3ide.@OCAMLBEST@ $(BINDIR)/why3ide$(EXE)
563 564

install_local: bin/why3ide
565

566
endif
MARCHE Claude's avatar
d  
MARCHE Claude committed
567

568

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

François Bobot's avatar
François Bobot committed
573
REPLAYER_FILES = replay
MARCHE Claude's avatar
MARCHE Claude committed
574

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

Andrei Paskevich's avatar
Andrei Paskevich committed
577
REPLAYERDEP = $(addsuffix .dep, $(REPLAYERMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
578 579 580
REPLAYERCMO = $(addsuffix .cmo, $(REPLAYERMODULES))
REPLAYERCMX = $(addsuffix .cmx, $(REPLAYERMODULES))

581 582
$(REPLAYERDEP): DEPFLAGS += -I src/why3replayer
$(REPLAYERCMO) $(REPLAYERCMX): INCLUDES += -I src/why3replayer
MARCHE Claude's avatar
MARCHE Claude committed
583 584 585 586 587 588

# build targets

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

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

593
bin/why3replayer.byte: lib/why3/why3.cma $(REPLAYERCMO)
MARCHE Claude's avatar
MARCHE Claude committed
594
	$(if $(QUIET),@echo 'Linking  $@' &&) \
595
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
596 597 598 599 600 601

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

# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
602 603 604
ifneq "$(MAKECMDGOALS)" "clean"
include $(REPLAYERDEP)
endif
MARCHE Claude's avatar
MARCHE Claude committed
605

Andrei Paskevich's avatar
Andrei Paskevich committed
606
depend: $(REPLAYERDEP)
MARCHE Claude's avatar
MARCHE Claude committed
607 608

clean::
609 610
	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
611 612 613
	rm -f bin/why3replayer.byte bin/why3replayer.opt bin/why3replayer

install_no_local::
614
	cp -f bin/why3replayer.@OCAMLBEST@ $(BINDIR)/why3replayer$(EXE)
MARCHE Claude's avatar
MARCHE Claude committed
615 616 617

install_local: bin/why3replayer

618 619 620 621 622

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

623 624
SESSION_FILES = why3session_lib why3session_copy why3session_info	\
		why3session_latex why3session_html why3session_rm	\
625 626
		why3session_output why3session_run why3session_csv	\
		why3session
627 628 629

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

Andrei Paskevich's avatar
Andrei Paskevich committed
630
SESSIONDEP = $(addsuffix .dep, $(SESSIONMODULES))
631 632 633
SESSIONCMO = $(addsuffix .cmo, $(SESSIONMODULES))
SESSIONCMX = $(addsuffix .cmx, $(SESSIONMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
634
$(SESSIONDEP): DEPFLAGS += -I src/why3session
635 636 637 638 639 640 641
$(SESSIONCMO) $(SESSIONCMX): INCLUDES += -I src/why3session

# build targets

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

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

646
bin/why3session.byte: lib/why3/why3.cma $(SESSIONCMO)
647
	$(if $(QUIET),@echo 'Linking  $@' &&) \
648
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
649 650 651 652 653 654

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

# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
655 656 657
ifneq "$(MAKECMDGOALS)" "clean"
include $(SESSIONDEP)
endif
658

Andrei Paskevich's avatar
Andrei Paskevich committed
659
depend: $(SESSIONDEP)
660 661

clean::
Andrei Paskevich's avatar
Andrei Paskevich committed
662 663
	rm -f src/why3session/*.cm[iox] src/why3session/*.o
	rm -f src/why3session/*.annot src/why3session/*.dep src/why3session/*~
664 665 666 667 668 669 670
	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
671

672
###############
673
# Bench
674 675
###############

676 677
ifeq (@enable_bench@,yes)

678
BENCH_FILES = worker db bench benchrc benchdb why3bench
679

680
BENCHMODULES := $(addprefix src/why3bench/, $(BENCH_FILES))
681

Andrei Paskevich's avatar
Andrei Paskevich committed
682
BENCHDEP = $(addsuffix .dep, $(BENCHMODULES))
683 684 685
BENCHCMO = $(addsuffix .cmo, $(BENCHMODULES))
BENCHCMX = $(addsuffix .cmx, $(BENCHMODULES))

686 687
$(BENCHDEP): DEPFLAGS += -I src/why3bench
$(BENCHCMO) $(BENCHCMX): INCLUDES += -I src/why3bench -I @SQLITE3LIB@
688 689 690

# build targets

691 692
byte: bin/why3bench.byte
opt:  bin/why3bench.opt
693

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

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

701
bin/why3bench.byte: lib/why3/why3.cma $(BENCHCMO)
702
	$(if $(QUIET),@echo 'Linking  $@' &&) \
703
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
704

705 706 707
bin/why3bench: bin/why3bench.@OCAMLBEST@
	ln -sf why3bench.@OCAMLBEST@ $@

708 709
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
710 711 712
ifneq "$(MAKECMDGOALS)" "clean"
include $(BENCHDEP)
endif
713

Andrei Paskevich's avatar
Andrei Paskevich committed
714
depend: $(BENCHDEP)
715 716

clean::
717 718
	rm -f src/why3bench/*.cm[iox] src/why3bench/*.o
	rm -f src/why3bench/*.annot src/why3bench/*.dep src/why3bench/*~
719
	rm -f bin/why3bench.byte bin/why3bench.opt bin/why3bench
720 721

install_no_local::
722
	cp -f bin/why3bench.@OCAMLBEST@ $(BINDIR)/why3bench$(EXE)
723 724

install_local: bin/why3bench
725

726 727
endif

728 729 730
##############
# Coq plugin
##############
731

Andrei Paskevich's avatar
Andrei Paskevich committed
732
ifeq (@enable_coq_tactic@,yes)
733

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

Claude Marche's avatar
Claude Marche committed
736
COQP_FILES = coqCompat why3tac g_why3tac
737

738
COQPMODULES = $(addprefix src/coq-tactic/, $(COQP_FILES))
739

740 741 742
COQPDEP = $(addsuffix .dep, $(COQPMODULES))
COQPCMO = $(addsuffix .cmo, $(COQPMODULES))
COQPCMX = $(addsuffix .cmx, $(COQPMODULES))
743

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

747
$(COQPDEP): DEPFLAGS += -I src/coq-tactic
748
$(COQPCMO) $(COQPCMX): INCLUDES += $(COQPINCLUDES)
Andrei Paskevich's avatar
Andrei Paskevich committed
749 750
$(COQPCMO) $(COQPCMX): BFLAGS += -rectypes
$(COQPCMX): OFLAGS += -rectypes
751

752
$(COQPDEP): $(COQPGENERATED)
753

754 755
byte: src/coq-tactic/.why3-vo-byte
opt:  src/coq-tactic/.why3-vo-opt
756

Andrei Paskevich's avatar
Andrei Paskevich committed
757 758
src/coq-tactic/coqCompat.ml: src/coq-tactic/coqCompat@coq_compat_version@.ml
	cp -f $< $@
759

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

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

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

772
src/coq-tactic/.why3-vo-byte: lib/coq-tactic/Why3.v lib/coq-tactic/why3tac.cma
Andrei Paskevich's avatar
Andrei Paskevich committed
773
	$(if $(QUIET),@echo 'Coqc     $<' &&) \
774
	    WHY3CONFIG="" $(COQC) -byte -I lib/coq-tactic/ $< && \
775
	    touch src/coq-tactic/.why3-vo-byte
776

777
src/coq-tactic/.why3-vo-opt: lib/coq-tactic/Why3.v lib/coq-tactic/why3tac.cmxs
Andrei Paskevich's avatar
Andrei Paskevich committed
778
	$(if $(QUIET),@echo 'Coqc     $<' &&) \
779
	    WHY3CONFIG="" $(COQC) -opt -I lib/coq-tactic/ $< && \
780
	    touch src/coq-tactic/.why3-vo-opt
781

782
# depend and clean targets
Andrei Paskevich's avatar
Andrei Paskevich committed
783

Andrei Paskevich's avatar
Andrei Paskevich committed
784
ifneq "$(MAKECMDGOALS)" "clean"
785
include $(COQPDEP)
Andrei Paskevich's avatar
Andrei Paskevich committed
786
endif
787

788
depend: $(COQPDEP)
789 790

clean::
791 792 793 794 795
	rm -f src/coq-tactic/*.cm[iox] src/coq-tactic/*.o
	rm -f lib/coq-tactic/*.cma lib/coq-tactic/*.cmxs
	rm -f lib/coq-tactic/*.vo lib/coq-tactic/*.glob
	rm -f src/coq-tactic/*.annot src/coq-tactic/*.dep src/coq-tactic/*~
	rm -f src/coq-tactic/.why3-vo-*
796
	rm -f $(COQPGENERATED)
797

798
install_no_local::
799 800
	mkdir -p $(LIBDIR)/why3/coq-tactic
	cp -f lib/coq-tactic/* $(LIBDIR)/why3/coq-tactic