Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
40 lines
1.2 KiB
Makefile
40 lines
1.2 KiB
Makefile
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
|
GO ?= go
|
|
PREFIX ?= /usr/local/bin
|
|
|
|
.PHONY: all web build dev deploy clean
|
|
|
|
all: build
|
|
|
|
web:
|
|
cd web && npm ci --no-audit --no-fund && npm run build
|
|
|
|
build: web
|
|
$(GO) build -trimpath -ldflags "-s -w -X main.version=$(VERSION)" -o bin/hamlab ./cmd/hamlab
|
|
|
|
# cross-compile for another Linux box (static binary, no cgo): make build-arm64 / build-amd64
|
|
build-%: web
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=$* $(GO) build -trimpath -ldflags "-s -w -X main.version=$(VERSION)" -o bin/hamlab-linux-$* ./cmd/hamlab
|
|
|
|
# backend only (assumes web/dist already built)
|
|
go:
|
|
$(GO) build -ldflags "-X main.version=$(VERSION)" -o bin/hamlab ./cmd/hamlab
|
|
|
|
dev:
|
|
cd web && npm run dev
|
|
|
|
# arm64 sibling for aarch64 machines (Mac mini); the hub pushes it to them
|
|
cross:
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build -trimpath -ldflags "-s -w -X main.version=$(VERSION)" -o bin/hamlab-linux-arm64 ./cmd/hamlab
|
|
|
|
deploy: build cross
|
|
./deploy/install.sh
|
|
@sleep 1; $(PREFIX)/hamlab push-nodes || true
|
|
|
|
# push the installed binary to every managed machine (what deploy does last)
|
|
push-nodes:
|
|
$(PREFIX)/hamlab push-nodes
|
|
|
|
clean:
|
|
rm -rf bin internal/web/dist web/dist
|