diff --git a/.gitignore b/.gitignore index 89ec9e2..bfb6935 100644 --- a/.gitignore +++ b/.gitignore @@ -172,4 +172,4 @@ Icon Network Trash Folder Temporary Items .apdisk - +bin/ diff --git a/Makefile b/Makefile index d6e8363..c7bf0a5 100644 --- a/Makefile +++ b/Makefile @@ -6,14 +6,16 @@ PKG := . SKILL_NAME := rollbar-cli SKILL_SOURCE_DIR := .ai/skills/$(SKILL_NAME) AI_SKILL_DIRS ?= $(HOME)/.codex/skills $(HOME)/.claude/skills $(HOME)/.config/claude/skills $(HOME)/.cursor/skills $(HOME)/.windsurf/skills +CROSS_PLATFORMS := darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 windows/amd64 windows/arm64 -.PHONY: all build install install-skill test test-cover clean help +.PHONY: all build build-cross install install-skill test test-cover clean help all: build help: @echo "Targets:" @echo " make build Build $(BINARY) into $(BUILD_DIR)/" + @echo " make build-cross Build common cross-platform binaries into $(BUILD_DIR)/" @echo " make install Install $(BINARY) with 'go install'" @echo " make install-skill Install .ai skill into common AI tool skill dirs" @echo " make test Run unit tests" @@ -24,6 +26,20 @@ build: @mkdir -p $(BUILD_DIR) go build -o $(BUILD_DIR)/$(BINARY) $(PKG) +build-cross: + @mkdir -p $(BUILD_DIR) + @set -e; \ + for target in $(CROSS_PLATFORMS); do \ + goos=$${target%/*}; \ + goarch=$${target#*/}; \ + output="$(BUILD_DIR)/$(BINARY)_$${goos}_$${goarch}"; \ + if [ "$$goos" = "windows" ]; then \ + output="$$output.exe"; \ + fi; \ + echo "Building $$output"; \ + CGO_ENABLED=0 GOOS=$$goos GOARCH=$$goarch go build -trimpath -ldflags="-s -w" -o "$$output" $(PKG); \ + done + install: install-skill go install $(PKG) diff --git a/README.md b/README.md index 597b29e..f19bb4c 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,9 @@ If you install with `go install` or `make install`, you can run `rollbar-cli ... # build binary into bin/ make build +# build common macOS, Linux, and Windows binaries into bin/ +make build-cross + # install skill into common AI tool skill directories make install-skill