-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (65 loc) · 1.89 KB
/
Makefile
File metadata and controls
76 lines (65 loc) · 1.89 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
67
68
69
70
71
72
73
74
75
76
.PHONY: build test clean install run help
# Binary name
BINARY_NAME=go-smart-deduper
# Build the application
build:
@echo "Building..."
go build -o $(BINARY_NAME) .
@echo "Build complete!"
# Run tests
test:
@echo "Running tests..."
go test ./pkg/... -v
# Run tests with coverage
test-coverage:
@echo "Running tests with coverage..."
go test ./pkg/... -cover -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Clean build artifacts
clean:
@echo "Cleaning..."
go clean
rm -f $(BINARY_NAME)
rm -f coverage.out coverage.html
@echo "Clean complete!"
# Install the application
install:
@echo "Installing..."
go install .
@echo "Install complete!"
# Run the application
run:
go run . $(ARGS)
# Format code
fmt:
@echo "Formatting code..."
go fmt ./...
# Run linter
lint:
@echo "Running linter..."
golangci-lint run || go vet ./...
# Build for all platforms
build-all:
@echo "Building for all platforms..."
GOOS=linux GOARCH=amd64 go build -o $(BINARY_NAME)-linux-amd64 .
GOOS=darwin GOARCH=amd64 go build -o $(BINARY_NAME)-darwin-amd64 .
GOOS=darwin GOARCH=arm64 go build -o $(BINARY_NAME)-darwin-arm64 .
GOOS=windows GOARCH=amd64 go build -o $(BINARY_NAME)-windows-amd64.exe .
@echo "Build complete for all platforms!"
# Help
help:
@echo "Available targets:"
@echo " build - Build the application"
@echo " test - Run tests"
@echo " test-coverage - Run tests with coverage report"
@echo " clean - Clean build artifacts"
@echo " install - Install the application"
@echo " run - Run the application (use ARGS to pass arguments)"
@echo " fmt - Format code"
@echo " lint - Run linter"
@echo " build-all - Build for all platforms"
@echo " help - Show this help message"
@echo ""
@echo "Example:"
@echo " make run ARGS='/path/to/scan -v'"