Makefile.in 46.6 KB
Newer Older
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
1 2
##########################################################################
#                                                                        #
MARCHE Claude's avatar
MARCHE Claude committed
3
#  Copyright (C) 2010-2012                                               #
4 5 6
#    François Bobot                                                      #
#    Jean-Christophe Filliâtre                                           #
#    Claude Marché                                                       #
MARCHE Claude's avatar
MARCHE Claude committed
7
#    Guillaume Melquiond                                                 #
Jean-Christophe Filliâtre's avatar
headers  
Jean-Christophe Filliâtre committed
8
#    Andrei Paskevich                                                    #
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
9 10 11
#                                                                        #
#  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
12
#  License version 2.1, with the special exception on linking            #
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
13 14 15 16 17 18 19 20
#  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
21
include Version
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
22

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

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

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

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

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

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

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

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

66
RUBBER = @RUBBER@
67
HEVEA = @HEVEA@
68
HACHA = @HACHA@
69

70
#PSVIEWER  = @PSVIEWER@
Andrei Paskevich's avatar
Andrei Paskevich committed
71
#PDFVIEWER = @PDFVIEWER@
72

73 74
OFLAGS = -w Aer-29 -dtypes    -I lib/why3 $(INCLUDES)
BFLAGS = -w Aer-29 -dtypes -g -I lib/why3 $(INCLUDES)
75 76 77

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

Andrei Paskevich's avatar
Andrei Paskevich committed
79 80 81 82
ifeq (@enable_debug@,yes)
OFLAGS += -g
endif

83
ifeq (@enable_profiling@,yes)
84 85 86
OFLAGS += -g -p
endif

87 88
# external libraries common to all binaries

89
EXTOBJS =
Andrei Paskevich's avatar
Andrei Paskevich committed
90
EXTLIBS = str unix nums dynlink
91 92 93

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
94

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
95 96 97
###############
# main target
###############
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
98

99 100 101 102
all: @OCAMLBEST@
plugins: plugins.@OCAMLBEST@
opt: plugins.opt
byte: plugins.byte
Francois Bobot's avatar
Francois Bobot committed
103

104 105 106 107 108
ifeq (@enable_local@,yes)
all: install_local
endif

.PHONY: byte opt clean depend all install install_local install_no_local
109
.PHONY: plugins plugins.byte plugins.opt
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
# Why library
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
113
#############
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
114

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

120
LIB_UTIL = config stdlib exn_printer pp debug loc print_tree \
121
	   cmdline hashweak hashcons util warning sysutil rc plugin
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
122

123
LIB_CORE = ident ty term pattern decl theory task pretty env trans printer
124

125
LIB_PARSER = ptree denv glob parser typing lexer
126

127
LIB_DRIVER = call_provers driver_ast driver_parser driver_lexer driver \
128
	     whyconf autodetection
129

130
LIB_TRANSFORM = simplify_recursive_definition simplify_formula \
Leon Gondelman's avatar
Leon Gondelman committed
131
		inlining split_goal induction \
132
		eliminate_definition eliminate_algebraic \
133
		eliminate_inductive eliminate_let eliminate_if \
134
		libencoding discriminate protect_finite \
135
		encoding encoding_select \
136
		encoding_decorate encoding_decoexp encoding_twin \
François Bobot's avatar
François Bobot committed
137
		encoding_explicit encoding_guard encoding_sort \
138
		encoding_instantiate simplify_array filter_trigger \
139
		introduction abstraction close_epsilon lift_epsilon \
140
		eval_match instantiate_predicate smoke_detector
141

Andrei Paskevich's avatar
Andrei Paskevich committed
142 143
LIB_PRINTER = print_number alt_ergo why3printer smtv1 smtv2 coq pvs \
		simplify gappa cvc3 yices
144

François Bobot's avatar
François Bobot committed
145 146
LIB_SESSION = xml termcode session session_tools session_scheduler

147 148 149 150
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)) \
151 152 153 154
	      $(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
155
	      $(addprefix src/printer/, $(LIB_PRINTER)) \
156 157
	      $(addprefix src/session/, $(LIB_SESSION)) \
	      $(addprefix src/whyml/, $(LIB_WHYML))
158

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

Andrei Paskevich's avatar
Andrei Paskevich committed
162
LIBDEP = $(addsuffix .dep, $(LIBMODULES))
163 164
LIBCMO = $(addsuffix .cmo, $(LIBMODULES))
LIBCMX = $(addsuffix .cmx, $(LIBMODULES))
165

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

170 171
$(LIBDEP): $(LIBGENERATED)

172
# build targets
173

174 175
byte: lib/why3/why3.cma
opt:  lib/why3/why3.cmxa
176

177
lib/why3/why3.cma: lib/why3/why3.cmo
Andrei Paskevich's avatar
Andrei Paskevich committed
178 179
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) -a $(BFLAGS) -o $@ $^
180

