From b8d0718b5c5de9627a2f5b72f4c6a3980ff15452 Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 25 Oct 2017 09:43:01 +0000 Subject: [PATCH] Attempt to work around a gcc bug with -dumpmachine by using -print-multiarch with a second workaround. gcc sucks. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5157 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/engine/Makefile b/engine/Makefile index ab1d47874..5f19bcadd 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -531,7 +531,16 @@ ifeq ($(FTE_TARGET),vc) ARCH?=i686-w64-mingw32 endif else - ARCH?=$(shell $(CC) -dumpmachine) + #some idiot decided that -dumpmachine shouldn't respect -m32 etc. + #at the same time, -print-multiarch is not present, buggy, or just screwed in many gcc builds (ones that target a single arch will unhelpfully just give an empty string). + #so try multiarch first, and if that fails risk dumpmachine giving the wrong values. + #really we want dumpmachine's more specific cpu arch included here, so lets hope that idiot burns for all eternity. or something equally melodramatic. + ARCH:=$(shell $(CC) -print-multiarch) + ifneq ($(words $(ARCH)),1) + foo:=$(shell echo falling back on dumpmachine 1>&2 ) + ARCH:=$(shell $(CC) -dumpmachine) + endif + foo:=$(shell echo ARCH is $(ARCH) 1>&2 ) endif ARCHLIBS=$(NATIVE_ABSBASE_DIR)/libs-$(ARCH)