token_bucket/Makefile

56 lines
1.4 KiB
Makefile
Raw Normal View History

2025-07-17 11:31:31 +03:00
# Token Bucket Makefile
# Build system for the Nim token bucket rate limiting library
.PHONY: all build test clean install deps help
# Default target
all: deps build test
# Help target
help:
@echo "Token Bucket Build System"
@echo "========================="
@echo "Available targets:"
@echo " all - Install deps, build, and test"
@echo " build - Build the library"
@echo " test - Run tests"
@echo " deps - Install dependencies"
@echo " clean - Clean build artifacts"
@echo " help - Show this help message"
# Install dependencies
deps:
@echo "Installing dependencies..."
nimble install -d
# Build the library
build:
@echo "Building token bucket library..."
2025-07-17 15:12:06 +03:00
nim c --mm:refc src/token_bucket.nim
2025-07-17 11:31:31 +03:00
# Run tests
test:
@echo "Running tests..."
nim c -r tests/test_token_bucket.nim
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
2025-07-17 15:12:06 +03:00
rm -rf src/nimcache tests/nimcache
rm -f src/token_bucket tests/test_token_bucket
2025-07-17 11:31:31 +03:00
find . -name "*.pdb" -delete 2>/dev/null || true
# Install the package
install:
@echo "Installing package..."
nimble install
# Development build with debug info
debug:
@echo "Building with debug info..."
2025-07-17 15:12:06 +03:00
nim c --debuginfo --linedir:on src/token_bucket.nim
2025-07-17 11:31:31 +03:00
# Run tests with coverage (if available)
test-coverage:
@echo "Running tests with coverage..."
nim c -r --passC:"-fprofile-arcs -ftest-coverage" --passL:"-lgcov" tests/test_token_bucket.nim