-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (55 loc) · 1.54 KB
/
Makefile
File metadata and controls
71 lines (55 loc) · 1.54 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
# DERO Wallet TUI Build Configuration
# Optimized for Go 1.26 with minimal binary size
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
# Linker flags: strip debug info (-s -w), embed version info
LDFLAGS := -s -w \
-X main.version=$(VERSION) \
-X main.commit=$(COMMIT) \
-X main.date=$(DATE)
# Go build flags
GOFLAGS := -trimpath
# Binary name
BINARY := derotui
.PHONY: all build build-debug clean test fmt vet release install
all: build
# Standard optimized build (14MB)
build:
go build $(GOFLAGS) -ldflags="$(LDFLAGS)" -o $(BINARY) ./cmd/
# Debug build with symbols (18MB)
build-debug:
go build -o $(BINARY)-debug ./cmd/
# Run all tests
test:
go test -v ./...
# Format code
fmt:
go fmt ./...
# Static analysis
vet:
go vet ./...
# Release build with UPX compression (~6MB)
release: build
@if command -v upx >/dev/null 2>&1; then \
upx --best $(BINARY) -o $(BINARY)-release; \
echo "Release binary created: $(BINARY)-release"; \
else \
echo "UPX not installed, skipping compression"; \
cp $(BINARY) $(BINARY)-release; \
fi
# Install to GOPATH/bin
install:
go install $(GOFLAGS) -ldflags="$(LDFLAGS)" ./cmd/
# Clean build artifacts
clean:
rm -f $(BINARY) $(BINARY)-debug $(BINARY)-release
go clean ./...
# Show build info
info:
@echo "Version: $(VERSION)"
@echo "Commit: $(COMMIT)"
@echo "Date: $(DATE)"
@echo "Binary: $(BINARY)"
# Development workflow
dev: fmt vet test build