terraria-companion/Makefile
Felipe M. 0d4cfdc520
chore: simplify Makefile, use goreleaser for cross-platform builds
Replace build-linux and build-all with build-snapshot using goreleaser.
Remove fetch-js target (legacy). Simplify clean-data to rm -rf data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 23:49:04 +01:00

67 lines
2.6 KiB
Makefile

BINARY_NAME := terraria-companion
PORT ?= 3000
# ── Build ────────────────────────────────────────────────────────
.PHONY: build
build: ## Build the production binary (embeds data assets)
go build -tags embed_data -o $(BINARY_NAME) .
.PHONY: build-nodata
build-nodata: ## Build without embedded data (for CI/containers)
go build -o $(BINARY_NAME) .
.PHONY: build-snapshot
build-snapshot: ## Build all platforms locally via goreleaser (snapshot)
goreleaser build --snapshot --clean
# ── Development ──────────────────────────────────────────────────
.PHONY: dev
dev: ## Run in dev mode (serves frontend from disk, hot-reloads data)
DEV=1 go run .
.PHONY: serve
serve: build ## Build and run the production server
./$(BINARY_NAME)
# ── Data Fetching ────────────────────────────────────────────────
.PHONY: fetch
fetch: ## Fetch/resume data from Terraria wiki (Go fetcher)
go run . fetch
.PHONY: fetch-reset
fetch-reset: ## Reset fetch state and start fresh
go run . fetch --reset
.PHONY: fetch-only
fetch-only: ## Fetch a single phase (usage: make fetch-only PHASE=drops)
go run . fetch --only=$(PHASE)
# ── Quality ──────────────────────────────────────────────────────
.PHONY: format
format: ## Format Go source files
gofmt -w .
.PHONY: lint
lint: ## Run linter
golangci-lint run ./...
.PHONY: ci-lint
ci-lint: ## Run linter with colored output (for CI)
golangci-lint run --out-format colored-line-number ./...
# ── Cleanup ──────────────────────────────────────────────────────
.PHONY: clean
clean: ## Remove build artifacts
rm -f $(BINARY_NAME) $(BINARY_NAME)-*
rm -rf dist/
.PHONY: clean-data
clean-data: ## Remove fetched data (keeps icons as cache)
rm -rf data
# ── Help ─────────────────────────────────────────────────────────
.PHONY: help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help