Makefile.in 50.8 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
OCAMLC    = @OCAMLC@
OCAMLOPT  = @OCAMLOPT@
OCAMLDEP  = @OCAMLDEP@
OCAMLLEX  = @OCAMLLEX@
OCAMLYACC = @OCAMLYACC@
OCAMLDOC  = @OCAMLDOC@
OCAMLLIB  = @OCAMLLIB@
46
OCAMLINSTALLLIB  = @OCAMLINSTALLLIB@
47 48
OCAMLBEST = @OCAMLBEST@
OCAMLVERSION = @OCAMLVERSION@
49 50
COQC      = @COQC@
COQDEP    = @COQDEP@
51
CAMLP5O   = @CAMLP5O@
52
FRAMAC_LIBDIR = @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

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

Andrei Paskevich's avatar
Andrei Paskevich committed
66
OFLAGS = -w Aer-29 -dtypes -g -I lib/why3 $(INCLUDES)
67
BFLAGS = -w Aer-29 -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 =
Andrei Paskevich's avatar
Andrei Paskevich committed
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

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

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

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

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

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

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

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

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

115
LIB_PARSER = ptree denv glob parser typing lexer
116

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

120
LIB_TRANSFORM = simplify_formula inlining split_goal induction \
121
		eliminate_definition eliminate_algebraic \
122
		eliminate_inductive eliminate_let eliminate_if \
123 124 125 126
		libencoding discriminate encoding encoding_select \
		encoding_guards_full encoding_tags_full \
		encoding_guards encoding_tags encoding_twin \
		encoding_sort simplify_array filter_trigger \
127
		introduction abstraction close_epsilon lift_epsilon \
128
		eval_match instantiate_predicate smoke_detector
129

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

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

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

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
clean_old_install:
	rm -f $(BINDIR)/why3*
	rm -rf $(DATADIR)/why3
210
	rm -rf $(OCAMLINSTALLLIB)/why3
MARCHE Claude's avatar
MARCHE Claude committed
211

212 213

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

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

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

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

255
##################
256
# Why3 plugins
257 258
##################

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

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

268
PLUGINS = genequlin dimacs tptp
269

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

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

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

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

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

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

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

300 301
$(PLUGDEP): $(PLUGGENERATED)

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

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

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

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

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

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

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

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

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

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

366 367 368
######
# Why3
######
369

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

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

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

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

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

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

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

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

depend: src/main.dep

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

403 404 405
##############
# test targets
##############
406

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

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

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

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

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

422 423 424 425
##########
# gallery
##########

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

.PHONY: gallery

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

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

.PHONY: xml-validate

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

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

461 462 463 464
########
# Config
########

465
CONFIG_FILES = why3config
466

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

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

# build targets

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

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

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

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

489 490
# depend and clean targets

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

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

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

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

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

510
install_local: bin/why3config
511

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

516 517
ifeq (@enable_ide@,yes)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

install_local: bin/why3ide
566

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

569

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

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

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

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

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

# build targets

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

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

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

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

# depend and clean targets

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

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

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

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

install_local: bin/why3replayer

619 620 621 622 623

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

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

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

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

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

# build targets

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

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

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

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

# depend and clean targets

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

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

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

673
###############
674
# Bench
675 676
###############

677 678
ifeq (@enable_bench@,yes)

679
BENCH_FILES = worker db bench benchrc benchdb why3bench
680

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

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

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

# build targets

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

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

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

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

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

709 710
# depend and clean targets

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

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

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

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

install_local: bin/why3bench
726

727 728
endif

729 730 731
##############
# Coq plugin
##############
732

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

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

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

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

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

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

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

753
$(COQPDEP): $(COQPGENERATED)
754