Makefile 1.63 KB
Newer Older
1 2 3
# Permit local customization
-include Makefile.local

Ralf Jung's avatar
Ralf Jung committed
4
# Forward most targets to Coq makefile (with some trick to make this phony)
5
%: Makefile.coq phony
6
	+@make -f Makefile.coq $@
7

8
all: Makefile.coq
9
	+@make -f Makefile.coq all
Ralf Jung's avatar
Ralf Jung committed
10
.PHONY: all
11 12

clean: Makefile.coq
13
	+@make -f Makefile.coq clean
14
	find theories tests exercises solutions \( -name "*.d" -o -name "*.vo" -o -name "*.vo[sk]" -o -name "*.aux" -o -name "*.cache" -o -name "*.glob" -o -name "*.vio" \) -print -delete || true
Ralf Jung's avatar
Ralf Jung committed
15
	rm -f Makefile.coq .lia.cache
Ralf Jung's avatar
Ralf Jung committed
16
.PHONY: clean
17

18
# Create Coq Makefile.
Ralf Jung's avatar
Ralf Jung committed
19
Makefile.coq: _CoqProject Makefile
20
	"$(COQBIN)coq_makefile" -f _CoqProject -o Makefile.coq $(EXTRA_COQFILES)
21

Ralf Jung's avatar
Ralf Jung committed
22
# Install build-dependencies
Ralf Jung's avatar
Ralf Jung committed
23
build-dep/opam: opam Makefile
24
	@echo "# Creating build-dep package."
Ralf Jung's avatar
Ralf Jung committed
25
	@mkdir -p build-dep
Ralf Jung's avatar
Ralf Jung committed
26
	@sed <opam -E 's/^(build|install|remove):.*/\1: []/; s/^name: *"(.*)" */name: "\1-builddep"/' >build-dep/opam
Ralf Jung's avatar
Ralf Jung committed
27 28 29
	@fgrep builddep build-dep/opam >/dev/null || (echo "sed failed to fix the package name" && exit 1) # sanity check

build-dep: build-dep/opam phony
30 31 32 33
	@# We want opam to not just instal the build-deps now, but to also keep satisfying these
	@# constraints.  Otherwise, `opam upgrade` may well update some packages to versions
	@# that are incompatible with our build requirements.
	@# To achieve this, we create a fake opam package that has our build-dependencies as
34
	@# dependencies, but does not actually install anything itself.
Ralf Jung's avatar
Ralf Jung committed
35 36
	@echo "# Installing build-dep package."
	@opam install $(OPAMFLAGS) build-dep/
37

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

Ralf Jung's avatar
Ralf Jung committed
44
# Phony wildcard targets
45
phony: ;
Ralf Jung's avatar
Ralf Jung committed
46
.PHONY: phony