From 6ad30915eb456d0dec58607780b459a17641a05c Mon Sep 17 00:00:00 2001 From: nbykov0 <166552198+nbykov0@users.noreply.github.com> Date: Wed, 30 Apr 2025 23:44:06 +0300 Subject: [PATCH] Add PLATFORM make variable; calculate it if undefined Signed-off-by: nbykov0 <166552198+nbykov0@users.noreply.github.com> --- scripts/common-envs.mk | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/common-envs.mk b/scripts/common-envs.mk index 99bc29eb..ff2ece4a 100644 --- a/scripts/common-envs.mk +++ b/scripts/common-envs.mk @@ -14,3 +14,16 @@ ifeq ($(COZYSTACK_VERSION),) $(shell git fetch upstream --tags) COZYSTACK_VERSION = $(patsubst v%,%,$(shell git describe --tags)) endif + +# Calculate PLATFORM based on current docker daemon arch +ifndef PLATFORM + DOCKER_DAEMON_ARCH := $(shell docker info --format='{{.Architecture}}') + ifeq ($(DOCKER_DAEMON_ARCH),x86_64) + PLATFORM := linux/amd64 + else ifeq ($(DOCKER_DAEMON_ARCH),aarch64) + PLATFORM := linux/arm64 + else + $(error Unsupported architecture: "$(DOCKER_DAEMON_ARCH)") + endif + undefine DOCKER_DAEMON_ARCH +endif