mail2couch/Makefile
Ole-Morten Duesund 2cd65fd137 feat: implement just-based build system with distinct binary names
Replace Makefile with justfile for better build management:

Build System Changes:
- Add comprehensive justfile with recipes for both implementations
- Configure Go to build as `mail2couch-go`
- Configure Rust to build as `mail2couch-rs` via Cargo.toml
- Add universal build, test, clean, and install recipes
- Include development convenience recipes and utility commands

New Justfile Features:
- `just build` - builds both implementations
- `just install` - installs both to /usr/local/bin
- `just test` - runs tests for both implementations
- `just sizes` - shows binary size comparison
- `just versions` - compares version outputs
- `just --list` - shows all available recipes

Documentation Updates:
- Update CLAUDE.md with justfile usage examples
- Replace make commands with just equivalents
- Add new utility commands (sizes, versions)
- Update IMPLEMENTATION_COMPARISON.md deployment sections

Benefits of just over make:
- Better command-line interface with `--list`
- More intuitive recipe syntax
- Better suited for development workflows
- Cross-platform compatibility
- Built-in help and documentation

Binary Naming:
- Go implementation: `mail2couch-go` (11M)
- Rust implementation: `mail2couch-rs` (8.3M)
- Clear distinction prevents conflicts
- Parallel installation support

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 19:01:42 +02:00

119 lines
No EOL
3.3 KiB
Makefile

# Makefile for mail2couch project
# Builds both Go and Rust implementations with distinct binary names
.PHONY: all build build-go build-rust clean test help install
# Default target
all: build
# Build both implementations
build: build-go build-rust
# Build Go implementation as mail2couch-go
build-go:
@echo "Building Go implementation..."
cd go && go build -o mail2couch-go .
@echo "✅ Built: go/mail2couch-go"
# Build Rust implementation as mail2couch-rs
build-rust:
@echo "Building Rust implementation..."
cd rust && cargo build --release
@echo "✅ Built: rust/target/release/mail2couch-rs"
# Build optimized release versions
build-release: build-go-release build-rust-release
# Build optimized Go release
build-go-release:
@echo "Building optimized Go release..."
cd go && go build -ldflags="-s -w" -o mail2couch-go .
@echo "✅ Built optimized: go/mail2couch-go"
# Build optimized Rust release (already built with --release above)
build-rust-release: build-rust
# Install binaries to /usr/local/bin (requires sudo)
install: build-release
@echo "Installing binaries to /usr/local/bin..."
sudo cp go/mail2couch-go /usr/local/bin/
sudo cp rust/target/release/mail2couch-rs /usr/local/bin/
sudo chmod +x /usr/local/bin/mail2couch-go
sudo chmod +x /usr/local/bin/mail2couch-rs
@echo "✅ Installed mail2couch-go and mail2couch-rs"
# Run tests for both implementations
test: test-go test-rust
# Test Go implementation
test-go:
@echo "Running Go tests..."
cd go && go test ./...
# Test Rust implementation
test-rust:
@echo "Running Rust tests..."
cd rust && cargo test
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
cd go && rm -f mail2couch-go mail2couch
cd rust && cargo clean
@echo "✅ Cleaned build artifacts"
# Check code formatting and linting
check: check-go check-rust
# Check Go code
check-go:
@echo "Checking Go code..."
cd go && go fmt ./...
cd go && go vet ./...
# Check Rust code
check-rust:
@echo "Checking Rust code..."
cd rust && cargo fmt --check
cd rust && cargo clippy -- -D warnings
# Fix code formatting
fmt: fmt-go fmt-rust
# Format Go code
fmt-go:
@echo "Formatting Go code..."
cd go && go fmt ./...
# Format Rust code
fmt-rust:
@echo "Formatting Rust code..."
cd rust && cargo fmt
# Show help
help:
@echo "Available targets:"
@echo " all - Build both implementations (default)"
@echo " build - Build both implementations"
@echo " build-go - Build Go implementation (mail2couch-go)"
@echo " build-rust - Build Rust implementation (mail2couch-rs)"
@echo " build-release - Build optimized release versions"
@echo " install - Install binaries to /usr/local/bin (requires sudo)"
@echo " test - Run tests for both implementations"
@echo " test-go - Run Go tests"
@echo " test-rust - Run Rust tests"
@echo " clean - Clean build artifacts"
@echo " check - Check code formatting and linting"
@echo " fmt - Format code"
@echo " help - Show this help message"
@echo ""
@echo "Output binaries:"
@echo " go/mail2couch-go - Go implementation"
@echo " rust/target/release/mail2couch-rs - Rust implementation"
# Development convenience targets
dev-go: build-go
./go/mail2couch-go --help
dev-rust: build-rust
./rust/target/release/mail2couch-rs --help