aboutsummaryrefslogtreecommitdiff
path: root/mathcomp/Makefile
blob: 880977cc00dcafde72a2f904dca72dbad17caadd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
42
43
44
H=@

ifeq "$(COQBIN)" ""
COQBIN=$(dir $(shell which coqtop))/
endif

ifeq "$(shell $(COQBIN)/coqtop -v | head -1 | grep trunk | wc -l | sed 's/ *//g')" "1"
V=trunk
else
V=$(shell $(COQBIN)/coqtop -v | head -1 | \
  sed 's/.*version \([0-9]\.[0-9]\)[^ ]* .*/v\1/')
endif

ifeq "$V" "v8.4"
COQDEP=../etc/utils/ssrcoqdep
else
COQDEP=$(COQBIN)/coqdep
endif

OLD_MAKEFLAGS:=$(MAKEFLAGS)
MAKEFLAGS+=-B

.DEFAULT_GOAL := all

%:
	$(H)[ -e Makefile.coq ] || $(call coqmakefile)
	# Override COQDEP to find only the "right" copy .ml files
	$(H)MAKEFLAGS=$(OLD_MAKEFLAGS) $(MAKE) --no-print-directory \
		-f Makefile.coq $* \
		COQDEP='$(COQDEP) -exclude-dir plugin -c'

define coqmakefile
	(echo "Generating Makefile.coq for Coq $(V) with COQBIN=$(COQBIN)";\
	ln -sf ssreflect/plugin/$(V)/ssreflect.mllib .;\
	ln -sf ssreflect/plugin/$(V)/ssrmatching.mli .;\
	ln -sf ssreflect/plugin/$(V)/ssrmatching.ml4 .;\
	ln -sf ssreflect/plugin/$(V)/ssreflect.ml4 .;\
	$(COQBIN)/coq_makefile -f Make -o Makefile.coq)
endef

clean:
	$(H)MAKEFLAGS=$(OLD_MAKEFLAGS) $(MAKE) --no-print-directory \
		-f Makefile.coq clean
	$(H)rm -f Makefile.coq