Makefile.in 23.2 KB
Newer Older
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
1 2
##########################################################################
#                                                                        #
Jean-Christophe Filliâtre's avatar
headers  
Jean-Christophe Filliâtre committed
3 4 5 6 7
#  Copyright (C) 2010-                                                   #
#    Francois Bobot                                                      #
#    Jean-Christophe Filliatre                                           #
#    Johannes Kanig                                                      #
#    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 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#  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.                  #
#                                                                        #
##########################################################################

VERBOSEMAKE ?= @VERBOSEMAKE@

ifeq ($(VERBOSEMAKE),yes)
 QUIET = 
else    
 QUIET = yes
endif

# where to install the binaries
DESTDIR =
prefix=@prefix@
datarootdir=@datarootdir@
exec_prefix=@exec_prefix@
BINDIR=$(DESTDIR)@bindir@
LIBDIR=$(DESTDIR)@libdir@

EXE=@EXE@
STRIP=@STRIP@

# where to install the man page
MANDIR=$(DESTDIR)@mandir@

# other variables
OCAMLC   = @OCAMLC@ 
OCAMLOPT = @OCAMLOPT@ 
OCAMLDEP = @OCAMLDEP@
OCAMLLEX = @OCAMLLEX@
OCAMLYACC= @OCAMLYACC@
OCAMLDOC = @OCAMLDOC@
OCAMLLIB = @OCAMLLIB@
OCAMLBEST= @OCAMLBEST@
OCAMLVERSION = @OCAMLVERSION@
CAMLP4   = @CAMLP4O@
53 54
PSVIEWER = @PSVIEWER@
PDFVIEWER = @PDFVIEWER@
55 56 57 58 59 60 61 62 63 64
DYNLINK = @DYNLINK@

ifeq ($(DYNLINK),Dynlink)
DYNLINKBFLAGS = dynlink.cma
DYNLINKOFLAGS = dynlink.cmxa
else
DYNLINKBFLAGS = 
DYNLINKOFLAGS = 
endif

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
65

66
INCLUDES = -I src/core -I src/util -I src/driver -I src/parser -I src/printer \
MARCHE Claude's avatar
MARCHE Claude committed
67
           -I src/transform -I src/programs -I src/manager -I src 
MARCHE Claude's avatar
db  
MARCHE Claude committed
68
BFLAGS   = -w Aelz -dtypes -g $(INCLUDES) @INCLUDEGTK2@ -thread -I +threads -I +sqlite3 @OCAMLGRAPHLIB@ str.cma unix.cma $(DYNLINKBFLAGS)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
69
# no -warn-error because some do not compile all files (e.g. those linked to APRON)
MARCHE Claude's avatar
db  
MARCHE Claude committed
70
OFLAGS   = -w Aelz -dtypes $(INCLUDES) @INCLUDEGTK2@ -thread -I +threads -I +sqlite3 @OCAMLGRAPHLIB@ str.cmxa unix.cmxa $(DYNLINKOFLAGS)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
71 72 73 74 75 76 77

COQC7  = @COQC7@
COQC8  = @COQC8@
COQDEP = @COQDEP@
COQLIB = "@COQLIB@"
COQVER = @COQVER@

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
78
GENERATED = src/version.ml src/parser/parser.mli src/parser/parser.ml \
79 80
            src/parser/lexer.ml src/driver/driver_lexer.ml \
            src/driver/driver_parser.mli src/driver/driver_parser.ml \
81
	    src/programs/pgm_lexer.ml src/programs/pgm_parser.mli \
82
	    src/programs/pgm_parser.ml src/driver/dynlink_compat.ml
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
83 84 85 86 87

# main targets
##############

BINARY=bin/why.$(OCAMLBEST)
88
BINARYL=bin/whyl.$(OCAMLBEST)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
89

Francois Bobot's avatar
Francois Bobot committed
90 91
TOOLS=bin/why-cpulimit

92
all: .depend $(BINARY) $(BINARYL) $(TOOLS) apidoc why-ide-@LABLGTK2@
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
93 94 95 96

# refrain parallel make (-j nn) from starting ocaml compilation too early 
*.cm*: .depend

97 98
opt: bin/why.opt bin/whyl.opt
byte: bin/why.byte bin/whyl.byte
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
99 100 101 102 103 104 105 106 107 108 109 110

.PHONY: check

PRELUDE=lib/why/prelude.why $(WHYLIBS)

# sanity check: the prelude files do typecheck
check: $(BINARY) $(PRELUDE)
	WHYLIB=lib $(BINARY) --no-pervasives -tc lib/why/prelude.why
	for f in $(WHYLIBS) ; do \
		WHYLIB=lib $(BINARY) -tc $$f; \
	done

111 112 113 114 115 116 117 118
# version number
################

include Version

doc/version.tex src/version.ml: Version version.sh config.status
	BINDIR=$(BINDIR) LIBDIR=$(LIBDIR) COQVER=$(COQVER) ./version.sh

MARCHE Claude's avatar
MARCHE Claude committed
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
src/orm/sql_orm_header.ml: src/orm/sql_access.ml src/orm/convert.ml 
	ocaml src/orm/convert.ml $< $@


ORM_CMO := printer_utils.cmo sql_orm_header.cmo sql_orm.cmo
ORM_CMO := $(addprefix src/orm/,$(ORM_CMO))

src/manager/db.ml: $(ORM_CMO) src/manager/orm_schema.ml
	ocaml -I src/orm src/manager/orm_schema.ml 

src/orm/%.cmo: src/orm/%.ml
	ocamlc -c -I src/orm -I +sqlite3 $<

src/manager/orm_schema.ml: $(ORM_CMO)

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
134
# why
135
#####
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
136

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
137
CORE_CMO := ident.cmo ty.cmo term.cmo pattern.cmo decl.cmo theory.cmo\
Francois Bobot's avatar
Francois Bobot committed
138
	task.cmo pretty.cmo trans.cmo env.cmo register.cmo
139
CORE_CMO := $(addprefix src/core/,$(CORE_CMO))
140

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
141 142
UTIL_CMO := pp.cmo loc.cmo prtree.cmo util.cmo hashcons.cmo \
            sysutil.cmo hashweak.cmo
143 144
UTIL_CMO := $(addprefix src/util/,$(UTIL_CMO))

145
PARSER_CMO := parser.cmo lexer.cmo denv.cmo typing.cmo 
146 147
PARSER_CMO := $(addprefix src/parser/,$(PARSER_CMO))

Francois Bobot's avatar
 
Francois Bobot committed
148
TRANSFORM_CMO := simplify_recursive_definition.cmo inlining.cmo\
149
	split_conjunction.cmo encoding_decorate.cmo\
150
	remove_logic_definition.cmo eliminate_inductive.cmo\
151
	compile_match.cmo eliminate_algebraic.cmo\
152
	eliminate_let.cmo eliminate_definition.cmo
153 154
TRANSFORM_CMO := $(addprefix src/transform/,$(TRANSFORM_CMO))

155 156 157
DRIVER_CMO := call_provers.cmo dynlink_compat.cmo driver_parser.cmo\
	driver_lexer.cmo driver.cmo
DRIVER_CMO := $(addprefix src/driver/,$(DRIVER_CMO))
158

MARCHE Claude's avatar
MARCHE Claude committed
159
PRINTER_CMO := print_real.cmo alt_ergo.cmo why3.cmo smt.cmo coq.cmo
160
PRINTER_CMO := $(addprefix src/printer/,$(PRINTER_CMO))
161

162 163 164 165
LIBCMO = $(UTIL_CMO) $(CORE_CMO) $(PARSER_CMO) $(DRIVER_CMO)\
         $(TRANSFORM_CMO) $(PRINTER_CMO)

CMO = $(LIBCMO) src/main.cmo
166
CMX = $(CMO:.cmo=.cmx)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
167

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
168
bin/why.opt: $(CMX) 
169
	echo $(UTIL_CMO) $(CORE_CMO) $(PARSER_CMO) $(TRANSFORM_CMO)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
170
	$(if $(QUIET),@echo 'Linking  $@' &&) $(OCAMLOPT) $(OFLAGS) -o $@ nums.cmxa $^
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
171 172
	$(STRIP) $@

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
173
bin/why.byte: $(CMO) 
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
174
	$(if $(QUIET),@echo 'Linking  $@' &&) $(OCAMLC) $(BFLAGS) -o $@ nums.cma $^
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
175 176

bin/why.static: $(CMX) src/why.cmx 
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
177
	$(if $(QUIET),@echo 'Linking  $@' &&) $(OCAMLOPT) -cclib -static $(OFLAGS) -o $@ nums.cmxa $^ 
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
178 179 180
	$(STRIP) $@

bin/top: $(CMO)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
181
	ocamlmktop $(BFLAGS) -o $@ nums.cma $^
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
182

MARCHE Claude's avatar
MARCHE Claude committed
183 184 185 186 187
MANAGER_CMO := db.cmo 
MANAGER_CMO := $(addprefix src/manager/,$(MANAGER_CMO))

bin/manager.byte: $(MANAGER_CMO)
	$(if $(QUIET),@echo 'Linking  $@' &&) $(OCAMLC) $(BFLAGS) \
MARCHE Claude's avatar
db  
MARCHE Claude committed
188
		-thread threads.cma sqlite3.cma -o $@ $^
MARCHE Claude's avatar
MARCHE Claude committed
189

190 191 192
# test targets
##############

Francois Bobot's avatar
Francois Bobot committed
193
test: bin/why.byte  $(TOOLS)
194
	mkdir -p output_why3
195
	ocamlrun -bt bin/why.byte -I theories/ --driver drivers/why3.drv \
