Makefile.in 38.3 KB
Newer Older
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
1 2
##########################################################################
#                                                                        #
3
#  Copyright (C) 2010-2011                                               #
4 5 6
#    François Bobot                                                      #
#    Jean-Christophe Filliâtre                                           #
#    Claude Marché                                                       #
Jean-Christophe Filliâtre's avatar
headers  
Jean-Christophe Filliâtre committed
7
#    Andrei Paskevich                                                    #
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
8 9 10
#                                                                        #
#  This software is free software; you can redistribute it and/or        #
#  modify it under the terms of the GNU Library General Public           #
Jean-Christophe Filliâtre's avatar
headers  
Jean-Christophe Filliâtre committed
11
#  License version 2.1, with the special exception on linking            #
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
12 13 14 15 16 17 18 19
#  described in file LICENSE.                                            #
#                                                                        #
#  This software is distributed in the hope that it will be useful,      #
#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                  #
#                                                                        #
##########################################################################

Andrei Paskevich's avatar
Andrei Paskevich committed
20
include Version
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
21

22 23 24 25 26 27
VERBOSEMAKE ?= @enable_verbose_make@

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

30
# install the binaries
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
31
DESTDIR =
32

33
prefix	    = @prefix@
34 35 36 37 38
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@

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

Andrei Paskevich's avatar
Andrei Paskevich committed
42
# OS specific stuff
43
EXE   = @EXE@
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
44 45

# other variables
46
CC        = @CC@
47 48 49 50 51 52 53 54 55
OCAMLC    = @OCAMLC@
OCAMLOPT  = @OCAMLOPT@
OCAMLDEP  = @OCAMLDEP@
OCAMLLEX  = @OCAMLLEX@
OCAMLYACC = @OCAMLYACC@
OCAMLDOC  = @OCAMLDOC@
OCAMLLIB  = @OCAMLLIB@
OCAMLBEST = @OCAMLBEST@
OCAMLVERSION = @OCAMLVERSION@
56 57
COQC      = @COQC@
COQDEP    = @COQDEP@
58 59
CAMLP5O   = @CAMLP5O@

Andrei Paskevich's avatar
Andrei Paskevich committed
60
DEPFLAGS  = -slash -I src
61
ifeq (@OCAMLBEST@,opt)
Andrei Paskevich's avatar
Andrei Paskevich committed
62
DEPFLAGS += -native
63 64
endif

65 66
RUBBER = @RUBBER@

67
#PSVIEWER  = @PSVIEWER@
Andrei Paskevich's avatar
Andrei Paskevich committed
68
#PDFVIEWER = @PDFVIEWER@
69

70
OFLAGS = -w Aer-29 -dtypes    -I src $(INCLUDES)
71 72 73 74
BFLAGS = -w Aer-29 -dtypes -g -I src $(INCLUDES)

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

Andrei Paskevich's avatar
Andrei Paskevich committed
76 77 78 79
ifeq (@enable_debug@,yes)
OFLAGS += -g
endif

80
ifeq (@enable_profiling@,yes)
81 82 83
OFLAGS += -g -p
endif

84 85
# external libraries common to all binaries

86
EXTOBJS =
Andrei Paskevich's avatar
Andrei Paskevich committed
87
EXTLIBS = str unix nums dynlink
88 89 90

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
91

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
92 93 94
###############
# main target
###############
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
95

96 97 98 99
all: @OCAMLBEST@
plugins: plugins.@OCAMLBEST@
opt: plugins.opt
byte: plugins.byte
Francois Bobot's avatar
Francois Bobot committed
100

101 102 103 104 105
ifeq (@enable_local@,yes)
all: install_local
endif

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

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
108
#############
109
# Why library
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
110
#############
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
111

112
LIBGENERATED = src/util/rc.ml src/parser/lexer.ml \
113 114
	       src/parser/parser.mli src/parser/parser.ml \
	       src/driver/driver_parser.mli src/driver/driver_parser.ml \
115
	       src/driver/driver_lexer.ml src/session/xml.ml
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
116

117
LIB_UTIL = stdlib exn_printer pp debug loc print_tree print_number \
118
	   cmdline hashweak hashcons util sysutil rc plugin
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
119

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

