anical/Makefile
2026-11-02 22:22:22 +00:00

31 lines
984 B
Makefile

VERSION ?= $(shell git describe --tags --always --dirty)
LDFLAGS := -s -w -X main.version=$(VERSION)
PLATFORMS := linux/amd64 linux/arm64 windows/amd64
.PHONY: all cross darwin clean
all:
# Release build for the host platform
mkdir -p build
CGO_ENABLED=0 go build -trimpath -ldflags="$(LDFLAGS)" -o build/anical
cross:
# Pure-Go targets only; darwin is built separately on macOS
mkdir -p build
@for p in $(PLATFORMS); do \
os=$${p%/*}; arch=$${p#*/}; \
ext=""; [ "$$os" = "windows" ] && ext=".exe"; \
echo "building $$os/$$arch"; \
GOOS=$$os GOARCH=$$arch CGO_ENABLED=0 go build -trimpath \
-ldflags="$(LDFLAGS)" \
-o build/anical-$(VERSION)-$$os-$$arch$$ext || exit 1; \
done
darwin:
# Must run on macOS: systray needs cgo (Cocoa/Objective-C)
@test "$$(uname -s)" = "Darwin" || { echo "darwin target must run on macOS"; exit 1; }
mkdir -p build
go build -trimpath -ldflags="$(LDFLAGS)" -o build/anical-$(VERSION)-darwin-$$(uname -m)
clean:
rm -rf build