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
		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_guards encoding_tags \
128
		encoding_instantiate simplify_array filter_trigger \
129
		introduction abstraction close_epsilon lift_epsilon \
130
		eval_match instantiate_predicate smoke_detector
131

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

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

137 138 139 140
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)) \
141 142 143 144
	      $(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
145
	      $(addprefix src/printer/, $(LIB_PRINTER)) \
146 147
	      $(addprefix src/session/, $(LIB_SESSION)) \
	      $(addprefix src/whyml/, $(LIB_WHYML))
148

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

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

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

160 161
$(LIBDEP): $(LIBGENERATED)

162
# build targets
163

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

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

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

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

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

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

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

189
depend: $(LIBDEP)
190

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

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

204 205 206
###############
# installation
###############
207

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

213 214

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

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

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

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

256
##################
257
# Why3 plugins
258 259
##################

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

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

269
PLUGINS = genequlin dimacs tptp
270

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

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

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

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

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

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

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

301 302
$(PLUGDEP): $(PLUGGENERATED)

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

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

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

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

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

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

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

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

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

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

367 368 369
######
# Why3
######
370

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

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

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

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

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

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

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

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

depend: src/main.dep

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

404 405 406
##############
# test targets
##############
407

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

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

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

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

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

423 424 425 426
##########
# gallery
##########

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

.PHONY: gallery

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

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

.PHONY: xml-validate

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

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

462 463 464 465
########
# Config
########

466
CONFIG_FILES = why3config
467

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

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

# build targets

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

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

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

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

490 491
# depend and clean targets

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

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

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

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

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

511
install_local: bin/why3config
512

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

517 518
ifeq (@enable_ide@,yes)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

install_local: bin/why3ide
567

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

570

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

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

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

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

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

# build targets

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

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

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

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

# depend and clean targets

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

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

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

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

install_local: bin/why3replayer

620 621 622 623 624

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

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

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

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

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

# build targets

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

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

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

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

# depend and clean targets

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

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

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

674
###############
675
# Bench
676 677
###############

678 679
ifeq (@enable_bench@,yes)

680
BENCH_FILES = worker db bench benchrc benchdb why3bench
681

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

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

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

# build targets

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

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

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

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

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

710 711
# depend and clean targets

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

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

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

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

install_local: bin/why3bench
727

728 729
endif

730 731 732
##############
# Coq plugin
##############
733

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

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

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

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

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

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

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

754
$(COQPDEP): $(COQPGENERATED)
755

756 757
byte: src/coq-tactic/.why3-vo-byte
opt:  src/coq-tactic/.why3-vo-opt
758

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

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

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

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

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

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

784
# depend and clean targets
Andrei Paskevich's avatar
Andrei Paskevich committed
785

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

790
depend: $(COQPDEP)
791 792

clean::
793 794 795 796 797
	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-*
798
	rm -f $(COQPGENERATED)