From 9ebfb9bd745cc042b7317de7016e44c88ae2e26d Mon Sep 17 00:00:00 2001
From: Christopher Degawa <ccom@randomderp.com>
Date: Thu, 19 May 2022 23:24:48 -0500
Subject: [PATCH 2/2] mingw-w64.mk: don't override the compilers etc if
 provided

Also, inherit LD from CXX rather than manually setting it to g++

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
---
 build/make/config-mingw64-win32.mk | 9 +++++----
 build/make/config-mingw64-win64.mk | 9 +++++----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/build/make/config-mingw64-win32.mk b/build/make/config-mingw64-win32.mk
index d1c579bae..4e41c607d 100644
--- a/build/make/config-mingw64-win32.mk
+++ b/build/make/config-mingw64-win32.mk
@@ -1,8 +1,9 @@
 
-CC  = i686-w64-mingw32-gcc$(MINGW_FLAVOUR)
-CXX = i686-w64-mingw32-g++$(MINGW_FLAVOUR)
-LD  = i686-w64-mingw32-g++$(MINGW_FLAVOUR)
-AR  = i686-w64-mingw32-ar$(MINGW_FLAVOUR)
+MINGW_ARCH := i686
+CC  := $(or $(CC),$(MINGW_ARCH)-w64-mingw32-gcc$(MINGW_FLAVOUR))
+CXX := $(or $(CXX),$(MINGW_ARCH)-w64-mingw32-g++$(MINGW_FLAVOUR))
+LD  := $(CXX)
+AR  := $(or $(AR),$(MINGW_ARCH)-w64-mingw32-ar$(MINGW_FLAVOUR))
 
 CXXFLAGS_STDCXX = -std=c++17
 CFLAGS_STDC = -std=c99
diff --git a/build/make/config-mingw64-win64.mk b/build/make/config-mingw64-win64.mk
index fc4f8eaf3..6c85d2ba2 100644
--- a/build/make/config-mingw64-win64.mk
+++ b/build/make/config-mingw64-win64.mk
@@ -1,8 +1,9 @@
 
-CC  = x86_64-w64-mingw32-gcc$(MINGW_FLAVOUR)
-CXX = x86_64-w64-mingw32-g++$(MINGW_FLAVOUR)
-LD  = x86_64-w64-mingw32-g++$(MINGW_FLAVOUR)
-AR  = x86_64-w64-mingw32-ar$(MINGW_FLAVOUR)
+MINGW_ARCH := x86_64
+CC  := $(or $(CC),$(MINGW_ARCH)-w64-mingw32-gcc$(MINGW_FLAVOUR))
+CXX := $(or $(CXX),$(MINGW_ARCH)-w64-mingw32-g++$(MINGW_FLAVOUR))
+LD  := $(CXX)
+AR  := $(or $(AR),$(MINGW_ARCH)-w64-mingw32-ar$(MINGW_FLAVOUR))
 
 CXXFLAGS_STDCXX = -std=c++17
 CFLAGS_STDC = -std=c99
-- 
2.36.1

