Makefile 1.8 KB
Newer Older
1
# Forward most targets to Coq makefile (with some trick to make this phony)
2
%: Makefile.coq phony
3
	+@make -f Makefile.coq $@
4 5

all: Makefile.coq
6 7
	+@make -f Makefile.coq all
.PHONY: all
8 9

clean: Makefile.coq
10 11
	+@make -f Makefile.coq clean
	find theories tests \( -name "*.d" -o -name "*.vo" -o -name "*.aux" -o -name "*.cache" -o -name "*.glob" -o -name "*.vio" \) -print -delete || true
Ralf Jung's avatar
Ralf Jung committed
12
	rm -f Makefile.coq .lia.cache
13
.PHONY: clean
14

15
# Create Coq Makefile.
16
Makefile.coq: _CoqProject Makefile
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
	"$(COQBIN)coq_makefile" -f _CoqProject -o Makefile.coq

# Install build-dependencies
build-dep/opam: opam Makefile
	@echo "# Creating build-dep package."
	@mkdir -p build-dep
	@sed <opam -E 's/^(build|install|remove):.*/\1: []/; s/^name: *"(.*)" */name: "\1-builddep"/' >build-dep/opam
	@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
	@# 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
	@# dependencies, but does not actually install anything itself.
	@echo "# Pinning build-dep package." && \
	  if opam --version | grep "^1\." -q; then \
	    BUILD_DEP_PACKAGE="$$(egrep "^name:" build-dep/opam | sed 's/^name: *"\(.*\)" */\1/')" && \
	    opam pin add -k path $(OPAMFLAGS) "$$BUILD_DEP_PACKAGE".dev build-dep && \
	    opam reinstall $(OPAMFLAGS) "$$BUILD_DEP_PACKAGE"; \
	  else \
	    opam install $(OPAMFLAGS) build-dep/; \
	  fi

# Some files that do *not* need to be forwarded to Makefile.coq
42
Makefile: ;
43 44
_CoqProject: ;
opam: ;
45

46
# Phony wildcard targets
47
phony: ;
48
.PHONY: phony