Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds os/arch detection to make build #122

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@ DASHBOARD_SERVER_DIR := ./backend/server
OS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
ARCH := $(shell uname -m)

# Translate the architecture to Go's format
ifeq ($(ARCH),x86_64)
GOARCH := amd64
else ifeq ($(ARCH),arm64)
GOARCH := arm64
else
GOARCH := $(ARCH)
endif

# Translate the OS to Go's format
ifeq ($(OS),darwin)
GOOS := darwin
else ifeq ($(OS),linux)
GOOS := linux
else ifeq ($(OS),windows)
GOOS := windows
else
GOOS := $(OS)
endif

# Default target
all: build

Expand All @@ -30,7 +50,7 @@ build-dashboard-ui:
# Build CLI binary for host platform
build-cli:
@echo "Building kubetail CLI binary..."
@cd $(CLI_DIR) && GOOS=darwin GOARCH=arm64 go build -o ../../$(OUTPUT_DIR)/$(CLI_BINARY)-darwin-arm64 ./main.go
@cd $(CLI_DIR) && GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o ../../$(OUTPUT_DIR)/$(CLI_BINARY) ./main.go

# Build all the CLI binaries
build-cli-all:
Expand Down