From 4cc1a87096612c436dc80e8e85efa522d8c74e85 Mon Sep 17 00:00:00 2001 From: cytopia Date: Mon, 24 Oct 2022 13:12:32 +0200 Subject: [PATCH] Move platform detection into docker Makefile --- Makefile.docker | 10 +++++++++- Makefile.platform | 27 --------------------------- README.md | 3 +-- 3 files changed, 10 insertions(+), 30 deletions(-) delete mode 100644 Makefile.platform diff --git a/Makefile.docker b/Makefile.docker index e973358..69c87c8 100644 --- a/Makefile.docker +++ b/Makefile.docker @@ -19,11 +19,19 @@ IMAGE = # ------------------------------------------------------------------------------------------------- NO_CACHE = ARGS = -ARCH = linux/amd64 DOCKER_TAG = latest DIR = . FILE = Dockerfile +# Auto-detect current platform and use it as default to build for +_PLATFORM = $(shell uname -m) +ifeq ($(strip $(_PLATFORM)),x86_64) + ARCH = linux/amd64 +else + ifeq ($(strip $(_PLATFORM)),arm64) + ARCH = linux/arm64 + endif +endif # ------------------------------------------------------------------------------------------------- # Targets diff --git a/Makefile.platform b/Makefile.platform deleted file mode 100644 index e552178..0000000 --- a/Makefile.platform +++ /dev/null @@ -1,27 +0,0 @@ -ifneq (,) -.error This Makefile requires GNU Make. -endif - -ifndef VERBOSE -MAKEFLAGS += --no-print-directory -endif - - -# ------------------------------------------------------------------------------------------------- -# Default configuration -# ------------------------------------------------------------------------------------------------- -ARCH = linux/amd64 - - -# ------------------------------------------------------------------------------------------------- -# Dynamic configuration -# ------------------------------------------------------------------------------------------------- -_PLATFORM = $(shell uname -m) - -ifeq ($(strip $(_PLATFORM)),x86_64) - ARCH = linux/amd64 -else - ifeq ($(strip $(_PLATFORM)),arm64) - ARCH = linux/arm64 - endif -endif diff --git a/README.md b/README.md index 2fee3be..95862a6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ifneq (,) endif # Ensure additional Makefiles are present -MAKEFILES = Makefile.docker Makefile.lint Makefile.platform +MAKEFILES = Makefile.docker Makefile.lint $(MAKEFILES): URL=https://raw.githubusercontent.com/devilbox/makefiles/master/$(@) $(MAKEFILES): @if ! (curl --fail -sS -o $(@) $(URL) || wget -O $(@) $(URL)); then \ @@ -27,7 +27,6 @@ include $(MAKEFILES) ```gitignore Makefile.docker Makefile.lint -Makefile.platform ```