forked from annenpolka/cclog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (72 loc) · 1.79 KB
/
Makefile
File metadata and controls
86 lines (72 loc) · 1.79 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
77
78
79
80
81
82
83
84
85
86
# Makefile for cclog
# Variables
BINARY_NAME=cclog
BUILD_DIR=.
CMD_DIR=./cmd/cclog
PKG_LIST=$$(go list ./... | grep -v /vendor/)
# Default target
.PHONY: all
all: build
# Build the application
.PHONY: build
build:
go build -o $(BINARY_NAME) $(CMD_DIR)
# Run tests
.PHONY: test
test:
go test ./...
# Run tests with coverage
.PHONY: test-coverage
test-coverage:
go test -cover ./...
# Run tests with verbose output
.PHONY: test-verbose
test-verbose:
go test -v ./...
# Format code
.PHONY: fmt
fmt:
go fmt ./...
# Run linter
.PHONY: vet
vet:
go vet ./...
# Install dependencies
.PHONY: deps
deps:
go mod download
go mod tidy
# Clean build artifacts
.PHONY: clean
clean:
rm -f $(BINARY_NAME)
# Run the application (example usage)
.PHONY: run
run: build
./$(BINARY_NAME)
# Install the binary to GOPATH/bin
.PHONY: install
install:
go install $(CMD_DIR)
# Build for multiple platforms
.PHONY: build-all
build-all:
GOOS=linux GOARCH=amd64 go build -o $(BINARY_NAME)-linux-amd64 $(CMD_DIR)
GOOS=darwin GOARCH=amd64 go build -o $(BINARY_NAME)-darwin-amd64 $(CMD_DIR)
GOOS=windows GOARCH=amd64 go build -o $(BINARY_NAME)-windows-amd64.exe $(CMD_DIR)
# Help target
.PHONY: help
help:
@echo "Available targets:"
@echo " build - Build the application"
@echo " test - Run all tests"
@echo " test-coverage - Run tests with coverage"
@echo " test-verbose - Run tests with verbose output"
@echo " fmt - Format code"
@echo " vet - Run go vet"
@echo " deps - Install and tidy dependencies"
@echo " clean - Clean build artifacts"
@echo " run - Build and run the application"
@echo " install - Install binary to GOPATH/bin"
@echo " build-all - Build for multiple platforms"
@echo " help - Show this help message"