From 502b8387233944ed718ac53999c9cac0b8928a81 Mon Sep 17 00:00:00 2001 From: Moritz Clasmeier Date: Fri, 10 Apr 2026 13:58:27 +0200 Subject: [PATCH 1/2] Makefile targets for building for other platforms --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 9df1d5f..63a62ea 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,14 @@ build: ## Build the roxie binary $(GOBUILD) -ldflags "$(LDFLAGS)" -o $(BINARY) ./cmd @echo "✅ Build complete: $(BINARY)" +build-%: ## Build the roxie binary for a specific OS/ARCH (e.g., build-linux-amd64) + @$(eval PARTS := $(subst -, ,$*)) + @$(eval TARGET_OS := $(word 1,$(PARTS))) + @$(eval TARGET_ARCH := $(word 2,$(PARTS))) + @echo "🔨 Building roxie for $(TARGET_OS)/$(TARGET_ARCH)..." + CGO_ENABLED=0 GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) $(GOBUILD) -ldflags "$(LDFLAGS)" -o $(BINARY)-$* ./cmd + @echo "✅ Build complete: $(BINARY)-$*" + .PHONY: build-all build-all: fmt vet build ## Format, vet, and build From 40567a03e4909445ca53eefa881e3fa172cb3b6c Mon Sep 17 00:00:00 2001 From: Moritz Clasmeier Date: Sun, 12 Apr 2026 22:00:18 +0200 Subject: [PATCH 2/2] Error on invalid build target --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 63a62ea..27d2121 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,16 @@ build-%: ## Build the roxie binary for a specific OS/ARCH (e.g., build-linux-amd @$(eval PARTS := $(subst -, ,$*)) @$(eval TARGET_OS := $(word 1,$(PARTS))) @$(eval TARGET_ARCH := $(word 2,$(PARTS))) + @if ! echo "linux darwin" | grep -qw "$(TARGET_OS)"; then \ + echo "❌ Unsupported OS: $(TARGET_OS)"; \ + echo "Supported: linux, darwin"; \ + exit 1; \ + fi + @if ! echo "amd64 arm64" | grep -qw "$(TARGET_ARCH)"; then \ + echo "❌ Unsupported ARCH: $(TARGET_ARCH)"; \ + echo "Supported: amd64, arm64"; \ + exit 1; \ + fi @echo "🔨 Building roxie for $(TARGET_OS)/$(TARGET_ARCH)..." CGO_ENABLED=0 GOOS=$(TARGET_OS) GOARCH=$(TARGET_ARCH) $(GOBUILD) -ldflags "$(LDFLAGS)" -o $(BINARY)-$* ./cmd @echo "✅ Build complete: $(BINARY)-$*"