summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraristocratos <gnmjpl@gmail.com>2021-10-18 20:55:06 +0200
committeraristocratos <gnmjpl@gmail.com>2021-10-18 20:55:06 +0200
commitf15c2fdcf6d9a40da84387871045f91249086bb7 (patch)
tree168e4ed2c96a00f0c95f96226d85c94bd545533a
parent997bfd2712c87200019e91204952beda2db0498e (diff)
Fixed: Makefile g++ -dumpmachine failure to get platform on some distros
-rw-r--r--Makefile7
1 files changed, 5 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index e580ee0..3db602a 100644
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,11 @@ endif
PREFIX ?= /usr/local
-#? Detect PLATFORM and ARCH from gcc if not set
-PLATFORM ?= $(shell $(CXX) -dumpmachine | awk -F"-" '{ print (NF==4) ? $$3 : $$2 }')
+#? Detect PLATFORM and ARCH from uname/gcc if not set
+PLATFORM ?= $(shell uname -s || echo unknown)
+ifneq ($(filter unknown darwin, $(PLATFORM)),)
+ override PLATFORM := $(shell $(CXX) -dumpmachine | awk -F"-" '{ print (NF==4) ? $$3 : $$2 }')
+endif
ARCH ?= $(shell $(CXX) -dumpmachine | cut -d "-" -f 1)
override PLATFORM_LC := $(shell echo $(PLATFORM) | tr '[:upper:]' '[:lower:]')