-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (62 loc) · 2.11 KB
/
Makefile
File metadata and controls
70 lines (62 loc) · 2.11 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
.PHONY: help build build-all clean test snapshot install
# Directories
BIN_DIR := bin
CMD_DIR := ./cmd/bit
help:
@echo "Bit - Terminal ANSI Logo Designer"
@echo ""
@echo "Available targets:"
@echo " make build - Build bit binary"
@echo " make build-all - Build for all platforms"
@echo " make clean - Remove build artifacts"
@echo " make test - Run tests"
@echo " make snapshot - Test GoReleaser build (no publish)"
@echo " make install - Install binary to /usr/local/bin"
# Build single binary
build:
@echo "Building bit..."
@mkdir -p $(BIN_DIR)
go build -o $(BIN_DIR)/bit $(CMD_DIR)
@echo "Done! Binary in ./$(BIN_DIR)/"
# Build for all platforms
build-all:
@echo "Building for all platforms..."
@mkdir -p $(BIN_DIR)
GOOS=linux GOARCH=amd64 go build -o $(BIN_DIR)/bit-linux-amd64 $(CMD_DIR)
GOOS=linux GOARCH=arm64 go build -o $(BIN_DIR)/bit-linux-arm64 $(CMD_DIR)
GOOS=darwin GOARCH=amd64 go build -o $(BIN_DIR)/bit-darwin-amd64 $(CMD_DIR)
GOOS=darwin GOARCH=arm64 go build -o $(BIN_DIR)/bit-darwin-arm64 $(CMD_DIR)
GOOS=windows GOARCH=amd64 go build -o $(BIN_DIR)/bit-windows-amd64.exe $(CMD_DIR)
GOOS=windows GOARCH=arm64 go build -o $(BIN_DIR)/bit-windows-arm64.exe $(CMD_DIR)
@echo "Done! Binaries in ./$(BIN_DIR)/"
# Clean
clean:
@echo "Cleaning build artifacts..."
rm -rf $(BIN_DIR)/
rm -rf dist/
@echo "Done!"
# Run tests
test:
@echo "Running tests..."
go test -v ./...
# Test GoReleaser build locally
snapshot:
@echo "Running GoReleaser snapshot build..."
@if ! command -v goreleaser >/dev/null 2>&1; then \
echo "Error: goreleaser not found. Install with: brew install goreleaser"; \
exit 1; \
fi
goreleaser release --snapshot --clean
@echo ""
@echo "Snapshot build complete! Artifacts in ./dist/"
@echo ""
@echo "Test the binaries:"
@echo " ls dist/bit_*/bit"
@echo " ./dist/bit_*/bit -version"
@echo " ./dist/bit_*/bit -list"
@echo " ./dist/bit_*/bit \"Hello\""
# Install binary globally
install: build
@echo "Installing binary to /usr/local/bin..."
@sudo cp $(BIN_DIR)/bit /usr/local/bin/bit
@echo "Done! Run 'bit' from anywhere."