181
lib/why3/why3.cmxa: lib/why3/why3.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
182 183
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLOPT) -a $(OFLAGS) -o $@ $^
184

185
lib/why3/why3.cmo: $(LIBCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
186 187
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $^
188

189
lib/why3/why3.cmx: $(LIBCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
190 191
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLOPT) $(OFLAGS) -pack -o $@ $^
192

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

Andrei Paskevich's avatar
Andrei Paskevich committed
195 196 197
ifneq "$(MAKECMDGOALS)" "clean"
include $(LIBDEP)
endif
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
198

199
depend: $(LIBDEP)
200

Andrei Paskevich's avatar
Andrei Paskevich committed
201
LIBSDIRS = src $(addprefix src/, $(LIBDIRS))
202 203
LIBCLEAN = $(addsuffix /*.cm[iox], $(LIBSDIRS)) \
	   $(addsuffix /*.annot, $(LIBSDIRS)) \
204 205
	   $(addsuffix /*.output, $(LIBSDIRS)) \
	   $(addsuffix /*.automaton, $(LIBSDIRS)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
206
	   $(addsuffix /*.dep, $(LIBSDIRS)) \
207 208 209 210 211
	   $(addsuffix /*.o, $(LIBSDIRS)) \
	   $(addsuffix /*~, $(LIBSDIRS))

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

214 215 216
###############
# installation
###############
217

MARCHE Claude's avatar
MARCHE Claude committed
218 219 220 221
clean_old_install:
	rm -f $(BINDIR)/why3*
	rm -rf $(DATADIR)/why3

222
install_no_local::
223
	mkdir -p $(BINDIR)
224
	mkdir -p $(DATADIR)/why3
225
	mkdir -p $(DATADIR)/why3/images
226 227
	mkdir -p $(DATADIR)/why3/images/boomy
	mkdir -p $(DATADIR)/why3/images/fatcow
MARCHE Claude's avatar
MARCHE Claude committed
228
	mkdir -p $(DATADIR)/why3/emacs
229
	mkdir -p $(DATADIR)/why3/lang
MARCHE Claude's avatar
MARCHE Claude committed
230
	mkdir -p $(DATADIR)/why3/theories
231
	mkdir -p $(DATADIR)/why3/modules
MARCHE Claude's avatar
MARCHE Claude committed
232 233
	mkdir -p $(DATADIR)/why3/drivers
	cp -f theories/*.why $(DATADIR)/why3/theories
234
	cp -f modules/*.mlw $(DATADIR)/why3/modules
Andrei Paskevich's avatar
Andrei Paskevich committed
235
	cp -f drivers/*.drv drivers/*.gen $(DATADIR)/why3/drivers
236
	cp -f share/provers-detection-data.conf $(DATADIR)/why3/
237
	cp -f share/images/icons.rc $(DATADIR)/why3/images
238
	cp -f share/images/*.png $(DATADIR)/why3/images
239 240
	cp -f share/images/boomy/*.png $(DATADIR)/why3/images/boomy
	cp -f share/images/fatcow/*.png $(DATADIR)/why3/images/fatcow
241
	cp -f share/why3session.dtd $(DATADIR)/why3
242
	cp -rf share/javascript $(DATADIR)/why3/javascript
MARCHE Claude's avatar
MARCHE Claude committed
243
	cp -f share/emacs/why.el $(DATADIR)/why3/emacs/why.el
244
	cp -f share/lang/why.lang $(DATADIR)/why3/lang/why.lang
245
#	if test -d /etc/bash_completion.d; then cp -f share/bash/why3 /etc/bash_completion.d; fi
246

MARCHE Claude's avatar
MARCHE Claude committed
247
install_no_local_lib::
248
	rm -rf $(OCAMLLIB)/why3
MARCHE Claude's avatar
MARCHE Claude committed
249
	mkdir -p $(OCAMLLIB)/why3
Andrei Paskevich's avatar
Andrei Paskevich committed
250 251
	cp -f lib/why3/why3.cm* lib/why3/why3.[ao] \
		lib/why3/META $(OCAMLLIB)/why3
MARCHE Claude's avatar
MARCHE Claude committed
252

253 254 255 256 257
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
MARCHE Claude's avatar
MARCHE Claude committed
258
install: clean_old_install install_no_local
MARCHE Claude's avatar
MARCHE Claude committed
259
install-lib: install_no_local_lib
260 261
endif

MARCHE Claude's avatar
MARCHE Claude committed
262 263
install-all: install install-lib

264 265 266 267
##################
# Why plugins
##################

Andrei Paskevich's avatar
Andrei Paskevich committed
268 269
PLUGGENERATED = plugins/tptp/tptp_lexer.ml \
		plugins/tptp/tptp_parser.ml plugins/tptp/tptp_parser.mli
270 271

PLUG_PARSER = genequlin
272
PLUG_PRINTER =
273
PLUG_TRANSFORM =
274
PLUG_TPTP = tptp_ast tptp_parser tptp_typing tptp_lexer tptp_printer
275

276
PLUGINS = genequlin tptp
277

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

Andrei Paskevich's avatar
Andrei Paskevich committed
280 281
TPTPCMO = $(addsuffix .cmo, $(TPTPMODULES))
TPTPCMX = $(addsuffix .cmx, $(TPTPMODULES))
282

283 284 285 286 287 288 289 290 291 292
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

293 294
PLUGMODULES = $(addprefix plugins/parser/, $(PLUG_PARSER)) \
	      $(addprefix plugins/printer/, $(PLUG_PRINTER)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
295
	      $(addprefix plugins/transform/, $(PLUG_TRANSFORM)) \
Andrei Paskevich's avatar
Andrei Paskevich committed
296
	      $(TPTPMODULES)
297

Andrei Paskevich's avatar
Andrei Paskevich committed
298
PLUGDEP = $(addsuffix .dep, $(PLUGMODULES))
299 300 301
PLUGCMO = $(addsuffix .cmo, $(PLUGMODULES))
PLUGCMX = $(addsuffix .cmx, $(PLUGMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
302
PLUGDIRS = parser printer transform tptp
303 304
PLUGINCLUDES = $(addprefix -I plugins/, $(PLUGDIRS))

Andrei Paskevich's avatar
Andrei Paskevich committed
305
$(PLUGDEP): DEPFLAGS += $(PLUGINCLUDES)
306 307
$(PLUGCMO) $(PLUGCMX): INCLUDES += $(PLUGINCLUDES)

308 309
$(PLUGDEP): $(PLUGGENERATED)

310 311 312 313 314
LIBPLUGCMO =  $(addsuffix .cmo,  $(addprefix lib/plugins/, $(PLUGINS)))
LIBPLUGCMXS = $(addsuffix .cmxs, $(addprefix lib/plugins/, $(PLUGINS)))

plugins.byte: $(LIBPLUGCMO)
plugins.opt : $(LIBPLUGCMXS)
315 316

lib/plugins/%.cmxs: plugins/parser/%.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/parser/%.cmo
	$(if $(QUIET),@echo 'Linking  $@' &&) \
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $<

lib/plugins/%.cmxs: plugins/printer/%.cmx
Andrei Paskevich's avatar
Andrei Paskevich committed
325
	$(if $(QUIET),@echo 'Linking  $@' &&) \
326 327 328 329 330 331 332
	    $(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
333
	$(if $(QUIET),@echo 'Linking  $@' &&) \
334 335 336 337 338 339
	    $(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
340
lib/plugins/tptp.cmxs: $(TPTPCMX)
Andrei Paskevich's avatar
Andrei Paskevich committed
341
	$(if $(QUIET),@echo 'Linking  $@' &&) \
Andrei Paskevich's avatar
Andrei Paskevich committed
342
	    $(OCAMLOPT) $(OFLAGS) -shared -o $@ $^
343

Andrei Paskevich's avatar
Andrei Paskevich committed
344
lib/plugins/tptp.cmo: $(TPTPCMO)
Andrei Paskevich's avatar
Andrei Paskevich committed
345
	$(if $(QUIET),@echo 'Linking  $@' &&) \
Andrei Paskevich's avatar
Andrei Paskevich committed
346
	    $(OCAMLC) $(BFLAGS) -pack -o $@ $^
347 348 349 350 351 352

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
353
	    $(addsuffix /*.dep, $(PLUGSDIRS)) \
354 355 356
	    $(addsuffix /*.o, $(PLUGSDIRS)) \
	    $(addsuffix /*~, $(PLUGSDIRS))

Andrei Paskevich's avatar
Andrei Paskevich committed
357 358 359 360 361 362
# depend and clean targets

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

363
depend: $(PLUGDEP)
Andrei Paskevich's avatar
Andrei Paskevich committed
364

365 366 367 368 369
clean::
	rm -f $(PLUGCLEAN) $(PLUGGENERATED)
	rm -f lib/plugins/*

install_no_local::
370
	rm -rf $(LIBDIR)/why3/plugins
371
	mkdir -p $(LIBDIR)/why3/plugins
372
	cp -f $(foreach f,$(LIBPLUGCMO) $(LIBPLUGCMXS),$(wildcard $(f))) $(LIBDIR)/why3/plugins
373

374

375 376 377
########
# Whyml (old API)
########
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
378

379
PGM_FILES = pgm_ttree pgm_types pgm_pretty \
380
	    pgm_module pgm_wp pgm_typing pgm_main
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
381

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

384 385 386
PGMDEP = $(addsuffix .dep, $(PGMMODULES))
PGMCMO = $(addsuffix .cmo, $(PGMMODULES))
PGMCMX = $(addsuffix .cmx, $(PGMMODULES))
387

388 389
$(PGMDEP): DEPFLAGS += -I src/programs
$(PGMCMO) $(PGMCMX): INCLUDES += -I src/programs
390

391
# depend and clean targets
392

393 394 395
ifneq "$(MAKECMDGOALS)" "clean"
include $(PGMDEP)
endif
396

397
depend: $(PGMDEP)
398

399 400 401
clean::
	rm -f src/programs/*.cm[iox] src/programs/*.o
	rm -f src/programs/*.annot src/programs/*.dep src/programs/*~
402

403 404 405
######
# Why3
######
406

407 408
src/main.cmo: lib/why3/why3.cma
src/main.cmx: lib/why3/why3.cmxa
409

410 411
byte: bin/why3.byte
opt:  bin/why3.opt
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
412

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

417
bin/why3.byte: lib/why3/why3.cma src/main.cmo
418
	$(if $(QUIET),@echo 'Linking  $@' &&) \
419
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
420

421 422
bin/why3: bin/why3.@OCAMLBEST@
	ln -sf why3.@OCAMLBEST@ $@
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
423

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

427
install_local: bin/why3
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
428

429 430 431 432 433 434
ifneq "$(MAKECMDGOALS)" "clean"
include src/main.dep
endif

depend: src/main.dep

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
435
clean::
436 437
	rm -f src/main.cm[iox] src/main.annot src/main.o
	rm -f bin/why3.byte bin/why3.opt bin/why3
438
	rm -f bin/why3ml.byte bin/why3ml.opt bin/why3ml
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
439

440 441 442
##############
# test targets
##############
443

444 445
%.gui: %.why bin/why3ide.opt
	bin/why3ide.opt $*.why
446

447 448
%: %.mlw bin/why3.opt
	bin/why3.opt $*.mlw
449

450 451
%: %.why bin/why3.opt
	bin/why3.opt $*.why
François Bobot's avatar
François Bobot committed
452

453 454
%.gui: %.mlw bin/why3ide.opt
	bin/why3ide.opt $*.mlw
455

456
%.type: %.mlw bin/why3ide.opt
457
	bin/why3.opt --type-only $*.mlw
458

459 460 461 462
##########
# gallery
##########

463
# we export exactly the programs that have a why3session.xml file
464 465 466

.PHONY: gallery

467 468
gallery::
	@if test "$(GALLERYDIR)" = ""; then echo "set GALLERYDIR first"; exit 1; fi
469 470 471
	@for x in `find examples/programs/ -name why3session.xml`; do \
	  d=`dirname $$x`; \
	  f=`basename $$d`; \
472 473 474
	  echo "exporting $$f"; \
	  mkdir -p $(GALLERYDIR)/$$f; \
	  cp examples/programs/$$f.mlw $(GALLERYDIR)/$$f/; \
475 476 477 478
	  rm -f $(GALLERYDIR)/$$f/$$f.zip; \
	  cd examples/programs/; \
	  zip -r $(GALLERYDIR)/$$f/$$f.zip $$f.mlw $$f; \
	  cd ../..; \
479
	done
480

MARCHE Claude's avatar
MARCHE Claude committed
481 482 483 484 485 486 487 488
########
# XML DTD validation
########

.PHONY: xml-validate

xml-validate:
	@for x in `find examples/ -name why3session.xml`; do \
MARCHE Claude's avatar
MARCHE Claude committed
489 490
	  xmllint --noout --dtdvalid share/why3session.dtd \
			$$x 2>&1 | head -1; \
MARCHE Claude's avatar
MARCHE Claude committed
491 492
	done

493 494 495 496
########
# Config
########

497
CONFIG_FILES = why3config
498

499
CONFIGMODULES = $(addprefix src/why3config/, $(CONFIG_FILES))
500

Andrei Paskevich's avatar
Andrei Paskevich committed
501
CONFIGDEP = $(addsuffix .dep, $(CONFIGMODULES))
502 503 504 505 506
CONFIGCMO = $(addsuffix .cmo, $(CONFIGMODULES))
CONFIGCMX = $(addsuffix .cmx, $(CONFIGMODULES))

# build targets

507 508
byte: bin/why3config.byte
opt:  bin/why3config.opt
509

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

514
bin/why3config.byte: lib/why3/why3.cma $(CONFIGCMO)
515
	$(if $(QUIET),@echo 'Linking  $@' &&) \
516
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
517

518 519 520
bin/why3config: bin/why3config.@OCAMLBEST@
	ln -sf why3config.@OCAMLBEST@ $@

521 522
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
523 524 525
ifneq "$(MAKECMDGOALS)" "clean"
include $(CONFIGDEP)
endif
526

Andrei Paskevich's avatar
Andrei Paskevich committed
527
depend: $(CONFIGDEP)
528 529

clean::
530 531 532
	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
533
	rm -f bin/why3config.byte bin/why3config.opt bin/why3config
534

535 536
local_config: bin/why3config.@OCAMLBEST@
	WHY3LIB=$(PWD) WHY3DATA=$(PWD)/share bin/why3config.@OCAMLBEST@ \
537
		--detect --conf_file why.conf
538

539
install_no_local::
540
	cp -f bin/why3config.@OCAMLBEST@ $(BINDIR)/why3config$(EXE)
541

542
install_local: bin/why3config
543

MARCHE Claude's avatar
MARCHE Claude committed
544 545 546 547
###############
# IDE
###############

548 549
ifeq (@enable_ide@,yes)

François Bobot's avatar
François Bobot committed
550
IDE_FILES = gconfig gmain
MARCHE Claude's avatar
MARCHE Claude committed
551 552 553

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

Andrei Paskevich's avatar
Andrei Paskevich committed
554
IDEDEP = $(addsuffix .dep, $(IDEMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
555 556 557
IDECMO = $(addsuffix .cmo, $(IDEMODULES))
IDECMX = $(addsuffix .cmx, $(IDEMODULES))

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

561
# build targets
MARCHE Claude's avatar
MARCHE Claude committed
562

563 564
byte: bin/why3ide.byte
opt:  bin/why3ide.opt
MARCHE Claude's avatar
MARCHE Claude committed
565

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

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

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

577 578 579
bin/why3ide: bin/why3ide.@OCAMLBEST@
	ln -sf why3ide.@OCAMLBEST@ $@

MARCHE Claude's avatar
MARCHE Claude committed
580 581
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
582 583 584
ifneq "$(MAKECMDGOALS)" "clean"
include $(IDEDEP)
endif
MARCHE Claude's avatar
MARCHE Claude committed
585

Andrei Paskevich's avatar
Andrei Paskevich committed
586
depend: $(IDEDEP)
MARCHE Claude's avatar
MARCHE Claude committed
587 588

clean::
589
	rm -f src/ide/xml.ml
MARCHE Claude's avatar
MARCHE Claude committed
590
	rm -f src/ide/*.cm[iox] src/ide/*.o
Andrei Paskevich's avatar
Andrei Paskevich committed
591
	rm -f src/ide/*.annot src/ide/*.dep src/ide/*~
592
	rm -f bin/why3ide.byte bin/why3ide.opt bin/why3ide
MARCHE Claude's avatar
MARCHE Claude committed
593

594
install_no_local::
595
	cp -f bin/why3ide.@OCAMLBEST@ $(BINDIR)/why3ide$(EXE)
596 597

install_local: bin/why3ide
598

599
endif
MARCHE Claude's avatar
d  
MARCHE Claude committed
600

601

MARCHE Claude's avatar
MARCHE Claude committed
602 603 604 605
###############
# Replayer
###############

François Bobot's avatar
François Bobot committed
606
REPLAYER_FILES = replay
MARCHE Claude's avatar
MARCHE Claude committed
607 608 609

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

Andrei Paskevich's avatar
Andrei Paskevich committed
610
REPLAYERDEP = $(addsuffix .dep, $(REPLAYERMODULES))
MARCHE Claude's avatar
MARCHE Claude committed
611 612 613
REPLAYERCMO = $(addsuffix .cmo, $(REPLAYERMODULES))
REPLAYERCMX = $(addsuffix .cmx, $(REPLAYERMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
614
$(REPLAYERDEP): DEPFLAGS += -I src/ide
Andrei Paskevich's avatar
Andrei Paskevich committed
615
$(REPLAYERCMO) $(REPLAYERCMX): INCLUDES += -I src/ide
MARCHE Claude's avatar
MARCHE Claude committed
616 617 618 619 620 621

# build targets

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

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

626
bin/why3replayer.byte: lib/why3/why3.cma $(REPLAYERCMO)
MARCHE Claude's avatar
MARCHE Claude committed
627
	$(if $(QUIET),@echo 'Linking  $@' &&) \
628
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
MARCHE Claude's avatar
MARCHE Claude committed
629 630 631 632 633 634

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

# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
635 636 637
ifneq "$(MAKECMDGOALS)" "clean"
include $(REPLAYERDEP)
endif
MARCHE Claude's avatar
MARCHE Claude committed
638

Andrei Paskevich's avatar
Andrei Paskevich committed
639
depend: $(REPLAYERDEP)
MARCHE Claude's avatar
MARCHE Claude committed
640 641 642 643 644

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

install_no_local::
645
	cp -f bin/why3replayer.@OCAMLBEST@ $(BINDIR)/why3replayer$(EXE)
MARCHE Claude's avatar
MARCHE Claude committed
646 647 648

install_local: bin/why3replayer

649 650 651 652 653

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

654
SESSION_FILES = why3session_lib why3session_copy why3session_info \
655 656
		why3session_latex why3session_html why3session_rm \
		why3session
657 658 659

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

Andrei Paskevich's avatar
Andrei Paskevich committed
660
SESSIONDEP = $(addsuffix .dep, $(SESSIONMODULES))
661 662 663
SESSIONCMO = $(addsuffix .cmo, $(SESSIONMODULES))
SESSIONCMX = $(addsuffix .cmx, $(SESSIONMODULES))

Andrei Paskevich's avatar
Andrei Paskevich committed
664
$(SESSIONDEP): DEPFLAGS += -I src/why3session
665 666 667 668 669 670 671
$(SESSIONCMO) $(SESSIONCMX): INCLUDES += -I src/why3session

# build targets

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

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

676
bin/why3session.byte: lib/why3/why3.cma $(SESSIONCMO)
677
	$(if $(QUIET),@echo 'Linking  $@' &&) \
678
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
679 680 681 682 683 684

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

# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
685 686 687
ifneq "$(MAKECMDGOALS)" "clean"
include $(SESSIONDEP)
endif
688

Andrei Paskevich's avatar
Andrei Paskevich committed
689
depend: $(SESSIONDEP)
690 691

clean::
Andrei Paskevich's avatar
Andrei Paskevich committed
692 693
	rm -f src/why3session/*.cm[iox] src/why3session/*.o
	rm -f src/why3session/*.annot src/why3session/*.dep src/why3session/*~
694 695 696 697 698 699 700
	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
701

702
###############
703
# Bench
704 705
###############

706 707
ifeq (@enable_bench@,yes)

708
BENCH_FILES = worker db bench benchrc benchdb why3bench
709

710
BENCHMODULES := $(addprefix src/why3bench/, $(BENCH_FILES))
711

Andrei Paskevich's avatar
Andrei Paskevich committed
712
BENCHDEP = $(addsuffix .dep, $(BENCHMODULES))
713 714 715
BENCHCMO = $(addsuffix .cmo, $(BENCHMODULES))
BENCHCMX = $(addsuffix .cmx, $(BENCHMODULES))

716 717
$(BENCHDEP): DEPFLAGS += -I src/why3bench
$(BENCHCMO) $(BENCHCMX): INCLUDES += -I src/why3bench -I @SQLITE3LIB@
718 719 720

# build targets

721 722
byte: bin/why3bench.byte
opt:  bin/why3bench.opt
723

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

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

731
bin/why3bench.byte: lib/why3/why3.cma $(BENCHCMO)
732
	$(if $(QUIET),@echo 'Linking  $@' &&) \
733
	    $(OCAMLC) $(BFLAGS) -o $@ $(BLINKFLAGS) $^
734

735 736 737
bin/why3bench: bin/why3bench.@OCAMLBEST@
	ln -sf why3bench.@OCAMLBEST@ $@

738 739
# depend and clean targets

Andrei Paskevich's avatar
Andrei Paskevich committed
740 741 742
ifneq "$(MAKECMDGOALS)" "clean"
include $(BENCHDEP)
endif
743

Andrei Paskevich's avatar
Andrei Paskevich committed
744
depend: $(BENCHDEP)
745 746

clean::
747 748
	rm -f src/why3bench/*.cm[iox] src/why3bench/*.o
	rm -f src/why3bench/*.annot src/why3bench/*.dep src/why3bench/*~
749
	rm -f bin/why3bench.byte bin/why3bench.opt bin/why3bench
750 751

install_no_local::
752
	cp -f bin/why3bench.@OCAMLBEST@ $(BINDIR)/why3bench$(EXE)
753 754

install_local: bin/why3bench
755

756 757
endif

758 759 760
##############
# Coq plugin
##############
761

Andrei Paskevich's avatar
Andrei Paskevich committed
762
ifeq (@enable_coq_tactic@,yes)
763

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

Claude Marche's avatar
Claude Marche committed
766
COQP_FILES = coqCompat why3tac g_why3tac
767

768
COQPMODULES = $(addprefix src/coq-tactic/, $(COQP_FILES))
769

770 771 772
COQPDEP = $(addsuffix .dep, $(COQPMODULES))
COQPCMO = $(addsuffix .cmo, $(COQPMODULES))
COQPCMX = $(addsuffix .cmx, $(COQPMODULES))
773

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

777
$(COQPDEP): DEPFLAGS += -I src/coq-tactic
778
$(COQPCMO) $(COQPCMX): INCLUDES += $(COQPINCLUDES)
Andrei Paskevich's avatar
Andrei Paskevich committed
779 780
$(COQPCMO) $(COQPCMX): BFLAGS += -rectypes
$(COQPCMX): OFLAGS += -rectypes
781

782
$(COQPDEP): $(COQPGENERATED)
783

784 785
byte: src/coq-tactic/.why3-vo-byte
opt:  src/coq-tactic/.why3-vo-opt
786

Andrei Paskevich's avatar
Andrei Paskevich committed
787 788
src/coq-tactic/coqCompat.ml: src/coq-tactic/coqCompat@coq_compat_version@.ml
	cp -f $< $@
789

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

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

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

802
src/coq-tactic/.why3-vo-byte: lib/coq-tactic/Why3.v lib/coq-tactic/why3tac.cma
Andrei Paskevich's avatar
Andrei Paskevich committed
803
	$(if $(QUIET),@echo 'Coqc     $<' &&) \
804
	    WHY3CONFIG="" $(COQC) -byte -I lib/coq-tactic/ $< && \
805
	    touch src/coq-tactic/.why3-vo-byte
806

807
src/coq-tactic/.why3-vo-opt: lib/coq-tactic/Why3.v lib/coq-tactic/why3tac.cmxs
Andrei Paskevich's avatar
Andrei Paskevich committed
808
	$(if $(QUIET),@echo 'Coqc     $<' &&) \
809
	    WHY3CONFIG="" $(COQC) -opt -I lib/coq-tactic/ $< && \
810
	    touch src/coq-tactic/.why3-vo-opt
811

812 813 814 815 816 817
test-coq-tactic.byte: src/coq-tactic/.why3-vo-byte
	$(COQC) -byte -I lib/coq-tactic/ src/coq-tactic/test.v

test-coq-tactic.opt: src/coq-tactic/.why3-vo-opt
	$(COQC) -opt -I lib/coq-tactic/ src/coq-tactic/test.v

818
# depend and clean targets
Andrei Paskevich's avatar
Andrei Paskevich committed
819

Andrei Paskevich's avatar
Andrei Paskevich committed
820
ifneq "$(MAKECMDGOALS)" "clean"