From 4ab66536b650e608039c0c3a205da897cb8bd2c5 Mon Sep 17 00:00:00 2001 From: Jason McCormick Date: Fri, 6 Nov 2026 19:10:44 -0500 Subject: new --- Makefile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..407e2f7 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev) +LDFLAGS := -s -w -X main.version=$(VERSION) +HOST ?= yttrium.mfamily.org + +.PHONY: build arm64 run deploy clean + +build: ## native build + CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o build/gps-clock-dash . + +arm64: ## Raspberry Pi (64-bit) build + GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o build/gps-clock-dash-arm64 . + +run: build + ./build/gps-clock-dash + +deploy: arm64 ## copy binary + unit to $(HOST) and (re)start the service + scp build/gps-clock-dash-arm64 deploy/gps-clock-dash.service $(HOST):/tmp/ + ssh -t $(HOST) 'sudo install -m 0755 /tmp/gps-clock-dash-arm64 /usr/local/bin/gps-clock-dash && \ + sudo install -m 0644 /tmp/gps-clock-dash.service /etc/systemd/system/gps-clock-dash.service && \ + sudo systemctl daemon-reload && sudo systemctl enable --now gps-clock-dash && \ + sudo systemctl restart gps-clock-dash && systemctl --no-pager status gps-clock-dash | head -5' + +clean: + rm -rf build -- cgit v1.2.3