Files
exo/Makefile
Kyle Isom bb2c7f7ef3 Add Phase 1 foundation: Go module, core types, DB infrastructure, config
Establish the project foundation with three packages:
- core: shared types (Header, Metadata, Value, ObjectType, UUID generation)
- db: SQLite migration framework, connection management (WAL, FK, busy
  timeout), transaction helpers (StartTX/EndTX), time conversion
- config: runtime configuration (DB path, blob store, Minio, gRPC addr)

Includes initial schema migration (001_initial.sql) with 13 tables covering
shared infrastructure, bibliographic data, and artifact repository. Full test
coverage for all packages, strict linting (.golangci.yaml), and Makefile.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 09:46:08 -07:00

102 lines
3.7 KiB
Makefile

# Makefile — exo build, test, lint, and release targets
#
# Usage:
# make build — compile all binaries to bin/
# make test — run tests with race detector
# make vet — run go vet
# make lint — run golangci-lint
# make all — vet -> lint -> test -> build (CI pipeline)
# make generate — regenerate protobuf stubs (requires protoc)
# make clean — remove bin/ and generated artifacts
# ---------------------------------------------------------------------------
# Variables
# ---------------------------------------------------------------------------
MODULE := git.wntrmute.dev/kyle/exo
BINARIES := exo exod
BIN_DIR := bin
VERSION := $(shell git describe --tags --always 2>/dev/null || echo dev)
GO := go
GOFLAGS := -trimpath
LDFLAGS := -s -w -X main.version=$(VERSION)
CGO := CGO_ENABLED=1
CGO_TEST := CGO_ENABLED=1
# ---------------------------------------------------------------------------
# Default target — CI pipeline: vet -> lint -> test -> build
# ---------------------------------------------------------------------------
.PHONY: all
all: vet lint test build
# ---------------------------------------------------------------------------
# build — compile all binaries to bin/
# ---------------------------------------------------------------------------
.PHONY: build
build:
@mkdir -p $(BIN_DIR)
@for bin in $(BINARIES); do \
echo " GO BUILD cmd/$$bin"; \
$(CGO) $(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" \
-o $(BIN_DIR)/$$bin ./cmd/$$bin; \
done
# ---------------------------------------------------------------------------
# test — run all tests with race detector
# ---------------------------------------------------------------------------
.PHONY: test
test:
$(CGO_TEST) $(GO) test -race -count=1 ./...
# ---------------------------------------------------------------------------
# vet — static analysis via go vet
# ---------------------------------------------------------------------------
.PHONY: vet
vet:
$(GO) vet ./...
# ---------------------------------------------------------------------------
# lint — run golangci-lint
# ---------------------------------------------------------------------------
.PHONY: lint
lint:
golangci-lint run ./...
# ---------------------------------------------------------------------------
# generate — regenerate protobuf stubs from proto/ definitions
# Requires: protoc, protoc-gen-go, protoc-gen-go-grpc
# ---------------------------------------------------------------------------
.PHONY: generate
generate:
$(GO) generate ./...
# ---------------------------------------------------------------------------
# clean — remove build artifacts
# ---------------------------------------------------------------------------
.PHONY: clean
clean:
rm -rf $(BIN_DIR)
# ---------------------------------------------------------------------------
# install-local — install binaries to ~/.local/bin
# ---------------------------------------------------------------------------
.PHONY: install-local
install-local: build
cp bin/* $(HOME)/.local/bin/
# ---------------------------------------------------------------------------
# Help
# ---------------------------------------------------------------------------
.PHONY: help
help:
@echo "Available targets:"
@echo " all vet -> lint -> test -> build (CI pipeline)"
@echo " build Compile all binaries to bin/"
@echo " test Run tests with race detector"
@echo " vet Run go vet"
@echo " lint Run golangci-lint"
@echo " generate Regenerate protobuf stubs"
@echo " clean Remove build artifacts"
@echo " install-local Install binaries to ~/.local/bin"