mirror of
https://github.com/yquake2/ctf.git
synced 2024-11-12 23:44:30 +00:00
Fix architecture detection on Windows in Makefile
$PROCESSOR_ARCHITECTURE seems to contain the architecture of the host, but we need the architecture the current MinGW shell is targeting. $MINGW_CHOST seems to be just that, and on my system it's either i686-w64-mingw32 (mingw32.exe) or x86_64-w64-mingw32 (mingw64.exe) (No idea what it looks like for Windows on ARM...)
This commit is contained in:
parent
f31b3264d5
commit
928066d37d
1 changed files with 13 additions and 6 deletions
19
Makefile
19
Makefile
|
@ -31,6 +31,13 @@ endif
|
||||||
|
|
||||||
# Detect the architecture
|
# Detect the architecture
|
||||||
ifeq ($(YQ2_OSTYPE), Windows)
|
ifeq ($(YQ2_OSTYPE), Windows)
|
||||||
|
ifdef MINGW_CHOST
|
||||||
|
ifeq ($(MINGW_CHOST), x86_64-w64-mingw32)
|
||||||
|
YQ2_ARCH ?= x86_64
|
||||||
|
else # i686-w64-mingw32
|
||||||
|
YQ2_ARCH ?= i386
|
||||||
|
endif
|
||||||
|
else # windows, but MINGW_CHOST not defined
|
||||||
ifdef PROCESSOR_ARCHITEW6432
|
ifdef PROCESSOR_ARCHITEW6432
|
||||||
# 64 bit Windows
|
# 64 bit Windows
|
||||||
YQ2_ARCH ?= $(PROCESSOR_ARCHITEW6432)
|
YQ2_ARCH ?= $(PROCESSOR_ARCHITEW6432)
|
||||||
|
@ -38,6 +45,7 @@ else
|
||||||
# 32 bit Windows
|
# 32 bit Windows
|
||||||
YQ2_ARCH ?= $(PROCESSOR_ARCHITECTURE)
|
YQ2_ARCH ?= $(PROCESSOR_ARCHITECTURE)
|
||||||
endif
|
endif
|
||||||
|
endif # windows but MINGW_CHOST not defined
|
||||||
else
|
else
|
||||||
# Normalize some abiguous YQ2_ARCH strings
|
# Normalize some abiguous YQ2_ARCH strings
|
||||||
YQ2_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/')
|
YQ2_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/')
|
||||||
|
@ -120,13 +128,12 @@ endif
|
||||||
|
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
# If we're building with gcc for i386 let's define -ffloat-store.
|
# Using the default x87 float math on 32bit x86 causes rounding trouble
|
||||||
# This helps the old and crappy x87 FPU to produce correct values.
|
# -ffloat-store could work around that, but the better solution is to
|
||||||
# Would be nice if Clang had something comparable.
|
# just enforce SSE - every x86 CPU since Pentium3 supports that
|
||||||
|
# and this should even improve the performance on old CPUs
|
||||||
ifeq ($(YQ2_ARCH), i386)
|
ifeq ($(YQ2_ARCH), i386)
|
||||||
ifeq ($(COMPILER), gcc)
|
override CFLAGS += -msse -mfpmath=sse
|
||||||
override CFLAGS += -ffloat-store
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Force SSE math on x86_64. All sane compilers should do this
|
# Force SSE math on x86_64. All sane compilers should do this
|
||||||
|
|
Loading…
Reference in a new issue