-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
44 lines (36 loc) · 1.17 KB
/
Makefile
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
SRC_DIRS := 'src' $(shell test -d 'vendor' && echo 'vendor')
ALL_VFILES := $(shell find $(SRC_DIRS) -name "*.v")
TEST_VFILES := $(shell find 'src' -name "*Tests.v")
PROJ_VFILES := $(shell find 'src' -name "*.v")
VFILES := $(filter-out $(TEST_VFILES),$(PROJ_VFILES))
COQARGS := -w +all
default: $(VFILES:.v=.vo)
test: $(TEST_VFILES:.v=.vo) $(VFILES:.v=.vo)
_CoqProject: libname $(wildcard vendor/*)
@echo "-R src $$(cat libname)" > $@
@for libdir in $(wildcard vendor/*); do \
libname=$$(cat $$libdir/libname); \
if [ $$? -ne 0 ]; then \
echo "Do you need to run git submodule update --init --recursive?" 1>&2; \
exit 1; \
fi; \
echo "-R $$libdir/src $$(cat $$libdir/libname)" >> $@; \
done
@echo "_CoqProject:"
@cat $@
.coqdeps.d: $(ALL_VFILES) _CoqProject
@echo "COQDEP $@"
@coqdep -f _CoqProject $(ALL_VFILES) > $@
ifneq ($(MAKECMDGOALS), clean)
-include .coqdeps.d
endif
%.vo: %.v _CoqProject
@echo "COQC $<"
@coqc $(COQARGS) $(shell cat '_CoqProject') $< -o $@
clean:
@echo "CLEAN vo glob aux"
@rm -f $(ALL_VFILES:.v=.vo) $(ALL_VFILES:.v=.glob)
@find $(SRC_DIRS) -name ".*.aux" -exec rm {} \;
rm -f _CoqProject .coqdeps.d
.PHONY: default test clean
.DELETE_ON_ERROR: