-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (53 loc) · 1.68 KB
/
Makefile
File metadata and controls
64 lines (53 loc) · 1.68 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
.PHONY: build test install clean help
# Build variables
BINARY_NAME=wui
VERSION?=dev
COMMIT?=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_DATE?=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS=-ldflags "-X github.com/clobrano/wui/internal/version.Version=$(VERSION) \
-X github.com/clobrano/wui/internal/version.Commit=$(COMMIT) \
-X github.com/clobrano/wui/internal/version.BuildDate=$(BUILD_DATE)"
# Default target
all: build
## build: Build the wui binary
build:
@echo "Building $(BINARY_NAME)..."
@go build $(LDFLAGS) -o $(BINARY_NAME) .
@echo "Build complete: ./$(BINARY_NAME)"
## test: Run all tests
test:
@echo "Running tests..."
@go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
@echo "Tests complete"
## coverage: Run tests with coverage report
coverage: test
@go tool cover -html=coverage.txt -o coverage.html
@echo "Coverage report: coverage.html"
## install: Install the wui binary to $GOPATH/bin
install:
@echo "Installing $(BINARY_NAME)..."
@go install $(LDFLAGS) .
@echo "Installed to $(shell go env GOPATH)/bin/$(BINARY_NAME)"
## clean: Remove build artifacts
clean:
@echo "Cleaning..."
@rm -f $(BINARY_NAME)
@rm -f coverage.txt coverage.html
@rm -rf dist/
@echo "Clean complete"
## fmt: Format Go code
fmt:
@echo "Formatting code..."
@go fmt ./...
## lint: Run golangci-lint (requires golangci-lint installed)
lint:
@echo "Linting code..."
@golangci-lint run ./...
## mod-tidy: Tidy Go modules
mod-tidy:
@echo "Tidying modules..."
@go mod tidy
## help: Display this help message
help:
@echo "Available targets:"
@sed -n 's/^##//p' $(MAKEFILE_LIST) | column -t -s ':' | sed -e 's/^/ /'