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

# 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)
11
	COQ_MAKEFILE_FLAGS += -arg -w -arg -notation-overridden,-redundant-canonical-projection,-several-object-files
Ralf Jung's avatar
Ralf Jung committed
12 13 14
endif

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

all: Makefile.coq
19
	+@make -f Makefile.coq all
Zhen Zhang's avatar
Zhen Zhang committed
20 21

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

26 27
# Create Coq Makefile. POSIX awk can't do in-place editing, but coq_makefile wants the real filename, so we do some file gymnastics.
Makefile.coq: _CoqProject Makefile awk.Makefile
Ralf Jung's avatar
Ralf Jung committed
28
	coq_makefile $(COQ_MAKEFILE_FLAGS) -f _CoqProject -o Makefile.coq
29
	mv Makefile.coq Makefile.coq.tmp && awk -f awk.Makefile Makefile.coq.tmp > Makefile.coq && rm Makefile.coq.tmp
Ralf Jung's avatar
Ralf Jung committed
30 31 32 33 34 35 36 37 38

# 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-atomic "$$(pwd)#HEAD" -k git -n -y
	opam install coq-iris-atomic --deps-only $(YFLAG)
	opam pin remove coq-iris-atomic

39
# Some files that do *not* need to be forwarded to Makefile.coq
Zhen Zhang's avatar
Zhen Zhang committed
40
Makefile: ;
Ralf Jung's avatar
Ralf Jung committed
41
_CoqProject: ;
42
awk.Makefile: ;
Zhen Zhang's avatar
Zhen Zhang committed
43

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