Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (56 loc) · 1.95 KB
/
Copy pathMakefile
File metadata and controls
77 lines (56 loc) · 1.95 KB
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
69
70
71
72
73
74
75
76
77
# ==============================================================================
# Configuration
# ==============================================================================
DIRS := tnum
NAMESPACE_PREFIX := bpf
# Z3 Verification Configuration
CXX := g++
CXXFLAGS := -std=c++17 -O3
LDFLAGS := -lz3 -lpthread
INTERVAL_DIR := interval
Z3_SOURCES := $(wildcard $(INTERVAL_DIR)/*.cpp)
Z3_TARGETS := $(patsubst $(INTERVAL_DIR)/%.cpp,$(INTERVAL_DIR)/%,$(Z3_SOURCES))
# ==============================================================================
# Calculations
# ==============================================================================
COQ_INCLUDES := $(foreach d,$(DIRS),-R $(d) $(NAMESPACE_PREFIX).$(d))
VFILES := $(foreach d,$(DIRS),$(wildcard $(d)/*.v))
COQMAKEFILE := coq_makefile
# ==============================================================================
# Rules
# ==============================================================================
.PHONY: all clean coq z3
all: coq z3
coq: CoqMakefile
@echo "Building Coq project..."
@if [ -z "$(VFILES)" ]; then \
echo "Error: No .v files found in directories: $(DIRS)"; \
exit 1; \
fi
@$(MAKE) -f CoqMakefile all
z3: $(Z3_TARGETS)
@echo "Z3 verification programs built successfully."
$(INTERVAL_DIR)/%: $(INTERVAL_DIR)/%.cpp
@echo "Compiling $<..."
$(CXX) $(CXXFLAGS) $< $(LDFLAGS) -o $@
_CoqProject:
@echo "Generating _CoqProject..."
@echo "$(COQ_INCLUDES)" > _CoqProject
CoqMakefile: _CoqProject $(VFILES)
@echo "Generating build system..."
$(COQMAKEFILE) -f _CoqProject $(VFILES) -o CoqMakefile
clean:
@echo "Cleaning artifacts..."
@if [ -f CoqMakefile ]; then $(MAKE) -f CoqMakefile clean; fi
@rm -f _CoqProject CoqMakefile CoqMakefile.conf
@find $(DIRS) \( \
-name ".*.aux" -o \
-name ".*.cache" -o \
-name "*.aux" -o \
-name "*.glob" -o \
-name "*.vo" -o \
-name "*.vok" -o \
-name "*.vos" \
\) -delete
@echo "Cleaning Z3 verification binaries..."
@rm -f $(Z3_TARGETS)