diff --git a/GNUmakefile b/GNUmakefile index a5e2a02a..7017f11c 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -31,7 +31,8 @@ else endif # Attempt to determine host machine, fallback to "this" machine. -# The host machine is the one the package runs on. +# The host machine is the one the package runs on. Most people +# call this the "target", but not Autotools. HOSTX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null | cut -f 1 -d '-') ifeq ($(HOSTX),) HOSTX := $(shell uname -m 2>/dev/null) @@ -46,7 +47,7 @@ IS_ARMV8 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'aarch32|aarch64') IS_SPARC32 := $(shell echo "$(HOSTX)" | $(GREP) -v "64" | $(GREP) -i -c 'sparc') IS_SPARC64 := $(shell echo "$(HOSTX)" | $(GREP) -i -c 'sparc64') -IS_NEON := $(shell $(CXX) $(CXXFLAGS) -dumpmachine | $(GREP) -i -c -E 'armv7|armhf|arm7l|eabihf|armv8|aarch32|aarch64') +IS_NEON := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null | $(GREP) -i -c -E 'armv7|armhf|arm7l|eabihf|armv8|aarch32|aarch64') SYSTEMX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null) IS_LINUX := $(shell echo "$(SYSTEMX)" | $(GREP) -i -c "Linux") diff --git a/GNUmakefile-cross b/GNUmakefile-cross index eec70b33..d604abcd 100755 --- a/GNUmakefile-cross +++ b/GNUmakefile-cross @@ -15,11 +15,18 @@ EGREP ?= egrep LN ?= ln -sf LDCONF ?= /sbin/ldconfig -n -MACHINE ?= $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null) -IS_i686 := $(shell echo "$MACHINE" | $(EGREP) -v 64 | $(EGREP) -i -c 'i.86') -IS_x86_64 := $(shell echo "$MACHINE" | $(EGREP) -i -c 'x86_64|amd64') -IS_ARM := $(shell echo "$MACHINE" | $(EGREP) -i -c 'arm') -IS_ARMv8 := $(shell echo "$MACHINE" | $(EGREP) -i -c 'aarch32|aarch64') +# Attempt to determine host machine, fallback to "this" machine. +# The host machine is the one the package runs on. Most people +# call this the "target", but not Autotools. +HOSTX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null | cut -f 1 -d '-') +ifeq ($(HOSTX),) + HOSTX := $(shell uname -m 2>/dev/null) +endif + +IS_i686 := $(shell echo "$HOSTX" | $(EGREP) -v 64 | $(EGREP) -i -c 'i.86') +IS_x86_64 := $(shell echo "$HOSTX" | $(EGREP) -i -c 'x86_64|amd64') +IS_ARM := $(shell echo "$HOSTX" | $(EGREP) -i -c 'arm') +IS_ARMv8 := $(shell echo "$HOSTX" | $(EGREP) -i -c 'aarch32|aarch64') CLANG_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang")