-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (85 loc) · 3.09 KB
/
Makefile
File metadata and controls
105 lines (85 loc) · 3.09 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
# Claude Code Open Makefile
# Variables
BINARY_NAME=cco
VERSION=0.3.0
BUILD_DIR=build
MAIN_PACKAGE=.
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
GOFMT=gofmt
# Build flags
BUILD_FLAGS=-ldflags="-s -w -X 'github.com/Davincible/claude-code-open/cmd.Version=$(VERSION)'"
.PHONY: all build clean test coverage fmt lint help install uninstall build-all
all: fmt test build
## build: Build the binary
build:
$(GOBUILD) $(BUILD_FLAGS) -o $(BINARY_NAME) $(MAIN_PACKAGE)
## build-all: Build binaries for all platforms
build-all: clean
mkdir -p $(BUILD_DIR)
GOOS=linux GOARCH=amd64 $(GOBUILD) $(BUILD_FLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 $(MAIN_PACKAGE)
GOOS=linux GOARCH=arm64 $(GOBUILD) $(BUILD_FLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 $(MAIN_PACKAGE)
GOOS=darwin GOARCH=amd64 $(GOBUILD) $(BUILD_FLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 $(MAIN_PACKAGE)
GOOS=darwin GOARCH=arm64 $(GOBUILD) $(BUILD_FLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 $(MAIN_PACKAGE)
GOOS=windows GOARCH=amd64 $(GOBUILD) $(BUILD_FLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe $(MAIN_PACKAGE)
## test: Run tests
test:
$(GOTEST) -v ./...
## coverage: Run tests with coverage
coverage:
$(GOTEST) -coverprofile=coverage.out ./...
$(GOCMD) tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
## fmt: Format code
fmt:
$(GOFMT) -s -w .
## lint: Run linter (requires golangci-lint)
lint:
@which golangci-lint > /dev/null || (echo "golangci-lint not installed" && exit 1)
golangci-lint run
## clean: Clean build artifacts
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -rf $(BUILD_DIR)
rm -f coverage.out coverage.html
## deps: Download dependencies
deps:
$(GOMOD) download
$(GOMOD) tidy
## install: Install binary to system
install: build
sudo cp $(BINARY_NAME) /usr/local/bin/$(BINARY_NAME)
@echo "$(BINARY_NAME) installed to /usr/local/bin"
## uninstall: Remove binary from system
uninstall:
sudo rm -f /usr/local/bin/$(BINARY_NAME)
@echo "$(BINARY_NAME) removed from /usr/local/bin"
## dev: Run in development mode with auto-reload
dev:
@which air > /dev/null || (echo "Installing air..." && go install github.com/cosmtrek/air@latest)
@echo "Starting development server with hot reload..."
@echo "The server will start automatically and reload on code changes"
air
## docker-build: Build Docker image
docker-build:
docker build -t claude-code-open:$(VERSION) .
docker tag claude-code-open:$(VERSION) claude-code-open:latest
## docker-run: Run Docker container
docker-run:
docker run --rm -p 6970:6970 -v ~/.claude-code-open:/root/.claude-code-open claude-code-open:latest
## release: Create release build
release: clean fmt test build-all
@echo "Release $(VERSION) built successfully"
@echo "Binaries available in $(BUILD_DIR)/"
## help: Show this help message
help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@awk '/^##/{c=substr($$0,3);next}c&&/^[[:alpha:]][[:alnum:]_-]+:/{print substr($$1,1,index($$1,":")-1)":"c}1{c=""}' $(MAKEFILE_LIST) | column -t -s ":"