-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
115 lines (95 loc) · 3.22 KB
/
Makefile
File metadata and controls
115 lines (95 loc) · 3.22 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Makefile for stack_utils library
# Provides convenient commands for common development tasks
.PHONY: all clean configure build test install format lint help
# Default target
all: build
# Configuration
BUILD_DIR ?= build
BUILD_TYPE ?= Debug
PRESET ?= debug
help:
@echo "stack_utils - Modern C++ Lock-Free Stack Library"
@echo ""
@echo "Available targets:"
@echo " make configure - Configure the project with CMake"
@echo " make build - Build the library"
@echo " make test - Run tests"
@echo " make benchmark - Run benchmarks"
@echo " make examples - Build and run examples"
@echo " make install - Install the library"
@echo " make format - Format code with clang-format"
@echo " make lint - Run clang-tidy linter"
@echo " make docs - Generate documentation"
@echo " make clean - Clean build artifacts"
@echo " make distclean - Clean everything including build directory"
@echo ""
@echo "Build presets:"
@echo " make configure PRESET=debug - Debug build"
@echo " make configure PRESET=release - Release build"
@echo " make configure PRESET=relwithdebinfo - Release with debug info"
configure:
@echo "Configuring with preset: $(PRESET)"
cmake --preset $(PRESET)
build: configure
@echo "Building stack_utils..."
cmake --build --preset $(PRESET) -j
test: build
@echo "Running tests..."
ctest --preset $(PRESET) --output-on-failure
benchmark:
@echo "Configuring with benchmarks enabled..."
cmake --preset relwithdebinfo -DSTACK_UTILS_BUILD_BENCHMARKS=ON
@echo "Building benchmarks..."
cmake --build --preset relwithdebinfo -j
@echo "Running benchmarks..."
./build/relwithdebinfo/benchmarks/stack_utils_benchmark
examples: build
@echo "Running examples..."
@for example in build/$(PRESET)/examples/*; do \
if [ -x "$$example" ] && [ -f "$$example" ]; then \
echo "Running $$example..."; \
$$example; \
fi \
done
install: build
@echo "Installing stack_utils..."
cmake --install build/$(PRESET) --prefix /usr/local
format:
@echo "Formatting code..."
find include src tests benchmarks examples -name "*.hpp" -o -name "*.cpp" | \
xargs clang-format -i --style=file
lint:
@echo "Running clang-tidy..."
find src tests -name "*.cpp" | \
xargs clang-tidy -p build/$(PRESET)
docs:
@echo "Generating documentation..."
@if command -v doxygen > /dev/null; then \
cd docs && doxygen Doxyfile; \
echo "Documentation generated in docs/html/"; \
else \
echo "Doxygen not found. Install with: brew install doxygen (macOS)"; \
fi
clean:
@echo "Cleaning build artifacts..."
cmake --build build/$(PRESET) --target clean
distclean:
@echo "Removing build directory..."
rm -rf build/
# Development shortcuts
dev: configure
@echo "Starting development build with auto-rebuild..."
@while true; do \
cmake --build --preset debug -j; \
inotifywait -e modify -r src/ include/ 2>/dev/null || sleep 2; \
done
quick:
cmake --build --preset debug -j && ctest --preset debug --output-on-failure
release-build:
cmake --preset release
cmake --build --preset release -j
# Package creation
package:
@echo "Creating distributable package..."
cmake --build build/release --target package
.DEFAULT_GOAL := help