summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile26
1 files changed, 25 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 6f41b6fb..6649887f 100644
--- a/Makefile
+++ b/Makefile
@@ -466,7 +466,7 @@ else # ifeq darwin
ifeq ($(PLATFORM),mingw32)
# Some MinGW installations define CC to cc, but don't actually provide cc,
- # so explicitly use gcc instead (which is the only option anyway)
+ # so check that CC points to a real binary and use gcc if it doesn't
ifeq ($(call bin_path, $(CC)),)
CC=gcc
endif
@@ -475,6 +475,30 @@ ifeq ($(PLATFORM),mingw32)
WINDRES=windres
endif
+ ifeq ($(CROSS_COMPILING),1)
+ # If CC is already set to something generic, we probably want to use
+ # something more specific
+ ifneq ($(findstring $(CC),cc gcc),)
+ CC=
+ endif
+
+ # We need to figure out the correct compiler
+ ifeq ($(CC),)
+ ifeq ($(ARCH),x86_64)
+ MINGW_PREFIXES=amd64-mingw32msvc x86_64-w64-mingw32
+ endif
+ ifeq ($(ARCH),x86)
+ MINGW_PREFIXES=i586-mingw32msvc i686-w64-mingw32
+ endif
+
+ CC=$(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
+ $(call bin_path, $(MINGW_PREFIX)-gcc)))
+
+ WINDRES=$(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
+ $(call bin_path, $(MINGW_PREFIX)-windres)))
+ endif
+ endif
+
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-DUSE_ICON