summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJason McCormick <jason@mfamily.org>2026-11-06 19:10:44 -0500
committerJason McCormick <jason@mfamily.org>2026-11-06 19:10:44 -0500
commit4ab66536b650e608039c0c3a205da897cb8bd2c5 (patch)
tree2bc890404b0ff33907383b64acc231cb0a777653 /Makefile
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 24 insertions, 0 deletions
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