-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
68 lines (50 loc) · 1.79 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
TRILLIUM_DIR := 'trillium'
FAIRIS_DIR := 'fairis'
LOCAL_SRC_DIRS := $(TRILLIUM_DIR) $(FAIRIS_DIR)
SRC_DIRS := $(LOCAL_SRC_DIRS) 'external'
ALL_VFILES := $(shell find $(SRC_DIRS) -name "*.v")
VFILES := $(shell find $(LOCAL_SRC_DIRS) -name "*.v")
COQC := coqc
Q:=@
# extract global arguments for Coq from _CoqProject
COQPROJECT_ARGS := $(shell sed -E -e '/^\#/d' -e 's/-arg ([^ ]*)/\1/g' _CoqProject)
all: $(VFILES:.v=.vo)
.coqdeps.d: $(ALL_VFILES) _CoqProject
@echo "COQDEP $@"
$(Q)coqdep -vos -f _CoqProject $(ALL_VFILES) > $@
# do not try to build dependencies if cleaning or just building _CoqProject
ifeq ($(filter clean,$(MAKECMDGOALS)),)
include .coqdeps.d
endif
%.vo: %.v _CoqProject | .coqdeps.d
@echo "COQC $<"
$(Q)$(COQC) $(COQPROJECT_ARGS) $(COQ_ARGS) -o $@ $<
%.vos: %.v _CoqProject | .coqdeps.d
@echo "COQC -vos $<"
$(Q)$(COQC) $(COQPROJECT_ARGS) -vos $(COQ_ARGS) $< -o $@
%.vok: %.v _CoqProject | .coqdeps.d
@echo "COQC -vok $<"
$(Q)$(COQC) $(COQPROJECT_ARGS) -vok $(COQ_ARGS) $< -o $@
clean:
@echo "CLEAN vo glob aux"
$(Q)find $(SRC_DIRS) \( -name "*.vo" -o -name "*.vo[sk]" \
-o -name ".*.aux" -o -name ".*.cache" -o -name "*.glob" \) -delete
$(Q)rm -f .lia.cache
rm -f .coqdeps.d
# project-specific targets
.PHONY: build clean-trillium clean-fairis trillium fairis
VPATH= $(TRILLIUM_DIR) $(FAIRIS_DIR)
VPATH_FILES := $(shell find $(VPATH) -name "*.v")
build: $(VPATH_FILES:.v=.vo)
fairis :
@$(MAKE) build VPATH=$(FAIRIS_DIR)
trillium :
@$(MAKE) build VPATH=$(TRILLIUM_DIR)
clean-local:
@echo "CLEAN vo glob aux"
$(Q)find $(LOCAL_SRC_DIRS) \( -name "*.vo" -o -name "*.vo[sk]" \
-o -name ".*.aux" -o -name ".*.cache" -o -name "*.glob" \) -delete
clean-trillium:
@$(MAKE) clean-local LOCAL_SRC_DIRS=$(TRILLIUM_DIR)
clean-fairis:
@$(MAKE) clean-local LOCAL_SRC_DIRS=$(FAIRIS_DIR)