MARCHE Claude's avatar
MARCHE Claude committed
196
		--output-dir output_why3 --all-goals src/test.why
197
	bin/why.byte --driver drivers/alt_ergo.drv -I theories/ \
MARCHE Claude's avatar
MARCHE Claude committed
198
		--output-file - --goal Test.G src/test.why --timeout 3
199
	bin/why.byte --driver drivers/alt_ergo.drv -I theories/ \
MARCHE Claude's avatar
MARCHE Claude committed
200
		--call --goal Test.G src/test.why --timeout 3
MARCHE Claude's avatar
MARCHE Claude committed
201 202
	bin/why.byte --driver drivers/coq.drv -I theories/ \
		--output-file tmp.v --goal Test.G src/test.why 
MARCHE Claude's avatar
MARCHE Claude committed
203 204
	echo bin/why.byte --call --timeout 1 --driver drivers/alt_ergo.drv -I theories/ \
		--all-goals theories/real.why 
MARCHE Claude's avatar
MARCHE Claude committed
205
	@rm -rf theories/coq
MARCHE Claude's avatar
MARCHE Claude committed
206 207 208
	@mkdir -p theories/coq
	@printf "*** Checking Coq file generation ***\\n"
	@for i in int.Abs int.EuclideanDivision int.ComputerDivision  \
MARCHE Claude's avatar
MARCHE Claude committed
209 210
		real.Abs real.FromIntTest real.SquareTest \
		real.ExpLogTest real.PowerTest real.TrigonometryTest \
MARCHE Claude's avatar
MARCHE Claude committed
211
		floating_point.Test array.TestBv32 \
MARCHE Claude's avatar
MARCHE Claude committed
212
		; do \
MARCHE Claude's avatar
MARCHE Claude committed
213
	  printf "Generating Coq file for $$i\\n" && bin/why.byte \
