-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (64 loc) · 1.58 KB
/
Makefile
File metadata and controls
78 lines (64 loc) · 1.58 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
.PHONY: build install clean run test
# Binary name
BINARY_NAME=orbit
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GORUN=$(GOCMD) run
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
# Suppress directory messages
MAKEFLAGS += --no-print-directory
# Build directory
BUILD_DIR=bin
# Version info
VERSION=1.0.0
BUILD_TIME=$(shell date +%FT%T%z)
LDFLAGS=-ldflags "-X main.version=$(VERSION) -X main.buildTime=$(BUILD_TIME)"
## build: Build the binary
build:
@echo "🔨 Building $(BINARY_NAME)..."
@mkdir -p $(BUILD_DIR)
$(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) .
@echo "Build complete: $(BUILD_DIR)/$(BINARY_NAME)"
## install: Install the binary to /usr/local/bin
install: build
@echo " Installing $(BINARY_NAME) to /usr/local/bin..."
@sudo cp $(BUILD_DIR)/$(BINARY_NAME) /usr/local/bin/
@echo "Installation complete!"
## run: Run the application
run:
$(GORUN) .
## clean: Clean build files
clean:
@echo "🧹 Cleaning..."
$(GOCLEAN)
@rm -rf $(BUILD_DIR)
@echo " Clean complete!"
## test: Run tests
test:
@echo "🧪 Running tests..."
$(GOTEST) -v ./...
## deps: Download dependencies
deps:
@echo "📥 Downloading dependencies..."
$(GOMOD) download
$(GOMOD) tidy
@echo " Dependencies downloaded!"
## lint: Run linter
lint:
@echo "🔍 Running linter..."
@golangci-lint run ./...
## help: Show this help
help:
@echo "🌍 Orbit - Project Manager"
@echo ""
@echo "Usage:"
@echo " make <target>"
@echo ""
@echo "Targets:"
@sed -n 's/^##//p' $(MAKEFILE_LIST) | column -t -s ':' | sed -e 's/^/ /'
# Default target
.DEFAULT_GOAL := help