edge-connect-mcp/Makefile

64 lines
1.4 KiB
Makefile

# ABOUTME: Makefile for edge-connect-mcp project.
# ABOUTME: Provides targets for building, formatting, linting, and testing.
BINARY_NAME := edge-connect-mcp
GO := go
GOLANGCI_LINT := $(GO) run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.2
# Build flags
LDFLAGS := -s -w
BUILD_FLAGS := -ldflags "$(LDFLAGS)"
.PHONY: all build clean fmt format lint test run help vet tidy
# Default target
all: fmt vet lint build
## Build targets
build: ## Build the binary
$(GO) build $(BUILD_FLAGS) -o $(BINARY_NAME) .
clean: ## Remove build artifacts
rm -f $(BINARY_NAME)
$(GO) clean
## Code quality targets
fmt: ## Format code using go fmt
$(GO) fmt ./...
format: fmt ## Alias for fmt
vet: ## Run go vet
$(GO) vet ./...
lint: ## Run golangci-lint
$(GOLANGCI_LINT) run ./...
## Dependency management
tidy: ## Tidy go modules
$(GO) mod tidy
## Testing targets
test: ## Run tests
$(GO) test -v ./...
test-coverage: ## Run tests with coverage
$(GO) test -v -coverprofile=coverage.out ./...
$(GO) tool cover -html=coverage.out -o coverage.html
## Run targets
run: build ## Build and run in stdio mode
./$(BINARY_NAME)
run-remote: build ## Build and run in remote mode
./$(BINARY_NAME) -mode=remote
## Help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'