-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (46 loc) · 1.6 KB
/
Makefile
File metadata and controls
58 lines (46 loc) · 1.6 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
.PHONY: build test test-verbose fmt vet lint clean deps build-all help
BINARY_NAME := mb-cli
BUILD_DIR := bin
MAIN_PKG := ./cmd/mb
MODULE := github.com/andreagrandi/mb-cli
all: build
build:
@echo "Building $(BINARY_NAME)..."
@mkdir -p $(BUILD_DIR)
@go build -o $(BUILD_DIR)/$(BINARY_NAME) $(MAIN_PKG)
test:
@go test ./tests/ ./internal/...
test-verbose:
@go test -v ./tests/ ./internal/...
fmt:
@gofmt -s -w .
vet:
@go vet ./...
lint:
@golangci-lint run
clean:
@rm -rf $(BUILD_DIR)
@rm -f coverage.out coverage.html
deps:
@go mod download
@go mod tidy
build-all:
@echo "Building for multiple platforms..."
@mkdir -p $(BUILD_DIR)
@GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 $(MAIN_PKG)
@GOOS=linux GOARCH=arm64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 $(MAIN_PKG)
@GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 $(MAIN_PKG)
@GOOS=darwin GOARCH=arm64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 $(MAIN_PKG)
@GOOS=windows GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe $(MAIN_PKG)
help:
@echo "Available targets:"
@echo " build - Build the binary to bin/"
@echo " test - Run all tests"
@echo " test-verbose - Run tests with verbose output"
@echo " fmt - Format code with gofmt"
@echo " vet - Static analysis with go vet"
@echo " lint - Run golangci-lint"
@echo " clean - Remove build artifacts"
@echo " deps - Download and tidy dependencies"
@echo " build-all - Cross-platform builds"
@echo " help - Show this help"