diff --git a/Makefile b/Makefile index aa38ca8..d616d6f 100755 --- a/Makefile +++ b/Makefile @@ -31,6 +31,13 @@ endif # Detect the architecture 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 # 64 bit Windows YQ2_ARCH ?= $(PROCESSOR_ARCHITEW6432) @@ -38,6 +45,7 @@ else # 32 bit Windows YQ2_ARCH ?= $(PROCESSOR_ARCHITECTURE) endif +endif # windows but MINGW_CHOST not defined else # 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/') @@ -120,13 +128,12 @@ endif # ---------- -# If we're building with gcc for i386 let's define -ffloat-store. -# This helps the old and crappy x87 FPU to produce correct values. -# Would be nice if Clang had something comparable. +# Using the default x87 float math on 32bit x86 causes rounding trouble +# -ffloat-store could work around that, but the better solution is to +# 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 ($(COMPILER), gcc) -override CFLAGS += -ffloat-store -endif +override CFLAGS += -msse -mfpmath=sse endif # Force SSE math on x86_64. All sane compilers should do this