2026-04-19 21:04:57 -06:00
|
|
|
.PHONY: help build run test clean lint lint-fix install release-snapshot release-check
|
|
|
|
|
|
|
|
|
|
# Version derived from git tags; falls back to short SHA; appends -dirty if tree is modified.
|
|
|
|
|
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
|
|
|
|
LDFLAGS := -X 'forgejo.zerova.net/public/fgj-sid/cmd.version=$(VERSION)'
|
2025-12-08 09:56:54 +01:00
|
|
|
|
|
|
|
|
help:
|
|
|
|
|
@echo "Available commands:"
|
2026-04-19 21:04:57 -06:00
|
|
|
@echo " make build - Build the application (version: $(VERSION))"
|
2026-01-05 12:58:11 +01:00
|
|
|
@echo " make install - Install the binary to /usr/bin"
|
2025-12-08 09:56:54 +01:00
|
|
|
@echo " make run - Run the application"
|
|
|
|
|
@echo " make test - Run tests"
|
|
|
|
|
@echo " make lint - Run golangci-lint"
|
|
|
|
|
@echo " make lint-fix - Run golangci-lint with auto-fix"
|
|
|
|
|
@echo " make clean - Clean build artifacts"
|
2026-04-19 21:04:57 -06:00
|
|
|
@echo " make release-snapshot - Build snapshot release artifacts via goreleaser"
|
|
|
|
|
@echo " make release-check - Validate .goreleaser.yaml"
|
2025-12-08 09:56:54 +01:00
|
|
|
|
|
|
|
|
build:
|
2026-04-19 21:04:57 -06:00
|
|
|
go build -ldflags "$(LDFLAGS)" -o bin/fgj .
|
2025-12-08 09:56:54 +01:00
|
|
|
|
2026-01-05 12:58:11 +01:00
|
|
|
install: build
|
|
|
|
|
install -Dm755 bin/fgj /usr/bin/fgj
|
|
|
|
|
|
2025-12-08 09:56:54 +01:00
|
|
|
run:
|
|
|
|
|
go run .
|
|
|
|
|
|
|
|
|
|
test:
|
|
|
|
|
go test -v -race ./...
|
|
|
|
|
|
|
|
|
|
lint:
|
|
|
|
|
golangci-lint run ./...
|
|
|
|
|
|
|
|
|
|
lint-fix:
|
|
|
|
|
golangci-lint run --fix ./...
|
|
|
|
|
|
|
|
|
|
clean:
|
2026-04-19 21:04:57 -06:00
|
|
|
rm -rf bin/ dist/
|
2025-12-08 09:56:54 +01:00
|
|
|
go clean
|
2026-04-19 21:04:57 -06:00
|
|
|
|
|
|
|
|
release-snapshot:
|
|
|
|
|
goreleaser release --snapshot --clean --skip=publish
|
|
|
|
|
|
|
|
|
|
release-check:
|
|
|
|
|
goreleaser check
|