130 lines
3.5 KiB
Makefile
130 lines
3.5 KiB
Makefile
# Makefile for Golang AVX512 FFT Project
|
|
|
|
.PHONY: help build test benchmark clean docker-build docker-test docker-run docker-clean all
|
|
|
|
# Default target
|
|
help:
|
|
@echo "Golang AVX512 FFT Project"
|
|
@echo ""
|
|
@echo "Available targets:"
|
|
@echo " help - Show this help message"
|
|
@echo " build - Build the Go application locally"
|
|
@echo " test - Run tests locally"
|
|
@echo " benchmark - Run benchmarks locally"
|
|
@echo " clean - Clean build artifacts"
|
|
@echo " docker-build - Build Docker container"
|
|
@echo " docker-test - Run tests in Docker container"
|
|
@echo " docker-run - Run interactive Docker container"
|
|
@echo " docker-clean - Clean Docker resources"
|
|
@echo " all - Build, test, and benchmark locally"
|
|
@echo ""
|
|
|
|
# Local build targets
|
|
build:
|
|
@echo "🔨 Building Go application..."
|
|
go build -o fft .
|
|
@echo "✅ Build completed: ./fft"
|
|
|
|
test:
|
|
@echo "🧪 Running tests..."
|
|
go test -v .
|
|
|
|
benchmark:
|
|
@echo "📊 Running benchmarks..."
|
|
go test -bench=. -benchmem .
|
|
|
|
clean:
|
|
@echo "🧹 Cleaning build artifacts..."
|
|
rm -f fft
|
|
@echo "✅ Cleanup completed"
|
|
|
|
all: build test benchmark
|
|
|
|
# Docker targets
|
|
docker-build:
|
|
@echo "🐳 Building Docker container..."
|
|
docker build -t golang-fft:latest .
|
|
@echo "✅ Docker container built"
|
|
|
|
docker-test:
|
|
@echo "🐳 Running tests in Docker container..."
|
|
docker run --rm golang-fft:latest go test -v .
|
|
|
|
docker-benchmark:
|
|
@echo "🐳 Running benchmarks in Docker container..."
|
|
docker run --rm golang-fft:latest go test -bench=. -benchmem .
|
|
|
|
docker-run:
|
|
@echo "🐳 Starting interactive Docker container..."
|
|
docker run -it --rm --name golang-fft-interactive golang-fft:latest
|
|
|
|
docker-clean:
|
|
@echo "🧹 Cleaning Docker resources..."
|
|
docker stop golang-fft-interactive 2>/dev/null || true
|
|
docker rm golang-fft-interactive 2>/dev/null || true
|
|
docker rmi golang-fft:latest 2>/dev/null || true
|
|
@echo "✅ Docker cleanup completed"
|
|
|
|
# Docker full workflow
|
|
docker-all: docker-build docker-test docker-benchmark
|
|
|
|
# Development targets
|
|
dev-setup:
|
|
@echo "🔧 Setting up development environment..."
|
|
go mod download
|
|
go mod tidy
|
|
@echo "✅ Development environment ready"
|
|
|
|
dev-test: dev-setup test
|
|
|
|
dev-benchmark: dev-setup benchmark
|
|
|
|
# Quick check targets
|
|
check:
|
|
@echo "🔍 Checking project files..."
|
|
@test -f go.mod || (echo "❌ Missing go.mod" && exit 1)
|
|
@test -f fft.go || (echo "❌ Missing fft.go" && exit 1)
|
|
@test -f fft_avx512_working.s || (echo "❌ Missing fft_avx512_working.s" && exit 1)
|
|
@test -f fft_test.go || (echo "❌ Missing fft_test.go" && exit 1)
|
|
@echo "✅ All required files present"
|
|
|
|
# Install dependencies
|
|
deps:
|
|
@echo "📦 Installing dependencies..."
|
|
go mod download
|
|
go mod tidy
|
|
@echo "✅ Dependencies installed"
|
|
|
|
# Format code
|
|
fmt:
|
|
@echo "🎨 Formatting Go code..."
|
|
go fmt .
|
|
@echo "✅ Code formatted"
|
|
|
|
# Vet code
|
|
vet:
|
|
@echo "🔍 Vetting Go code..."
|
|
go vet .
|
|
@echo "✅ Code vetted"
|
|
|
|
# Lint code (requires golangci-lint)
|
|
lint:
|
|
@echo "🔍 Linting Go code..."
|
|
@if command -v golangci-lint >/dev/null 2>&1; then \
|
|
golangci-lint run; \
|
|
else \
|
|
echo "⚠️ golangci-lint not found, skipping linting"; \
|
|
fi
|
|
|
|
# Full development workflow
|
|
dev: fmt vet lint test benchmark
|
|
|
|
# Show project info
|
|
info:
|
|
@echo "📋 Project Information:"
|
|
@echo " Go version: $(shell go version)"
|
|
@echo " Go modules: $(shell go env GOMOD)"
|
|
@echo " Go workspace: $(shell go env GOWORK)"
|
|
@echo " Architecture: $(shell go env GOARCH)"
|
|
@echo " OS: $(shell go env GOOS)"
|
|
@echo " AMD64 level: $(shell go env GOAMD64)"
|