MARCHE Claude's avatar
MARCHE Claude committed
214 215 216 217
		--driver drivers/coq.drv -I theories/ \
		--output-dir theories/coq --goals-of $$i ; done
	@printf "*** Checking Coq compilation ***\\n"
	@for i in theories/coq/*.v; do printf "coq $$i\\n" && coqc $$i ; done
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
218

219
testl: bin/whyl.byte
220
	ocamlrun -bt bin/whyl.byte -I theories/ src/programs/test.mlw
221 222 223

examples/programs/%: bin/whyl.byte
	bin/whyl.byte -I theories examples/programs/$*.mlw
224

225 226 227
# programs
##########

228
PGM_CMO := pgm_parser.cmo pgm_lexer.cmo pgm_typing.cmo pgm_main.cmo
229 230
PGM_CMO := $(addprefix src/programs/, $(PGM_CMO))

231
WHYL_CMO = $(UTIL_CMO) $(CORE_CMO) $(PARSER_CMO) $(DRIVER_CMO)\
232
           $(TRANSFORM_CMO) $(PRINTER_CMO) $(PGM_CMO)
233 234 235 236 237 238 239 240 241
WHYL_CMX = $(WHYL_CMO:.cmo=.cmx)

bin/whyl.opt: $(WHYL_CMX) 
	$(if $(QUIET), @echo 'Linking  $@' &&) $(OCAMLOPT) $(OFLAGS) -o $@ nums.cmxa $^
	$(STRIP) $@

bin/whyl.byte: $(WHYL_CMO) 
	$(if $(QUIET),@echo 'Linking  $@' &&) $(OCAMLC) $(BFLAGS) -o $@ nums.cma $^

Francois Bobot's avatar
Francois Bobot committed
242 243 244 245 246 247
#tools
######

bin/why-cpulimit: src/tools/@CPULIMIT@.c
	$(CC) -o $@ $^

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
248
# graphical interface
249
#####################
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
250

251 252 253 254
IDE_CMO := ide_main.cmo
IDE_CMO := $(addprefix src/ide/,$(IDE_CMO))

GCMO = $(LIBCMO) $(IDE_CMO)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
255 256
GCMX = $(GCMO:.cmo=.cmx)

257 258 259
why-ide-yes: bin/why-ide.$(OCAMLBEST)
why-ide-no:
why-ide: bin/why-ide.$(OCAMLBEST)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
260

261 262
bin/why-ide.opt: $(GCMX)
	$(if $(QUIET),@echo 'Linking  $@' &&) $(OCAMLOPT) $(OFLAGS) -o $@ threads.cmxa nums.cmxa lablgtk.cmxa gtkThread.cmx $^
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
263 264
	$(STRIP)    $@

265 266
bin/why-ide.static: $(GCMX)
	$(if $(QUIET),@echo 'Linking  $@' &&) $(OCAMLOPT) -cclib -static $(OFLAGS) -o $@ threads.cmxa nums.cmxa lablgtk.cmxa gtkThread.cmx $^
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
267 268
	$(STRIP)    $@

269 270
bin/why-ide.byte: $(GCMO)
	$(if $(QUIET),@echo 'Linking  $@' &&) $(OCAMLC) $(BFLAGS) -o $@ nums.cma lablgtk.cma threads.cma gtkThread.cmo $^
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
271 272

# bench
273
#######
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
274 275 276 277 278

.PHONY: bench test

WHYVO=lib/coq/Why.vo

279 280
bench/bench : bench/bench.in config.status
	./config.status --file bench/bench
281

282 283
bench:: $(BINARY) $(BINARYL) bench/bench $(TOOLS)
	sh bench/bench "$(BINARY) -I theories/" "$(BINARYL) -I theories"
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
284

Francois Bobot's avatar
 
Francois Bobot committed
285
BENCH_PLUGINS_CMO := helloworld.cmo simplify_array.cmo
286 287 288 289
BENCH_PLUGINS_CMO := $(addprefix bench/plugins/,$(BENCH_PLUGINS_CMO))
BENCH_PLUGINS_CMXS := $(BENCH_PLUGINS_CMO:.cmo=.cmxs)


Francois Bobot's avatar
Francois Bobot committed
290

Francois Bobot's avatar
Francois Bobot committed
291 292
bench_plugins:: $(BENCH_PLUGINS_CMO) $(BENCH_PLUGINS_CMXS) $(BINARY) byte \
	$(TOOLS)
293
	bin/why.byte --driver bench/plugins/helloworld.drv -I theories/ \
294
        --output-file - --goal Test.G src/test.why
295
	bin/why.$(OCAMLBEST) --driver bench/plugins/helloworld.drv -I theories/ \
296
        --output-file - --goal Test.G src/test.why
297
	bin/why.$(OCAMLBEST) --driver bench/plugins/simplify_array.drv -I theories/ \
Francois Bobot's avatar
Francois Bobot committed
298
        --output-file - --goal  Test_simplify_array.G src/test.why
299

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
300 301 302
# installation
##############

303
install: install-binary install-lib install-man 
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
304

305
BINARYFILES = $(BINARY) bin/why-ide.$(OCAMLBEST) 
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
306 307

# install-binary should not depend on $(BINARYFILES); otherwise it
308
# enforces the compilation of why-ide, even when lablgtk2 is not installed
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
309 310 311
install-binary: 
	mkdir -p $(BINDIR)
	cp -f $(BINARY) $(BINDIR)/why$(EXE)
312 313
	if test -f bin/why-ide.$(OCAMLBEST); then \
		cp -f bin/why-ide.$(OCAMLBEST) $(BINDIR)/why-ide-bin$(EXE); \
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
314 315
	fi

316
install-lib: 
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
317
	mkdir -p $(LIBDIR)/why/why
318
#	cp -f $(PRELUDE) $(LIBDIR)/why/why
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355

install-man:
	mkdir -p $(MANDIR)/man1
	cp -f doc/*.1 $(MANDIR)/man1

install-coq-no:
install-coq-yes: install-coq-@COQVER@
install-coq-v7:
	mkdir -p $(LIBDIR)/why/coq7
	cp -f $(V7FILES) $(LIBDIR)/why/coq7
	cp -f $(VO7) $(LIBDIR)/why/coq7
install-coq-v8 install-coq-v8.1:
	if test -w $(COQLIB) ; then \
	 mkdir -p $(COQLIB)/user-contrib ; \
	 cp -f $(V8FILES) $(COQLIB)/user-contrib ; \
	 cp -f $(VO8) $(COQLIB)/user-contrib ; \
	else \
	echo "Cannot copy to Coq standard library. Add $(LIBDIR)/why/coq to Coq include path." ;\
	mkdir -p $(LIBDIR)/why/coq ;\
	cp -f $(VO8) $(V8FILES) $(LIBDIR)/why/coq ;\
	fi

install-pvs-no:
install-pvs-yes: $(PVSFILES)
	mkdir -p $(PVSLIB)/why
	cp $(PVSFILES) $(PVSFILES:.pvs=.prf) $(PVSLIB)/why
	cp lib/pvs/top.pvs lib/pvs/pvscontext.el $(PVSLIB)/why
	@echo "======  Compiling PVS theories, this may take some time ======"
	(cd $(PVSLIB)/why ; @PVSC@ -batch -l pvscontext.el -q -v 2 > top.out)
	@echo "======  Done compiling PVS theories ======"

install-mizar-no:
install-mizar-yes:
	mkdir -p @MIZARLIB@/mml/dict
	cp lib/mizar/why.miz @MIZARLIB@/mml
	cp lib/mizar/dict/why.voc @MIZARLIB@/mml/dict

356
local-install: $(BINARY) $(WHYCONFIG) $(CADUCEUS) $(JESSIE) bin/why-ide.$(OCAMLBEST) byte bin/why-ide.byte 
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
357 358 359 360
	cp $(BINARY) $$HOME/bin/why
	cp $(WHYCONFIG) $$HOME/bin/why
	cp $(CADUCEUS) $$HOME/bin/caduceus
	cp $(JESSIE) $$HOME/bin/jessie
361 362
	if test -f bin/why-ide.$(OCAMLBEST); then \
	  cp -f bin/why-ide.$(OCAMLBEST) $$HOME/bin/why-ide; \
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 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 420 421 422 423 424 425 426 427 428 429 430 431 432 433
	fi

local: install
# local: bin/why.opt $(CADUCEUS) $(WHY2HTML) $(DP) $(RVMERGE) coq-@COQ@
# 	cp -f bin/why.opt $$HOME/bin/$$OSTYPE/why
# 	cp -f $(CADUCEUS) $$HOME/bin/$$OSTYPE/caduceus
# 	cp -f $(WHY2HTML) $$HOME/bin/$$OSTYPE/why2html
# 	cp -f $(DP) $$HOME/bin/$$OSTYPE/dp
# 	cp -f $(RVMERGE) $$HOME/bin/$$OSTYPE/rv_merge
# #	mkdir -p $(COQLIB)/contrib7/why
# #	cp -f $(VO7) $(VFILES) $(COQLIB)/contrib7/why
# #	mkdir -p $(COQLIB)/contrib/why
# #	cp -f $(VO8) $(VFILES) $(COQLIB)/contrib/why
# 	mkdir -p $(PVSLIB)/why
# 	cp $(PVSFILES) $(PVSLIB)/why
# 	mkdir -p $(MIZFILES)/mml/dict
# 	cp lib/mizar/why.miz $(MIZFILES)/mml
# 	cp lib/mizar/dict/why.voc $(MIZFILES)/mml/dict
# 	mkdir -p $$HOME/man/man1
# 	cp -f doc/*.1 $$HOME/man/man1

demons: $(STATICBINARY) doc/manual.ps
	cp -f $(STATICBINARY) /users/demons/demons/bin/$$OSTYPE/why
	cp doc/manual.ps /users/demons/demons/docs/why.ps

win: why.nsi
	"/cygdrive/c/Program Files (x86)/NSIS/makensis" /DVERSION=$(VERSION) why.nsi

zip:
	zip -A -r why-$(VERSION).zip c:/why/bin c:/why/lib c:/coq/lib/contrib/why c:/coq/lib/contrib7/why

# doc

DOC=doc/manual.ps doc/manual.html doc/caduceus.ps doc/caduceus.html \
	doc/krakatoa.pdf doc/krakatoa.html \
	doc/main.pdf doc/main.html

doc:: $(DOC)


doc/manual.ps: doc/manual.tex doc/version.tex
	make -C doc manual.ps

# doc/version.tex: Version Makefile.in
#	echo '\newcommand{\whyversion}'"{$(VERSION)}" > $@
#	echo '\newcommand{\caduceusversion}'"{$(CVERSION)}" >> $@
#	echo '\newcommand{\jessieversion}'"{$(JCVERSION)}" >> $@
#	echo '\newcommand{\krakatoaversion}'"{$(KVERSION)}" >> $@

doc/manual.html: doc/manual.tex doc/version.tex
	make -C doc manual.html

doc/caduceus.ps: doc/caduceus.tex doc/version.tex
	make -C doc caduceus.ps

doc/caduceus.html: doc/caduceus.tex doc/version.tex
	make -C doc caduceus.html

doc/krakatoa.pdf: doc/krakatoa.tex doc/version.tex
	make -C doc krakatoa.pdf

doc/krakatoa.html: doc/krakatoa.tex doc/version.tex
	make -C doc krakatoa.html

doc/main.pdf: doc/main.tex doc/version.tex
	make -C doc main.pdf

doc/main.html: doc/main.tex doc/version.tex
	make -C doc main.html


MARCHE Claude's avatar
API doc  
MARCHE Claude committed
434
# API DOC
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
435 436
##############

MARCHE Claude's avatar
API doc  
MARCHE Claude committed
437 438 439
APIDOCSRC = $(UTIL_CMO:.cmo=.mli) $(CORE_CMO:.cmo=.mli) \
	src/driver/call_provers.mli \
	src/driver/driver.mli \
MARCHE Claude's avatar
MARCHE Claude committed
440
	src/manager/state.mli
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
441

MARCHE Claude's avatar
API doc  
MARCHE Claude committed
442 443 444 445 446 447 448
.PHONY: apidoc

apidoc: $(APIDOCSRC)
	rm -f apidoc/* 
	mkdir -p apidoc
	$(OCAMLDOC) -d apidoc -html -I src/util -I src/core -I src/driver \
		$(APIDOCSRC)
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467


# special rules
###############

# CAMLP4=@CAMLP4O@ pa_extend.cmo pa_macro.cmo

# src/%.cmo: src/%.ml4
# 	$(OCAMLC) -c $(BFLAGS) -pp "$(CAMLP4) -DOCAML@OCAMLV@ -impl" -impl $<

# src/%.cmx: src/%.ml4
# 	$(OCAMLOPT) -c $(OFLAGS) -pp "$(CAMLP4) -DOCAML@OCAMLV@ -impl" -impl $<

# src/%.ml: src/%.ml4
# 	$(CAMLP4) pr_o.cmo -DOCAML@OCAMLV@ -impl $< > $@

# generic rules
###############

468
.SUFFIXES: .mli .ml .cmi .cmo .cmx .mll .mly .v .vo .ml4 .cmxs
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484

.mli.cmi:
	$(if $(QUIET),@echo 'Ocamlc   $<' &&) $(OCAMLC) $(APRONLIB) $(ATPLIB) -c $(BFLAGS) $<

.ml.cmi:
	$(if $(QUIET),@echo 'Ocamlc   $<' &&) $(OCAMLC) $(APRONLIB) $(ATPLIB) -c $(BFLAGS) $<

.ml.cmo:
	$(if $(QUIET),@echo 'Ocamlc   $<' &&) $(OCAMLC) $(APRONLIB) $(ATPLIB) -c $(BFLAGS) $<

.ml.o:
	$(OCAMLOPT) $(APRONLIB) $(ATPLIB) -c $(OFLAGS) $<

.ml.cmx:
	$(if $(QUIET),@echo 'Ocamlopt $<' &&) $(OCAMLOPT) $(APRONLIB) $(ATPLIB) -c $(OFLAGS) $<

Francois Bobot's avatar
 
Francois Bobot committed
485
%.cmxs: %.ml %.cmx
Francois Bobot's avatar
Francois Bobot committed
486
	$(if $(QUIET),@echo 'Ocamlopt $<' &&) $(OCAMLOPT) -shared $(INCLUDES) -o $@ $<
487

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524
.mll.ml:
	$(OCAMLLEX) $<

.mly.ml:
	$(OCAMLYACC) -v $<

.mly.mli:
	$(OCAMLYACC) -v $<

.ml4.ml:
	$(CAMLP4) pr_o.cmo -impl $< > $@

lib/coq/%.vo: lib/coq/%.v
	$(COQC8) -I lib/coq $<

lib/coq-v7/%.vo: lib/coq-v7/%.v
	$(COQC7) -I lib/coq-v7 $<

jc/jc_ai.ml: jc/jc_annot_inference.ml jc/jc_annot_fail.ml Makefile
	if test "@enable_apron@" = "yes" ; then \
	  echo "# 1 \"jc/jc_annot_inference.ml\"" > jc/jc_ai.ml; \
	  cat jc/jc_annot_inference.ml >> jc/jc_ai.ml; \
	else \
	  echo "# 1 \"jc/jc_annot_fail.ml\"" > jc/jc_ai.ml; \
	  cat jc/jc_annot_fail.ml >> jc/jc_ai.ml; \
	fi

# %_why.v: %.mlw $(BINARY)
# 	$(BINARY) -coq $*.mlw

# %_why.pvs: %.mlw $(BINARY)
# 	$(BINARY) -pvs $*.mlw

# Emacs tags
############

tags:
Francois Bobot's avatar
 
Francois Bobot committed
525
	find src -regex ".*\.ml[^#]*" | grep -v ".svn" | sort -r | xargs \
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
526 527 528 529 530 531 532 533 534 535 536 537
	etags "--regex=/let[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/let[ \t]+rec[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/and[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/type[ \t]+\([^ \t]+\)/\1/" \
              "--regex=/exception[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/val[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/module[ \t]+\([^ \t]+\)/\1/"

otags:
	otags src/*.mli src/*.ml c/*.mli c/*.ml intf/*.mli intf/*.ml

wc:
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
538
	ocamlwc -p src/*.ml* src/*/*.ml*
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
539

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
540 541
dep: 
	$(MAKE) depend
