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

# Forward most targets to Coq makefile (with some trick to make this phony)
7 8
%: Makefile.coq phony
	+@make -f Makefile.coq $@
Zhen Zhang's avatar
Zhen Zhang committed
9 10

all: Makefile.coq
11
	+@make -f Makefile.coq all
Zhen Zhang's avatar
Zhen Zhang committed
12 13

clean: Makefile.coq
14
	+@make -f Makefile.coq clean
15
	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
16 17
	rm -f Makefile.coq

18 19
# 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
20
	coq_makefile -f _CoqProject -o Makefile.coq
21
	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
22 23 24 25 26

# 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
Ralf Jung's avatar
Ralf Jung committed
27 28 29
	opam pin add opam-builddep-temp "$$(pwd)#HEAD" -k git -n -y
	opam install opam-builddep-temp --deps-only $(YFLAG)
	opam pin remove opam-builddep-temp
Ralf Jung's avatar
Ralf Jung committed
30

31
# Some files that do *not* need to be forwarded to Makefile.coq
Zhen Zhang's avatar
Zhen Zhang committed
32
Makefile: ;
Ralf Jung's avatar
Ralf Jung committed
33
_CoqProject: ;
34
awk.Makefile: ;
Zhen Zhang's avatar
Zhen Zhang committed
35

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