forked from octra-labs/pvac_hfhe_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (52 loc) · 1.95 KB
/
Copy pathMakefile
File metadata and controls
68 lines (52 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
CXX := g++
CXXFLAGS := -std=c++17 -O2 -march=native -Wall -Wextra -I./include
DEBUG_FLAGS := -g -O0 -DPVAC_DEBUG
SANITIZE_FLAGS := -fsanitize=address,undefined
BUILD_DIR := build
TESTS_DIR := tests
EXAMPLES_DIR := examples
all: $(BUILD_DIR)/test_main
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/test_main: $(TESTS_DIR)/test_main.cpp | $(BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
debug: CXXFLAGS += $(DEBUG_FLAGS)
debug: $(BUILD_DIR)/test_main_debug
$(BUILD_DIR)/test_main_debug: $(TESTS_DIR)/test_main.cpp | $(BUILD_DIR)
$(CXX) $(CXXFLAGS) $(DEBUG_FLAGS) -o $@ $<
sanitize: CXXFLAGS += $(DEBUG_FLAGS) $(SANITIZE_FLAGS)
sanitize: $(BUILD_DIR)/test_main_sanitize
$(BUILD_DIR)/test_main_sanitize: $(TESTS_DIR)/test_main.cpp | $(BUILD_DIR)
$(CXX) $(CXXFLAGS) $(DEBUG_FLAGS) $(SANITIZE_FLAGS) -o $@ $<
test: $(BUILD_DIR)/test_main
@echo "running tests..."
@./$(BUILD_DIR)/test_main
test-verbose: $(BUILD_DIR)/test_main
@echo "running tests (verbose)..."
@PVAC_DBG=2 ./$(BUILD_DIR)/test_main
test-quiet: $(BUILD_DIR)/test_main
@PVAC_DBG=0 ./$(BUILD_DIR)/test_main
examples: $(BUILD_DIR)/basic_usage
$(BUILD_DIR)/basic_usage: $(EXAMPLES_DIR)/basic_usage.cpp | $(BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
clean:
rm -rf $(BUILD_DIR)
rm -f pvac_metrics.csv
help:
@echo "pvac build system"
@echo ""
@echo "targets:"
@echo " all - build main test executable (default)"
@echo " test - build and run tests"
@echo " test-verbose - run tests with verbose output"
@echo " test-quiet - run tests with no output"
@echo " debug - build with debug symbols"
@echo " sanitize - build with addresssanitizer"
@echo " examples - build example programs"
@echo " clean - remove build artifacts"
@echo " help - show this help message"
@echo ""
@echo "environment variables:"
@echo " PVAC_DBG=0 - no debug output"
@echo " PVAC_DBG=1 - normal debug output (default)"
@echo " PVAC_DBG=2 - verbose debug output"