-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (51 loc) · 1.74 KB
/
Makefile
File metadata and controls
66 lines (51 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.PHONY: build test clean install run help
# Binary name
BINARY_NAME=errorvault
# Build directory
BUILD_DIR=.
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-15s %s\n", $$1, $$2}'
build: ## Build the errorvault binary
@echo "Building..."
go build -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/errorvault
@echo "Build complete: $(BUILD_DIR)/$(BINARY_NAME)"
build-optimized: ## Build with optimizations (smaller binary)
@echo "Building optimized binary..."
go build -ldflags="-s -w" -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/errorvault
@echo "Build complete: $(BUILD_DIR)/$(BINARY_NAME)"
test: ## Run tests
@echo "Running tests..."
go test -v ./...
test-cover: ## Run tests with coverage
@echo "Running tests with coverage..."
go test -cover -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report: coverage.html"
clean: ## Clean build artifacts
@echo "Cleaning..."
rm -f $(BUILD_DIR)/$(BINARY_NAME)
rm -f coverage.out coverage.html
@echo "Clean complete"
install: build ## Install errorvault to /usr/local/bin
@echo "Installing..."
sudo mv $(BUILD_DIR)/$(BINARY_NAME) /usr/local/bin/
@echo "Installed to /usr/local/bin/$(BINARY_NAME)"
run: build ## Build and run the server
@echo "Starting server..."
./$(BUILD_DIR)/$(BINARY_NAME) server
fmt: ## Format code
@echo "Formatting code..."
go fmt ./...
vet: ## Run go vet
@echo "Running go vet..."
go vet ./...
deps: ## Download dependencies
@echo "Downloading dependencies..."
go mod download
tidy: ## Tidy dependencies
@echo "Tidying dependencies..."
go mod tidy
all: clean build test ## Clean, build and test