# -------- version detection ------------------------------------------------- # Use latest annotated/lightweight tag; if none, fall back to short SHA. VERSION ?= $(shell git describe --tags --always --dirty=-dirty 2>/dev/null) # -------- linker flags ------------------------------------------------------- # No inner quotes around -X value — go tool handles the spaces correctly. LDFLAGS = -s -w -X "git.eeqj.de/sneak/sysinfo/internal/sysinfo.Version=$(VERSION)" # -------- generic go build/install ------------------------------------------ PKG_CMD = ./cmd/sysinfo build: go build -ldflags '$(LDFLAGS)' $(PKG_CMD) install: go install -ldflags '$(LDFLAGS)' $(PKG_CMD) clean: rm -f sysinfo .PHONY: build install clean