gralculator/Makefile
Grok 2a26148c8a chore(skeleton): minimal Go project layout + build system
- go.mod (1.24.2 + initial bubbletea/lipgloss)
- Makefile (build, install to ~/.local/bin/gralculator, test, clean; ldflags version injection)
- internal/version (ldflags-compatible String())
- main.go stub (version flag + placeholder)
- internal/calc/ (Engine skeleton with Base, CycleBase, IsInteger, ErrConversionNotPossible, FormatForDisplay stub + basic tests for CERR path)
- internal/ui/ (App model stub with Tab handling placeholder + lipgloss import for future rendering)

This establishes the three-phase foundation. Next: flesh out engine (phase 2), then TUI spike (phase 3). Paper trail continues.
2026-06-06 14:28:59 +01:00

54 lines
1.7 KiB
Makefile

.PHONY: test test-short test-cover build install clean help
SHELL := /bin/bash
# Versioning (override on command line or via env for releases)
VERSION ?= dev-$(shell git describe --tags --always --dirty 2>/dev/null || echo unknown)
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || echo unknown)
MODULE = github.com/gmgauthier/gralculator
LDFLAGS = -s -w \
-X '$(MODULE)/internal/version.Version=$(VERSION)' \
-X '$(MODULE)/internal/version.Commit=$(COMMIT)' \
-X '$(MODULE)/internal/version.BuildDate=$(DATE)' \
-X 'main.version=$(VERSION)'
test: deps
go test ./... -v -race
test-short: deps
go test -short ./... -v -race
test-cover: deps
@mkdir -p build
go test ./... -coverprofile=build/coverage.out
go tool cover -html=build/coverage.out -o build/coverage.html
@echo "✅ Coverage report: open build/coverage.html in your browser"
deps:
go mod download
build: deps
@mkdir -p build
go build -trimpath -ldflags "$(LDFLAGS)" -o build/gralculator .
@echo "✅ Dev build: VERSION=$(VERSION) COMMIT=$(COMMIT) DATE=$(DATE)"
@build/gralculator -v || true
install: build
mkdir -p ~/.local/bin
cp build/gralculator ~/.local/bin/gralculator
chmod +x ~/.local/bin/gralculator
@echo "✅ gralculator installed to ~/.local/bin/gralculator"
clean:
rm -rf build/
help:
@echo "Common targets:"
@echo " make build - build dev binary to build/gralculator"
@echo " make install - build and install to ~/.local/bin/gralculator"
@echo " make test - run all tests with race detector"
@echo " make test-short - short tests with race"
@echo " make clean - remove build/"