-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (64 loc) · 1.98 KB
/
Makefile
File metadata and controls
76 lines (64 loc) · 1.98 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 run clean install test fmt vet
# Binary name
BINARY_NAME=buque
BUILD_DIR=bin
# Build the project
build:
@echo "Building $(BINARY_NAME)..."
@mkdir -p $(BUILD_DIR)
@go build -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/buque
# Run the application
run: build
@./$(BUILD_DIR)/$(BINARY_NAME)
# Clean build artifacts
clean:
@echo "Cleaning..."
@rm -rf $(BUILD_DIR)
@go clean
# Install the binary to $GOPATH/bin
install:
@echo "Installing $(BINARY_NAME)..."
@go install ./cmd/buque
# Run tests
test:
@echo "Running tests..."
@go test -v ./...
# Format code
fmt:
@echo "Formatting code..."
@go fmt ./...
# Run go vet
vet:
@echo "Running go vet..."
@go vet ./...
# Download dependencies
deps:
@echo "Downloading dependencies..."
@go mod download
@go mod tidy
# Build for multiple platforms
build-all:
@echo "Building for multiple platforms..."
@mkdir -p $(BUILD_DIR)
GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 ./cmd/buque
GOOS=linux GOARCH=arm64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 ./cmd/buque
GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 ./cmd/buque
GOOS=darwin GOARCH=arm64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./cmd/buque
GOOS=windows GOARCH=amd64 go build -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe ./cmd/buque
# Development mode with auto-reload (requires air: go install github.com/cosmtrek/air@latest)
dev:
@air
# Show help
help:
@echo "Available targets:"
@echo " build - Build the binary"
@echo " run - Build and run the application"
@echo " clean - Remove build artifacts"
@echo " install - Install binary to GOPATH/bin"
@echo " test - Run tests"
@echo " fmt - Format code"
@echo " vet - Run go vet"
@echo " deps - Download and tidy dependencies"
@echo " build-all - Build for multiple platforms"
@echo " dev - Run in development mode with auto-reload"
@echo " help - Show this help message"