-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
107 lines (86 loc) · 2.5 KB
/
Copy pathMakefile
File metadata and controls
107 lines (86 loc) · 2.5 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
.PHONY: build run dev clean test fmt lint help docker-build docker-run docker-logs podman-build podman-run podman-logs
BINARY_NAME := heimsense
BUILD_DIR := ./bin
MAIN_PKG := ./cmd/server/
IMAGE_NAME := heimsense
# Load .env if it exists
ifneq (,$(wildcard ./.env))
include .env
export
endif
## help: Show this help message
help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@sed -n 's/^## //p' $(MAKEFILE_LIST) | column -t -s ':'
## build: Compile the binary
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
build:
@echo "🔨 Building $(BINARY_NAME) $(VERSION)..."
@mkdir -p $(BUILD_DIR)
go build -trimpath -ldflags="-s -w -X main.Version=$(VERSION)" -o $(BUILD_DIR)/$(BINARY_NAME) $(MAIN_PKG)
@echo "✅ Built → $(BUILD_DIR)/$(BINARY_NAME)"
## run: Build and run the server
run: build
@echo "🚀 Starting server..."
$(BUILD_DIR)/$(BINARY_NAME)
## dev: Run with live reload (go run)
dev:
@echo "🔄 Running in dev mode..."
go run $(MAIN_PKG)
## clean: Remove build artifacts
clean:
@echo "🧹 Cleaning..."
rm -rf $(BUILD_DIR) server
@echo "✅ Clean"
## test: Run all tests
test:
go test -v -race ./...
## fmt: Format all Go files
fmt:
gofmt -s -w .
## lint: Run go vet
lint:
go vet ./...
## setup: Configure Claude Code to use this adapter
setup:
@bash scripts/setup-claude.sh
## revert: Revert Claude Code to previous settings
revert:
@if [ -f "$$HOME/.claude/settings.json.bak" ]; then \
cp "$$HOME/.claude/settings.json.bak" "$$HOME/.claude/settings.json"; \
echo "✅ Reverted to previous settings"; \
else \
echo "❌ No backup found"; \
fi
## docker-build: Build Docker image
docker-build:
@echo "🐳 Building Docker image..."
docker build -t $(IMAGE_NAME):latest .
## docker-run: Run with Docker Compose
docker-run:
@echo "🐳 Starting with Docker Compose..."
docker compose up -d
@echo "✅ Container started on http://localhost:8080"
## docker-stop: Stop Docker Compose
docker-stop:
docker compose down
## docker-logs: Show Docker container logs
docker-logs:
docker compose logs -f
## podman-build: Build Podman image
podman-build:
@echo "📦 Building Podman image..."
podman build -t $(IMAGE_NAME):latest .
## podman-run: Run with Podman Compose
podman-run:
@echo "📦 Starting with Podman Compose..."
podman-compose up -d
@echo "✅ Container started on http://localhost:8080"
## podman-stop: Stop Podman Compose
podman-stop:
podman-compose down
## podman-logs: Show Podman container logs
podman-logs:
podman-compose logs -f