542 543
	cat .depend | ocamldot | dot -Tpdf > dep.pdf
	$(PDFVIEWER) dep.pdf
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
544

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
545 546 547 548 549 550 551 552 553 554
# distrib
#########

NAME=why-$(VERSION)
EXPORT=export/$(NAME)

WWW = /users/www-perso/projets/why
FTP = $(WWW)/download
WWWKRAKATOA = /users/www-perso/projets/krakatoa

555
FILES =src/*.ml* c/*.ml* jc/*.ml* java/*.ml* ml/*.ml* ml/*/*.ml* intf/*.ml* tools/*.ml* tools/*.c bin/why-ide.sh \
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657
       mix/*.ml* \
       version.sh Version Makefile.in configure.in configure .depend .depend.coq \
       config/check_ocamlgraph.ml \
       README INSTALL COPYING LICENSE CHANGES \
       doc/Makefile doc/manual.ps doc/why.1 \
	examples-c/*/*.h examples-c/*/*.c \
	examples-c/Makefile examples-c/*/Makefile \
	examples-c/*/coq/*.v \
	examples/Makefile* \
	examples/*/*.mlw examples/*/*.why examples/*/*.v examples/*/*.sx \
	examples/*/.depend examples/*/Makefile \
	bench/bench.in bench/good*/*.mlw bench/good*/*.v \
        bench/c/bench bench/c/bench-files bench/c/*/*.c bench/c/*/*/*.c \
	bench/jc/bench bench/jc/good/*.jc \
	bench/java/bench bench/java/*/*.java bench/provers/*.mlw \
	tests/regtest.sh tests/java/*.java \
	tests/java/coq/*.v \
	tests/java/result/README tests/java/oracle/*.oracle \
	lib/coq*/*.v \
	lib/pvs/pvscontext.el lib/pvs/*.pvs lib/pvs/*.prf \
	lib/mizar/why.miz lib/mizar/dict/why.voc \
	lib/why/*.why lib/isabelle/*.thy lib/hol4/*.ml lib/harvey/*.rv \
	lib/java_api/java/*/*.java \
	lib/javacard_api/java/lang/*.java \
	lib/javacard_api/javacard/*/*.java \
	lib/javacard_api/javacardx/crypto/*.java \
	lib/javacard_api/com/sun/javacard/impl/*.java \
	lib/images/*.png \
	atp/*.ml atp/LICENSE.txt atp/Makefile atp/Mk_ml_file \
	ocamlgraph/configure.in ocamlgraph/configure ocamlgraph/.depend \
	ocamlgraph/Makefile.in ocamlgraph/META.in ocamlgraph/*/*.ml* \
        frama-c-plugin/Makefile frama-c-plugin/configure \
	frama-c-plugin/*.ml* frama-c-plugin/share/jessie/*.h 

# ne pas distribuer ces tests-la	frama-c-plugin/tests/jessie/*.c

distrib export: source export-doc export-www export-examples export-examples-c linux

export-www:
	echo "<#def version>$(VERSION)</#def>" > /users/demons/filliatr/www/why/version.prehtml
	echo "<#def cversion>$(CVERSION)</#def>" >> /users/demons/filliatr/www/why/version.prehtml
	make -C /users/demons/filliatr/www/why install

source: export/$(NAME).tar.gz
	cp CHANGES CHANGES.caduceus export/$(NAME).tar.gz $(FTP)

export/$(NAME).tar.gz: $(FILES)
	rm -rf $(EXPORT)
	mkdir -p $(EXPORT)/bin
	cp --parents $(FILES) $(EXPORT)
	cd $(EXPORT); rm -f $(GENERATED)
	cd export; tar cf $(NAME).tar $(NAME); gzip -f --best $(NAME).tar

tarball-for-framac: 
	make tarball
	cp export/$(NAME).tar.gz export/why-for-framac.tar.gz

tarball: 
	mkdir -p export
	cd export; rm -rf $(NAME) $(NAME).tar.gz
	make export/$(NAME).tar.gz

EXFILES = lib/coq*/*.v examples/*/*.v examples/*/*.mlw

