promocrypt-core 1.1.0

Core library for cryptographically secure promotional code generation
Documentation
# Makefile for promocrypt-core
#
# Common targets:
#   make          - Build release
#   make test     - Run all tests
#   make test-all - Run comprehensive test suite
#   make bench    - Run benchmarks
#   make clean    - Clean build artifacts
#   make ci       - Simulate full CI pipeline

.PHONY: all build build-debug build-release test test-unit test-integration test-all \
        bench lint fmt doc clean ci ci-docker help ffi dist

# Default target
all: build-release

# ====================
# Build Targets
# ====================

build: build-release

build-debug:
	@echo "Building debug..."
	cargo build

build-release:
	@echo "Building release..."
	cargo build --release

ffi:
	@echo "Building with FFI support..."
	cargo build --release --features ffi

# ====================
# Test Targets
# ====================

test:
	@echo "Running tests..."
	cargo test

test-unit:
	@echo "Running unit tests..."
	cargo test --lib

test-integration:
	@echo "Running integration tests..."
	cargo test --test '*'

test-doc:
	@echo "Running doc tests..."
	cargo test --doc

test-release:
	@echo "Running tests in release mode..."
	cargo test --release

test-all:
	@echo "Running comprehensive test suite..."
	@chmod +x scripts/test-all.sh
	./scripts/test-all.sh

test-quick:
	@echo "Running quick tests..."
	@chmod +x scripts/test-all.sh
	./scripts/test-all.sh --quick

test-verbose:
	@echo "Running tests with verbose output..."
	cargo test -- --nocapture

# ====================
# Quality Targets
# ====================

lint:
	@echo "Running clippy..."
	cargo clippy -- -D warnings

fmt:
	@echo "Formatting code..."
	cargo fmt

fmt-check:
	@echo "Checking format..."
	cargo fmt --check

check: fmt-check lint
	@echo "All checks passed!"

# ====================
# Documentation
# ====================

doc:
	@echo "Building documentation..."
	cargo doc --no-deps

doc-open:
	@echo "Building and opening documentation..."
	cargo doc --no-deps --open

# ====================
# Benchmarks
# ====================

bench:
	@echo "Running benchmarks..."
	cargo bench

bench-quick:
	@echo "Running quick benchmark..."
	cargo bench -- --quick

# ====================
# CI Simulation
# ====================

ci:
	@echo "Simulating CI pipeline..."
	@chmod +x scripts/simulate-ci.sh
	./scripts/simulate-ci.sh

ci-docker:
	@echo "Running CI in Docker..."
	@chmod +x scripts/simulate-ci.sh
	./scripts/simulate-ci.sh --docker

ci-skip-tests:
	@echo "Building CI artifacts (skip tests)..."
	@chmod +x scripts/simulate-ci.sh
	./scripts/simulate-ci.sh --skip-tests

# ====================
# Docker Targets
# ====================

docker-build:
	@echo "Building Docker test image..."
	docker build -f Dockerfile.test -t promocrypt-test .

docker-test:
	@echo "Running tests in Docker..."
	docker run --rm promocrypt-test

docker-compose-test:
	@echo "Running tests with docker-compose..."
	docker-compose -f docker-compose.test.yml up --build test

docker-compose-bench:
	@echo "Running benchmarks with docker-compose..."
	docker-compose -f docker-compose.test.yml up --build bench

docker-clean:
	@echo "Cleaning Docker resources..."
	docker-compose -f docker-compose.test.yml down -v --remove-orphans

# ====================
# Distribution
# ====================

dist: build-release ffi
	@echo "Creating distribution package..."
	@mkdir -p dist
	@cp target/release/libpromocrypt_core.* dist/ 2>/dev/null || true
	@echo "Distribution files in dist/"
	@ls -la dist/

# ====================
# Cleanup
# ====================

clean:
	@echo "Cleaning..."
	cargo clean
	rm -rf dist/
	rm -rf test-results/
	rm -rf bench-results/

clean-all: clean docker-clean

# ====================
# Development
# ====================

watch:
	@echo "Watching for changes..."
	cargo watch -x "test --lib"

watch-all:
	@echo "Watching for changes (all tests)..."
	cargo watch -x test

# ====================
# Release
# ====================

version:
	@grep '^version' Cargo.toml | head -1

# ====================
# Help
# ====================

help:
	@echo "promocrypt-core Makefile"
	@echo ""
	@echo "Build targets:"
	@echo "  make              - Build release"
	@echo "  make build-debug  - Build debug"
	@echo "  make build-release- Build release"
	@echo "  make ffi          - Build with FFI support"
	@echo ""
	@echo "Test targets:"
	@echo "  make test         - Run all tests"
	@echo "  make test-unit    - Run unit tests only"
	@echo "  make test-integration - Run integration tests"
	@echo "  make test-all     - Run comprehensive test suite"
	@echo "  make test-quick   - Run quick tests"
	@echo "  make test-release - Run tests in release mode"
	@echo ""
	@echo "Quality targets:"
	@echo "  make lint         - Run clippy"
	@echo "  make fmt          - Format code"
	@echo "  make fmt-check    - Check formatting"
	@echo "  make check        - Run all checks (fmt + lint)"
	@echo ""
	@echo "Documentation:"
	@echo "  make doc          - Build documentation"
	@echo "  make doc-open     - Build and open documentation"
	@echo ""
	@echo "Benchmarks:"
	@echo "  make bench        - Run benchmarks"
	@echo ""
	@echo "CI Simulation:"
	@echo "  make ci           - Simulate full CI pipeline"
	@echo "  make ci-docker    - Run CI in Docker"
	@echo ""
	@echo "Docker targets:"
	@echo "  make docker-build - Build Docker test image"
	@echo "  make docker-test  - Run tests in Docker"
	@echo "  make docker-compose-test - Run tests with docker-compose"
	@echo ""
	@echo "Other:"
	@echo "  make clean        - Clean build artifacts"
	@echo "  make dist         - Create distribution package"
	@echo "  make help         - Show this help"