-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (43 loc) · 1.17 KB
/
Makefile
File metadata and controls
54 lines (43 loc) · 1.17 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
# Makefile for rx-cli
# Variables
BINARY_NAME=rx
VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
BUILD_TIME=$(shell date -u '+%Y-%m-%d %H:%M:%S')
# Default OS and Architecture
GOOS?=$(shell go env GOOS)
GOARCH?=$(shell go env GOARCH)
.PHONY: all build clean test deps install release
# Default target
all: clean build
# Dependencies
deps:
@echo "Installing dependencies..."
go mod tidy
# Build the binary
build: deps
@echo "Building $(BINARY_NAME)..."
go build -o $(BINARY_NAME)
# Build for multiple platforms
release:
@echo "Building release binaries..."
GOOS=linux GOARCH=amd64 go build -o $(BINARY_NAME)_linux_amd64
GOOS=darwin GOARCH=amd64 go build -o $(BINARY_NAME)_darwin_amd64
GOOS=windows GOARCH=amd64 go build -o $(BINARY_NAME)_windows_amd64.exe
# Install the binary to GOPATH/bin
install: build
@echo "Installing $(BINARY_NAME)..."
go install
# Run tests
test:
@echo "Running tests..."
go test -v ./...
# Clean build artifacts
clean:
@echo "Cleaning up..."
rm -f $(BINARY_NAME) $(BINARY_NAME)_*
# Print build info
info:
@echo "GOOS: $(GOOS)"
@echo "GOARCH: $(GOARCH)"
@echo "VERSION: $(VERSION)"
@echo "BUILD_TIME: $(BUILD_TIME)"