export-examples:
	cp --parents $(EXFILES) $(WWW)
	make -C $(WWW)/examples clean depend
	echo "*** faire make all dans $(WWW)/examples ***"

export-examples-c:
	mkdir -p $(WWW)/caduceus/examples
	cd examples-c; cp --parents */*.c */*.h $(WWW)/caduceus/examples
	mkdir -p $(WWW)/caduceus/examples/bench
	cp bench/c/good/*.c $(WWW)/caduceus/examples/bench
	rm -f $(WWW)/caduceus/examples/bench/test.c

export-doc: $(DOC)
	cp doc/manual.ps doc/manual.html $(WWW)/manual
	cp doc/logic_syntax.bnf $(WWW)/manual
	(cd $(WWW)/manual; hacha manual.html)
	cp doc/caduceus.ps doc/caduceus.html $(WWW)/caduceus/manual
	(cd $(WWW)/caduceus/manual; hacha caduceus.html)
	cp doc/krakatoa.pdf doc/krakatoa.html $(WWWKRAKATOA)/manual
	(cd $(WWWKRAKATOA)/manual; hacha krakatoa.html)

OSTYPE  ?= linux

BINARYNAME = $(NAME)-$(OSTYPE)

linux: binary

ALLBINARYFILES = $(FILES) $(BINARYFILES) 

binary: $(ALLBINARYFILES)
	mkdir -p export/$(BINARYNAME)
	cp --parents $(ALLBINARYFILES) export/$(BINARYNAME)
	(cd export; tar czf $(BINARYNAME).tar.gz $(BINARYNAME))
	cp export/$(BINARYNAME).tar.gz $(FTP)

# file headers
##############
headers:
Jean-Christophe Filliâtre's avatar
headers  
Jean-Christophe Filliâtre committed
658 659
	headache -c misc/headache_config.txt -h misc/header.txt \
		Makefile.in configure.in \
660
		*/*.ml */*/*.ml */*/*.ml[ily4] 
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
661 662 663 664

# myself
########
Makefile: Makefile.in config.status
665
	./config.status --file Makefile
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
666 667 668 669 670 671 672

config.status: configure
	./config.status --recheck

configure: configure.in
	autoconf 

673
src/driver/dynlink_compat.ml: src/driver/dynlink_compat.ml.in config.status
674
	./config.status --file src/driver/dynlink_compat.ml
675

Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
676 677 678 679 680
# clean and depend
##################

clean::
	rm -f src/*.cm[iox] src/*.o src/*~ src/*.annot src/*.output
681
	rm -f src/*/*.cm[iox] src/*/*.o src/*/*~ src/*/*.annot src/*/*.output
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704
	rm -f c/*.cm[iox] c/*.o c/*~ c/*.annot c/*.output
	rm -f intf/*.cm[iox] intf/*.o intf/*~ intf/*.annot
	rm -f tools/*.cm[iox] tools/*.o tools/*~ tools/*.annot
	rm -f jc/*.cm[iox] jc/*.o jc/*~ jc/*.annot jc/*.output
	rm -f java/*.cm[iox] java/*.o java/*~ java/*.annot java/*.output
	rm -f ml/*.cm[iox] ml/*.o ml/*~ ml/*.annot
	rm -f ml/parsing/*.cm[iox] ml/parsing/*.o ml/parsing/*~ \
		ml/parsing/*.annot ml/parsing/*.output
	rm -f ml/utils/*.cm[iox] ml/utils/*.o ml/utils/*~ ml/utils/*.annot
	rm -f ml/typing/*.cm[iox] ml/typing/*.o ml/typing/*~ ml/typing/*.annot
	rm -f bin/why.opt bin/why.byte bin/why.static bin/top
	rm -f bin/caduceus.opt bin/caduceus.byte
	rm -f bin/jessie.opt bin/jessie.byte
	rm -f bin/jessica.opt bin/jessica.byte
	rm -f bin/why-obfuscator.opt bin/why-obfuscator.byte
	rm -f bin/rv_merge.opt bin/rv_merge.byte
	rm -f bin/why-stat.opt bin/why-stat.byte
	rm -f bin/tool-stat.opt bin/tool-stat.byte
	rm -f bin/why2html.opt bin/why2html.byte
	rm -f bin/why-dp.opt bin/why-dp.byte
	rm -f bin/why-cpulimit
	rm -f lib/coq*/*.vo lib/coq*/*~
	rm -f $(GENERATED)
705 706
	rm -rf output_why3
	rm -f ergo.why
707
	rm -rf bench/plugins/*.cm[iox]* bench/plugins/*.annot
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724
#	make -C atp clean
#	make -C doc clean
#	if test -d examples-v7; then \
#		make -C examples-v7 clean ; \
#	fi
#	make -C examples clean

dist-clean:: clean
	rm -f Makefile config.status config.cache config.log

coq-clean::
	rm -f lib/coq*/*.vo examples/*/*.vo
	rm .depend.coq

.PHONY: depend
.depend depend: $(GENERATED)
	rm -f .depend
725
	$(OCAMLDEP) -slash $(INCLUDES) src/*/*.ml src/*/*.mli src/*.ml src/*.mli bench/plugins/*.ml > .depend
Jean-Christophe Filliâtre's avatar
Jean-Christophe Filliâtre committed
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760
ifeq ($(FRAMAC),yes)
#	$(MAKE) -C $(JESSIE_PLUGIN_PATH) depend
endif

.depend.coq: #lib/coq*/*.v
	if test @COQ@ = yes; then \
	  rm -f .depend.coq; \
	  $(COQDEP) -I lib/coq lib/coq/*.v > .depend.coq; \
	  $(COQDEP) -I lib/coq-v7 lib/coq-v7/*.v >> .depend.coq; \
	else touch .depend.coq; \
	fi

alldepend:
	make -C examples-v7 depend
	make -C examples depend

include .depend
include .depend.coq

#################################################################
# Building the Why platform with ocamlbuild (OCaml 3.10 needed) #
#################################################################

# There used to be targets here but they are no longer useful.

# To build using Ocamlbuild:
# 1) Run "make Makefile" to ensure that the generated files (version.ml, ...)
# are generated.
# 2) Run Ocamlbuild with any target to generate the sanitization script.
# 3) Run ./sanitize to delete the generated files that shouldn't be generated
# (i.e. all lexers and parsers).
# 4) Run Ocamlbuild with the target you need, for example:
# ocamlbuild jc/jc_main.native

# You can also use the Makefile ./build.makefile which has some handy targets.