Makefile 1.91 KB
Newer Older
Ralf Jung's avatar
Ralf Jung committed
1 2 3 4 5
# Process flags
ifeq ($(Y), 1)
	YFLAG=-y
endif

6 7 8 9 10
# Determine Coq version
COQ_VERSION=$(shell coqc --version | egrep -o 'version 8.[0-9]' | egrep -o '8.[0-9]')
COQ_MAKEFILE_FLAGS ?=

ifeq ($(COQ_VERSION), 8.6)
Ralf Jung's avatar
Ralf Jung committed
11
	COQ_MAKEFILE_FLAGS += -arg -w -arg -notation-overridden,-redundant-canonical-projection,-several-object-files
12
endif
13

Ralf Jung's avatar
Ralf Jung committed
14
# Forward most targets to Coq makefile (with some trick to make this phony)
15
%: Makefile.coq phony
16
	+@make -f Makefile.coq $@
17

18
all: Makefile.coq
19
	+@make -f Makefile.coq all
20 21

clean: Makefile.coq
22
	+@make -f Makefile.coq clean
23
	find \( -name "*.v.d" -o -name "*.vo" -o -name "*.aux" -o -name "*.cache" -o -name "*.glob" -o -name "*.vio" \) -print -delete
24 25
	rm -f Makefile.coq

Ralf Jung's avatar
Ralf Jung committed
26
# Create Coq Makefile
27
Makefile.coq: _CoqProject Makefile
Ralf Jung's avatar
Ralf Jung committed
28
	@# we want to pass the correct name to coq_makefile or it will be confused.
29 30
	coq_makefile $(COQ_MAKEFILE_FLAGS) -f _CoqProject -o Makefile.coq
	mv Makefile.coq Makefile.coq.tmp
Ralf Jung's avatar
Ralf Jung committed
31 32
	@# The sed script is for Coq 8.5 only, it fixes 'make verify'.
	@# The awk script fixes 'make uninstall'.
33
	sed 's/$$(COQCHK) $$(COQCHKFLAGS) $$(COQLIBS)/$$(COQCHK) $$(COQCHKFLAGS) $$(subst -Q,-R,$$(COQLIBS))/' < Makefile.coq.tmp \
34
	  | awk '/^uninstall:/{print "uninstall:";print "\tif [ -d \"$$(DSTROOT)\"$$(COQLIBINSTALL)/iris/ ]; then find \"$$(DSTROOT)\"$$(COQLIBINSTALL)/iris/ -name \"*.vo\" -print -delete; fi";getline;next}1' > Makefile.coq
35
	rm Makefile.coq.tmp
36

Ralf Jung's avatar
Ralf Jung committed
37 38 39 40 41 42 43
# Install build-dependencies
build-dep:
	build/opam-pins.sh < opam.pins
	opam upgrade $(YFLAG) # it is not nice that we upgrade *all* packages here, but I found no nice way to upgrade only those that we pinned
	opam pin add coq-iris "$$(pwd)#HEAD" -k git -n -y
	opam install coq-iris --deps-only $(YFLAG)
	opam pin remove coq-iris
44

Ralf Jung's avatar
Ralf Jung committed
45
# some fiels that do *not* need to be forwarded to Makefile.coq
46
Makefile: ;
Ralf Jung's avatar
Ralf Jung committed
47
_CoqProject: ;
48

Ralf Jung's avatar
Ralf Jung committed
49
# Phony targets (i.e. targets that should be run no matter the timestamps of the involved files)
50
phony: ;
51
.PHONY: all clean phony