-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
111 lines (89 loc) · 2.85 KB
/
Makefile
File metadata and controls
111 lines (89 loc) · 2.85 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
108
109
110
111
# Agentic Memorizer Makefile
# Version from internal/version/VERSION file
VERSION := $(shell cat internal/version/VERSION)
# Git commit with optional -dirty suffix
GIT_DIRTY := $(shell git diff --quiet 2>/dev/null || echo "-dirty")
GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")$(GIT_DIRTY)
# Build date in ISO 8601 format
BUILD_DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
# Linker flags for version injection
LDFLAGS := -X github.com/leefowlercu/agentic-memorizer/internal/version.gitCommit=$(GIT_COMMIT) \
-X github.com/leefowlercu/agentic-memorizer/internal/version.buildDate=$(BUILD_DATE)
# Binary name
BINARY := memorizer
# Spec. and Plan files
SPEC_FILE := SPEC.md
PLAN_FILE := PLAN.md
# Install directory
INSTALL_DIR := $(HOME)/.local/bin
# ANSI color codes
GREEN := \033[0;32m
YELLOW := \033[0;33m
RED := \033[0;31m
NC := \033[0m
CHECK := \xE2\x9C\x93
.PHONY: build build-nocolor install install-nocolor clean clean-nocolor test test-nocolor test-race test-race-nocolor lint lint-nocolor lint-fix
# Build with colored output
build:
@printf "Building $(BINARY)..."
@go build -ldflags "$(LDFLAGS)" -o $(BINARY) .
@printf " $(GREEN)$(CHECK)$(NC)\n"
# Build without colors (for CI)
build-nocolor:
@printf "Building $(BINARY)..."
@go build -ldflags "$(LDFLAGS)" -o $(BINARY) .
@printf " $(CHECK)\n"
# Build and install to ~/.local/bin
install: build
@printf "Installing to $(INSTALL_DIR)..."
@mkdir -p $(INSTALL_DIR)
@cp $(BINARY) $(INSTALL_DIR)/
@printf " $(GREEN)$(CHECK)$(NC)\n"
# Install without colors (for CI)
install-nocolor: build-nocolor
@printf "Installing to $(INSTALL_DIR)..."
@mkdir -p $(INSTALL_DIR)
@cp $(BINARY) $(INSTALL_DIR)/
@printf " $(CHECK)\n"
# Clean build artifacts
clean:
@printf "Cleaning..."
@rm -f $(BINARY) $(SPEC_FILE) $(PLAN_FILE)
@printf " $(GREEN)$(CHECK)$(NC)\n"
clean-nocolor:
@printf "Cleaning..."
@rm -f $(BINARY) $(SPEC_FILE) $(PLAN_FILE)
@printf " $(CHECK)\n"
# Run tests
test:
@printf "Running tests..."
@go test ./... -v
@printf " $(GREEN)$(CHECK)$(NC)\n"
test-nocolor:
@printf "Running tests..."
@go test ./... -v
@printf " $(CHECK)\n"
# Run tests with race detector
# CGO_LDFLAGS suppresses macOS linker warnings about LC_DYSYMTAB
test-race:
@printf "Running tests with race detector..."
@CGO_LDFLAGS="-Wl,-w" go test -race ./... -v
@printf " $(GREEN)$(CHECK)$(NC)\n"
test-race-nocolor:
@printf "Running tests with race detector..."
@CGO_LDFLAGS="-Wl,-w" go test -race ./... -v
@printf " $(CHECK)\n"
# Run golangci-lint
lint:
@printf "Running linter..."
@golangci-lint run ./...
@printf " $(GREEN)$(CHECK)$(NC)\n"
lint-nocolor:
@printf "Running linter..."
@golangci-lint run ./...
@printf " $(CHECK)\n"
# Run golangci-lint with auto-fix
lint-fix:
@printf "Running linter with auto-fix..."
@golangci-lint run --fix ./...
@printf " $(GREEN)$(CHECK)$(NC)\n"