122
LIB_PARSER = ptree denv typing parser lexer
123

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

127
LIB_TRANSFORM = simplify_recursive_definition simplify_formula \
Andrei Paskevich's avatar
Andrei Paskevich committed
128
		inlining split_goal \
129
		eliminate_definition eliminate_algebraic \
130
		eliminate_inductive eliminate_let eliminate_if \
131 132
		libencoding discriminate protect_enumeration \
		encoding encoding_select \
133
		encoding_decorate encoding_decoexp encoding_twin \
François Bobot's avatar
François Bobot committed
134
		encoding_explicit encoding_guard encoding_sort \
135
		encoding_instantiate simplify_array filter_trigger \
136
		introduction abstraction close_epsilon lift_epsilon \
137
		eval_match instantiate_predicate smoke_detector
138

139
LIB_PRINTER = alt_ergo why3printer smtv1 smtv2 coq pvs simplify gappa \
140
	      cvc3 yices
141

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

144
LIBMODULES = src/config \
145 146 147 148 149
	      $(addprefix src/util/, $(LIB_UTIL)) \
	      $(addprefix src/core/, $(LIB_CORE)) \
	      $(addprefix src/parser/, $(LIB_PARSER)) \
	      $(addprefix src/driver/, $(LIB_DRIVER)) \
	      $(addprefix src/transform/, $(LIB_TRANSFORM)) \
François Bobot's avatar
François Bobot committed
150 151
	      $(addprefix src/printer/, $(LIB_PRINTER)) \
	      $(addprefix src/session/, $(LIB_SESSION))
152

François Bobot's avatar
François Bobot committed
153
LIBDIRS = util core parser driver transform printer session
154
LIBINCLUDES = $(addprefix -I src/, $(LIBDIRS))
MARCHE Claude's avatar
MARCHE Claude committed
155

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

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

164 165
$(LIBDEP): $(LIBGENERATED)

166
# build targets
167

168 169
byte: src/why3.cma
opt:  src/why3.cmxa
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
170

171
src/why3.cma: src/why3.cmo
Andrei Paskevich's avatar
Andrei Paskevich committed
172 173
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) -a $(BFLAGS) -o $@ $^
174

175
src/why3.cmxa: src/why3.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
176 177
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLOPT) -a $(OFLAGS) -o $@ $^
178

