Embeds the git short hash and UTC build timestamp into both binaries via ldflags so it's easy to confirm which build is actually deployed, without needing to hand-maintain a version number. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
21 lines
718 B
Makefile
21 lines
718 B
Makefile
VERSION := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
|
BUILDTIME := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
LDFLAGS := -X github.com/hculpan/areweplaying/pkg/version.Version=$(VERSION) -X github.com/hculpan/areweplaying/pkg/version.BuildTime=$(BUILDTIME)
|
|
|
|
all: build
|
|
|
|
build:
|
|
templ generate
|
|
go build -ldflags "$(LDFLAGS)" -o areweplaying cmd/web/*.go
|
|
go build -ldflags "$(LDFLAGS)" -o awp-cli cmd/cli/*.go
|
|
|
|
linuxbuild:
|
|
templ generate
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o areweplaying.linux cmd/web/*.go
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o awp-cli.linux cmd/cli/*.go
|
|
|
|
clean:
|
|
rm -rf areweplaying
|
|
rm -rf areweplaying.*
|
|
|
|
test:
|