-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (47 loc) · 1.52 KB
/
Makefile
File metadata and controls
71 lines (47 loc) · 1.52 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
.PHONY: build build-wasm test test-coverage test-race clean run run-server
# Build variables
CLI_BINARY := ./bin/godsays
CLI_PATH := ./cmd/main.go
# Build flags
BUILD_FLAGS := -ldflags="-s -w"
help: ## Show this help message
@echo "Available commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
build: ## Build the binary
@echo "Building God Says Binary"
go build $(BUILD_FLAGS) -o $(CLI_BINARY) $(CLI_PATH)
make build-wasm: ## Build WASM
@echo "Building Godsays for platform wasm"
GOOS=js GOARCH=wasm go build -o web/main.wasm ./cmd/wasm
clean: ## Clean built binaries
@echo "Cleaning binaries..."
rm -f $(CLI_BINARY)
test: ## Run tests
@echo "Running tests..."
go test -v ./...
test-race: ## Run tests with race detection
@echo "Running tests with race detection..."
go test -race -v ./...
test-coverage: ## Run tests with coverage
@echo "Running tests with coverage..."
go test -cover ./...
run: build ## Run the God Says
./$(CLI_BINARY)
run-server: build ## Run God Says server
./$(CLI_BINARY) -http
install: build ## Install binaries to GOPATH/bin
@echo "Installing binaries..."
go install $(CLI_PATH)
go install $(SERVER_PATH)
deps: ## Download dependencies
@echo "Downloading dependencies..."
go mod download
go mod tidy
fmt: ## Format code
@echo "Formatting code..."
go fmt ./...
vet: ## Run go vet
@echo "Running go vet..."
go vet ./...
lint: fmt vet ## Run formatting and vetting
.DEFAULT_GOAL := help