Files
rtnetmon/Makefile
T
clawbot 05689e6f72
check / check (push) Waiting to run
Stamp the git tag or short commit into the binary (closes #10)
rtnetmon had no version. main.Version is now set at link time and logged
in the first startup line. `make build` and `make dev` set it from
`git describe --tags --always` unless VERSION is given. The Dockerfile
takes it from the VERSION build argument when one is given, otherwise
from `git describe --tags --always` of the .git the build context now
carries, and fails the build if the context carries .git and no version
comes out. .dockerignore follows the canonical copy: .git is sent,
.git/config, which can hold a credential, is not.

Model: opus-5-5
2026-10-02 07:49:18 +00:00

56 lines
812 B
Makefile

.PHONY: bootstrap setup test lint fmt fmt-check check build run dev deps \
docker cibuild clean hooks
# Target bodies live in script/ (Scripts to Rule Them All); the targets
# below are thin shims that call them.
.DEFAULT_GOAL := check
VERSION ?= $(shell git describe --tags --always)
bootstrap:
@script/bootstrap
setup:
@script/setup
test:
@script/test
lint:
@script/lint
fmt:
@script/fmt
fmt-check:
@script/fmt-check
check:
@script/check
docker:
@script/docker
cibuild:
@script/cibuild
hooks:
@script/install-precommit
build:
CGO_ENABLED=0 go build -trimpath -ldflags "-X main.Version=$(VERSION)" \
-o bin/rtnetmon ./cmd/rtnetmon
run: build
./bin/rtnetmon
dev:
go run -ldflags "-X main.Version=$(VERSION)" ./cmd/rtnetmon
deps:
go mod download
go mod tidy
clean:
rm -rf bin/