179
src/why3.cmo: $(LIBCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
180 181
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $^
182

183
src/why3.cmx: $(LIBCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
184 185
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLOPT) $(OFLAGS) -pack -o $@ $^
186

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

Andrei Paskevich's avatar
Andrei Paskevich committed
189 190 191
ifneq "$(MAKECMDGOALS)" "clean"
include $(LIBDEP)
endif
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
192

193
depend: $(LIBDEP)
194

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

clean::
	rm -f $(LIBCLEAN) $(LIBGENERATED)
206
	rm -f src/why3.cm[aiox] src/why3.[ao] src/why3.cmxa
207

208 209 210
###############
# installation
###############
211

212
install_no_local::
213 214
	mkdir -p $(BINDIR)
	mkdir -p $(DATADIR)/why3/images
MARCHE Claude's avatar
MARCHE Claude committed
215
	mkdir -p $(DATADIR)/why3/emacs
216
	mkdir -p $(DATADIR)/why3/lang
MARCHE Claude's avatar
MARCHE Claude committed
217
	mkdir -p $(DATADIR)/why3/theories
218
	mkdir -p $(DATADIR)/why3/modules
MARCHE Claude's avatar
MARCHE Claude committed
219 220
	mkdir -p $(DATADIR)/why3/drivers
	cp -f theories/*.why $(DATADIR)/why3/theories
221
	cp -f modules/*.mlw $(DATADIR)/why3/modules
Andrei Paskevich's avatar
Andrei Paskevich committed
222
	cp -f drivers/*.drv drivers/*.gen $(DATADIR)/why3/drivers
223 224
	cp -f share/provers-detection-data.conf $(DATADIR)/why3/
	cp -f share/images/*.png $(DATADIR)/why3/images
225
	cp -f share/why3session.dtd $(DATADIR)/why3
226
	cp -rf share/javascript $(DATADIR)/why3/javascript
MARCHE Claude's avatar
MARCHE Claude committed
227
	cp -f share/emacs/why.el $(DATADIR)/why3/emacs/why.el
228
	cp -f share/lang/why.lang $(DATADIR)/why3/lang/why.lang
229
#	if test -d /etc/bash_completion.d; then cp -f share/bash/why3 /etc/bash_completion.d; fi
230

MARCHE Claude's avatar
MARCHE Claude committed
231 232
install_no_local_lib::
	mkdir -p $(OCAMLLIB)/why3
233
	cp -f src/why3.cm* $(OCAMLLIB)/why3
234
	cp -f META $(OCAMLLIB)/why3
235
	if test -f src/why3.a; then cp -f src/why3.a $(OCAMLLIB)/why3; fi
MARCHE Claude's avatar
MARCHE Claude committed
236
	if test -f src/why3.o; then cp -f src/why3.o $(OCAMLLIB)/why3; fi
MARCHE Claude's avatar
MARCHE Claude committed
237

238 239 240 241 242
ifeq (@enable_local@,yes)
install install-lib:
	@echo "Why is configured in local installation mode."
	@echo "To install Why, run ./configure --disable-local ; make ; make install"
else
243
install: install_no_local
MARCHE Claude's avatar
MARCHE Claude committed
244
install-lib: install_no_local_lib
245 246
endif

MARCHE Claude's avatar
MARCHE Claude committed
247 248
install-all: install install-lib

249 250 251 252
##################
# Why plugins
##################

Andrei Paskevich's avatar
Andrei Paskevich committed
253 254
PLUGGENERATED = plugins/tptp/tptp_lexer.ml \
		plugins/tptp/tptp_parser.ml plugins/tptp/tptp_parser.mli
255 256

PLUG_PARSER = genequlin
257
PLUG_PRINTER = tptpfof
258
PLUG_TRANSFORM =
Andrei Paskevich's avatar
Andrei Paskevich committed
259
PLUG_TPTP = tptp_ast tptp_parser tptp_typing tptp_lexer
260

Andrei Paskevich's avatar
Andrei Paskevich committed
261
PLUGINS = genequlin tptpfof tptp
262

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

Andrei Paskevich's avatar
Andrei Paskevich committed
265 266
TPTPCMO = $(addsuffix .cmo, $(TPTPMODULES))
TPTPCMX = $(addsuffix .cmx, $(TPTPMODULES))
267

268 269 270 271 272 273 274 275 276 277
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

278 279
PLUGMODULES = $(addprefix plugins/parser/, $(PLUG_PARSER)) \
	      $(addprefix plugins/printer/, $(PLUG_PRINTER)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
280
	      $(addprefix plugins/transform/, $(PLUG_TRANSFORM)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
281
	      $(TPTPMODULES)
282

Andrei Paskevich's avatar
Andrei Paskevich committed
283
PLUGDEP = $(addsuffix .dep, $(PLUGMODULES))
284 285 286
PLUGCMO = $(addsuffix .cmo, $(PLUGMODULES))
PLUGCMX = $(addsuffix .cmx, $(PLUGMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
287
PLUGDIRS = parser printer transform tptp
288 289
PLUGINCLUDES = $(addprefix -I plugins/, $(PLUGDIRS))

Andrei Paskevich's avatar
Andrei Paskevich committed
290
$(PLUGDEP): DEPFLAGS += $(PLUGINCLUDES)
291 292
$(PLUGCMO) $(PLUGCMX): INCLUDES += $(PLUGINCLUDES)

293 294
$(PLUGDEP): $(PLUGGENERATED)

295 296 297 298
plugins.byte: $(addsuffix .cmo, $(addprefix lib/plugins/, $(PLUGINS)))
plugins.opt : $(addsuffix .cmxs, $(addprefix lib/plugins/, $(PLUGINS)))

lib/plugins/%.cmxs: plugins/parser/%.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
299
	$(if $(QUIET),@echo 'Linking  $@' &&) \
300 301 302 303 304 305 306
	    $(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
307
	$(if $(QUIET),@echo 'Linking  $@' &&) \
308 309 310 311 312 313 314
	    $(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
315
	$(if $(QUIET),@echo 'Linking  $@' &&) \
316 317 318 319 320 321
	    $(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
322
lib/plugins/tptp.cmxs: $(TPTPCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
323
	$(if $(QUIET),@echo 'Linking  $@' &&) \
Andrei Paskevich's avatar
Andrei Paskevich committed
324
	    $(OCAMLOPT) $(OFLAGS) -shared -o $@ $^
325

Andrei Paskevich's avatar
Andrei Paskevich committed
326
lib/plugins/tptp.cmo: $(TPTPCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
327
	$(if $(QUIET),@echo 'Linking  $@' &&) \
Andrei Paskevich's avatar
Andrei Paskevich committed
328
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $^
329 330 331 332 333 334

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
335
	    $(addsuffix /*.dep, $(PLUGSDIRS)) \
336 337 338
	    $(addsuffix /*.o, $(PLUGSDIRS)) \
	    $(addsuffix /*~, $(PLUGSDIRS))

Andrei Paskevich's avatar
Andrei Paskevich committed
339 340 341 342 343 344
# depend and clean targets

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

345
depend: $(PLUGDEP)
Andrei Paskevich's avatar
Andrei Paskevich committed
346

347 348 349 350 351 352 353 354
clean::
	rm -f $(PLUGCLEAN) $(PLUGGENERATED)
	rm -f lib/plugins/*

install_no_local::
	mkdir -p $(LIBDIR)/why3/plugins
	cp -f lib/plugins/* $(LIBDIR)/why3/plugins

355

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
356
##################
357
# Why binary
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
358 359
##################

360 361
byte: bin/why3.byte
opt:  bin/why3.opt
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
362

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

367
bin/why3.byte: src/why3.cma src/main.cmo
Andrei Paskevich's avatar
Andrei Paskevich committed
368
	$(if $(QUIET),@echo 'Linking  $@' &&) \
369
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
370

371 372 373
bin/why3: bin/why3.@OCAMLBEST@
	ln -sf why3.@OCAMLBEST@ $@

374 375
src/main.cmo: src/why3.cma
src/main.cmx: src/why3.cmxa
376

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
377
clean::
Andrei Paskevich's avatar
Andrei Paskevich committed
378
	rm -f src/main.cm[iox] src/main.annot src/main.o
379
	rm -f bin/why3.byte bin/why3.opt bin/why3
380

381
install_no_local::
382
	cp -f bin/why3.@OCAMLBEST@ $(BINDIR)/why3$(EXE)
383 384

install_local: bin/why3
385

386 387 388 389
########
# Whyml (new API)
########

390 391
MLW_FILES = mlw_ty mlw_expr mlw_decl mlw_module mlw_pretty \
	    mlw_typing mlw_main
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419

MLWMODULES = $(addprefix src/whyml/, $(MLW_FILES))

MLWDEP = $(addsuffix .dep, $(MLWMODULES))
MLWCMO = $(addsuffix .cmo, $(MLWMODULES))
MLWCMX = $(addsuffix .cmx, $(MLWMODULES))

$(MLWDEP): DEPFLAGS += -I src/whyml
$(MLWCMO) $(MLWCMX): INCLUDES += -I src/whyml

# build targets

byte: $(MLWCMO)
opt:  $(MLWCMX)

# depend and clean targets

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

depend: $(MLWDEP)

clean::
	rm -f src/whyml/*.cm[iox] src/whyml/*.o
	rm -f src/whyml/*.annot src/whyml/*.dep src/whyml/*~
#	rm -f bin/why3ml.byte bin/why3ml.opt bin/why3ml

420 421 422
########
# Whyml
########
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
423

424
PGM_FILES = pgm_ttree pgm_types pgm_pretty \
Andrei Paskevich's avatar
Andrei Paskevich committed
425
	    pgm_module pgm_wp pgm_typing pgm_ocaml pgm_main
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
426

427
PGMMODULES = $(addprefix src/programs/, $(PGM_FILES))
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
428

Andrei Paskevich's avatar
Andrei Paskevich committed
429
PGMDEP = $(addsuffix .dep, $(PGMMODULES))
430 431 432
PGMCMO = $(addsuffix .cmo, $(PGMMODULES))
PGMCMX = $(addsuffix .cmx, $(PGMMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
433
$(PGMDEP): DEPFLAGS += -I src/programs
434
$(PGMCMO) $(PGMCMX): INCLUDES += -I src/programs
435 436

# build targets
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
437

438 439
byte: bin/why3ml.byte
opt:  bin/why3ml.opt
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
440

441
bin/why3ml.opt: src/why3.cmxa $(PGMCMX) $(MLWCMX) src/main.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
442
	$(if $(QUIET),@echo 'Linking  $@' &&) \
443
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
444

445
bin/why3ml.byte: src/why3.cma $(PGMCMO) $(MLWCMO) src/main.cmo
446
	$(if $(QUIET),@echo 'Linking  $@' &&) \
447
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
448

449 450 451
bin/why3ml: bin/why3ml.@OCAMLBEST@
	ln -sf why3ml.@OCAMLBEST@ $@

452
# depend and clean targets
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
453

Andrei Paskevich's avatar
Andrei Paskevich committed
454 455 456
ifneq "$(MAKECMDGOALS)" "clean"
include $(PGMDEP)
endif
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
457

Andrei Paskevich's avatar
Andrei Paskevich committed
458
depend: $(PGMDEP)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
459 460

clean::
461
	rm -f src/programs/*.cm[iox] src/programs/*.o
Andrei Paskevich's avatar
Andrei Paskevich committed
462
	rm -f src/programs/*.annot src/programs/*.dep src/programs/*~
463
	rm -f bin/why3ml.byte bin/why3ml.opt bin/why3ml
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
464

465 466
# test target

467 468
%.gui: %.why bin/why3ide.opt
	bin/why3ide.opt $*.why
469

470 471
%: %.mlw bin/why3ml.opt
	bin/why3ml.opt $*.mlw
472

473 474
%: %.why bin/why3.opt
	bin/why3.opt $*.why
François Bobot's avatar
François Bobot committed
475

476 477
%.gui: %.mlw bin/why3ide.opt
	bin/why3ide.opt $*.mlw
478

479 480 481
%.type: %.mlw bin/why3ide.opt
	bin/why3ml.opt --type-only $*.mlw

482
install_no_local::
483
	cp -f bin/why3ml.@OCAMLBEST@ $(BINDIR)/why3ml$(EXE)
484

485
install_local: bin/why3ml
486

487 488 489 490
##########
# gallery
##########

491
# we export exactly the programs that have a why3session.xml file
492 493 494

.PHONY: gallery

495 496
gallery::
	@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
497 498 499
	@for x in `find examples/programs/ -name why3session.xml`; do \
	  d=`dirname $$x`; \
	  f=`basename $$d`; \
500 501 502
	  echo "exporting $$f"; \
	  mkdir -p $(GALLERYDIR)/$$f; \
	  cp examples/programs/$$f.mlw $(GALLERYDIR)/$$f/; \
503 504 505 506
	  rm -f $(GALLERYDIR)/$$f/$$f.zip; \
	  cd examples/programs/; \
	  zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f; \
	  cd ../..; \
507
	done
508

MARCHE Claude's avatar
MARCHE Claude committed
509 510 511 512 513 514 515 516 517 518 519
########
# XML DTD validation
########

.PHONY: xml-validate

xml-validate:
	@for x in `find examples/ -name why3session.xml`; do \
	  xmllint --noout --valid $$x 2>&1 | head -1; \
	done

520 521 522 523 524 525 526 527
########
# Config
########

CONFIG_FILES = whyconfig

CONFIGMODULES = $(addprefix src/config/, $(CONFIG_FILES))

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

Andrei Paskevich's avatar
Andrei Paskevich committed
532
$(CONFIGDEP): DEPFLAGS += -I src/programs
533 534 535 536
$(CONFIGCMO) $(CONFIGCMX): INCLUDES += -I src/programs

# build targets

537 538
byte: bin/why3config.byte
opt:  bin/why3config.opt
539

540
bin/why3config.opt: src/why3.cmxa $(CONFIGCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
541
	$(if $(QUIET),@echo 'Linking  $@' &&) \
542
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
543

544
bin/why3config.byte: src/why3.cma $(CONFIGCMO)
545
	$(if $(QUIET),@echo 'Linking  $@' &&) \
546
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
547

548 549 550
bin/why3config: bin/why3config.@OCAMLBEST@
	ln -sf why3config.@OCAMLBEST@ $@

551 552
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
553 554 555
ifneq "$(MAKECMDGOALS)" "clean"
include $(CONFIGDEP)
endif
556

Andrei Paskevich's avatar
Andrei Paskevich committed
557
depend: $(CONFIGDEP)
558 559 560

clean::
	rm -f src/config/*.cm[iox] src/config/*.o
Andrei Paskevich's avatar
Andrei Paskevich committed
561
	rm -f src/config/*.annot src/config/*.dep src/config/*~
562
	rm -f src/config/*.output src/config/*.automaton
563
	rm -f bin/why3config.byte bin/why3config.opt bin/why3config
564

565 566
local_config: bin/why3config.@OCAMLBEST@
	WHY3LIB=$(PWD) WHY3DATA=$(PWD)/share bin/why3config.@OCAMLBEST@ \
567
		--detect --conf_file why.conf
568

569
install_no_local::
570
	cp -f bin/why3config.@OCAMLBEST@ $(BINDIR)/why3config$(EXE)
571

572
install_local: bin/why3config
573

MARCHE Claude's avatar
MARCHE Claude committed
574 575 576 577
###############
# IDE
###############

578 579
ifeq (@enable_ide@,yes)

François Bobot's avatar
François Bobot committed
580
IDE_FILES = gconfig gmain
MARCHE Claude's avatar
MARCHE Claude committed
581 582 583

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

Andrei Paskevich's avatar
Andrei Paskevich committed
584
IDEDEP = $(addsuffix .dep, $(IDEMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
585 586 587
IDECMO = $(addsuffix .cmo, $(IDEMODULES))
IDECMX = $(addsuffix .cmx, $(IDEMODULES))

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

591
# build targets
MARCHE Claude's avatar
MARCHE Claude committed
592

593 594
byte: bin/why3ide.byte
opt:  bin/why3ide.opt
MARCHE Claude's avatar
MARCHE Claude committed
595

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

599
bin/why3ide.opt: src/why3.cmxa $(PGMCMX) $(MLWCMX) $(IDECMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
600
	$(if $(QUIET),@echo 'Linking  $@' &&) \
601
	    $(OCAMLOPT) $(OFLAGS) -o $@ $(OLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
602

603
bin/why3ide.byte: src/why3.cma $(PGMCMO) $(MLWCMO) $(IDECMO)
MARCHE Claude's avatar
MARCHE Claude committed
604
	$(if $(QUIET),@echo 'Linking  $@' &&) \
605
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
606

607 608 609
bin/why3ide: bin/why3ide.@OCAMLBEST@
	ln -sf why3ide.@OCAMLBEST@ $@

MARCHE Claude's avatar
MARCHE Claude committed
610 611
# depend and clean targets

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

Andrei Paskevich's avatar
Andrei Paskevich committed
616
depend: $(IDEDEP)
MARCHE Claude's avatar
MARCHE Claude committed
617 618

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

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

install_local: bin/why3ide
628

629
endif
MARCHE Claude's avatar
d  
MARCHE Claude committed
630

631

MARCHE Claude's avatar
MARCHE Claude committed
632 633 634 635
###############
# Replayer
###############

François Bobot's avatar
François Bobot committed
636
REPLAYER_FILES = replay
MARCHE Claude's avatar
MARCHE Claude committed
637 638 639

REPLAYERMODULES = $(addprefix src/ide/, $(REPLAYER_FILES))

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

Andrei Paskevich's avatar
Andrei Paskevich committed
644
$(REPLAYERDEP): DEPFLAGS += -I src/ide
Andrei Paskevich's avatar
Andrei Paskevich committed
645
$(REPLAYERCMO) $(REPLAYERCMX): INCLUDES += -I src/ide
MARCHE Claude's avatar
MARCHE Claude committed
646 647 648 649 650 651

# build targets

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

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

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

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

# depend and clean targets

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

Andrei Paskevich's avatar
Andrei Paskevich committed
669
depend: $(REPLAYERDEP)
MARCHE Claude's avatar
MARCHE Claude committed
670 671 672 673 674

clean::
	rm -f bin/why3replayer.byte bin/why3replayer.opt bin/why3replayer

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

install_local: bin/why3replayer

679 680 681 682 683

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

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

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

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

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

# build targets

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

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

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

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

# depend and clean targets

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

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

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

732
###############
733
# Bench
734 735
###############

736 737
ifeq (@enable_bench@,yes)

738
BENCH_FILES = worker db bench benchrc benchdb whybench
739 740 741

BENCHMODULES := $(addprefix src/bench/, $(BENCH_FILES))

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

Andrei Paskevich's avatar
Andrei Paskevich committed
746
$(BENCHDEP): DEPFLAGS += -I src/bench
747
$(BENCHCMO) $(BENCHCMX): INCLUDES += -I src/bench -I @SQLITE3LIB@
748 749 750

# build targets

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

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

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

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

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

768 769
# depend and clean targets

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

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

clean::
	rm -f src/bench/*.cm[iox] src/bench/*.o
Andrei Paskevich's avatar
Andrei Paskevich committed
778
	rm -f src/bench/*.annot src/bench/*.dep src/bench/*~
779
	rm -f bin/why3bench.byte bin/why3bench.opt bin/why3bench
780 781

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

install_local: bin/why3bench
785

786 787
endif

788 789 790
##############
# Coq plugin
##############
791

792
ifeq (@enable_coq_plugin@,yes)
793

794
COQPGENERATED = src/coq-plugin/g_why3tac.ml
795

796
COQP_FILES = why3tac g_why3tac
797

798
COQPMODULES = $(addprefix src/coq-plugin/, $(COQP_FILES))
799

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

804 805
COQPTREES = kernel lib interp parsing proofs pretyping tactics library toplevel
COQPINCLUDES = -I src/coq-plugin $(addprefix -I @COQLIB@/, $(COQPTREES))
806

807 808
$(COQPDEP): DEPFLAGS += -I src/coq-plugin
$(COQPCMO) $(COQPCMX): INCLUDES += $(COQPINCLUDES)
809

810
$(COQPDEP): $(COQPGENERATED)
811

812 813
byte: src/coq-plugin/.why3-vo-byte
opt:  src/coq-plugin/.why3-vo-opt
814 815 816 817 818

lib/coq-plugin/why3tac.cma:  BFLAGS+=-rectypes -I +camlp5
lib/coq-plugin/why3tac.cmxs: OFLAGS+=-rectypes -I +camlp5

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

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

826
src/coq-plugin/g_why3tac.ml: src/coq-plugin/g_why3tac.ml4
Andrei Paskevich's avatar
Andrei Paskevich committed
827 828
	$(if $(QUIET),@echo 'Camlp5   $<' &&) \
	    $(CAMLP5O) pr_o.cmo @COQLIB@/parsing/grammar.cma -impl $^ -o $@
829

830
src/coq-plugin/.why3-vo-byte: lib/coq-plugin/Why3.v lib/coq-plugin/why3tac.cma
Andrei Paskevich's avatar
Andrei Paskevich committed
831 832 833
	$(if $(QUIET),@echo 'Coqc     $<' &&) \
	    $(COQC) -byte -I lib/coq-plugin/ $< && \
	    touch src/coq-plugin/.why3-vo-byte
834 835

src/coq-plugin/.why3-vo-opt: lib/coq-plugin/Why3.v lib/coq-plugin/why3tac.cmxs
Andrei Paskevich's avatar
Andrei Paskevich committed
836 837 838
	$(if $(QUIET),@echo 'Coqc     $<' &&) \
	    $(COQC) -opt -I lib/coq-plugin/ $< && \
	    touch src/coq-plugin/.why3-vo-opt
839

840
# depend and clean targets
Andrei Paskevich's avatar
Andrei Paskevich committed
841

Andrei Paskevich's avatar
Andrei Paskevich committed
842
ifneq "$(MAKECMDGOALS)" "clean"
843
include $(COQPDEP)
Andrei Paskevich's avatar
Andrei Paskevich committed
844
endif
845

846
depend: $(COQPDEP)
847 848 849

clean::
	rm -f src/coq-plugin/*.cm[iox] src/coq-plugin/*.o
850
	rm -f lib/coq-plugin/*.cma lib/coq-plugin/*.cmxs