File 0061-Respect-CROSS_COMPILE-when-CC-is-the-default.patch of Package mdadm.30550

From aced6fc9542077a69b00d05bc9cd66c12fc34950 Mon Sep 17 00:00:00 2001
From: dann frazier <dann.frazier@canonical.com>
Date: Mon, 9 Dec 2019 13:54:13 -0700
Subject: [PATCH] Respect $(CROSS_COMPILE) when $(CC) is the default
Git-commit: aced6fc9542077a69b00d05bc9cd66c12fc34950
Patch-mainline: mdadm-4.1+
References: jsc#SLE-10078, jsc#SLE-9348

Commit 1180ed5 told make to only respect $(CROSS_COMPILE) when $(CC)
was unset. But that will never be the case, as make provides
a default value for $(CC). Change this logic to respect $(CROSS_COMPILE)
when $(CC) is the default. Patch originally by Helmet Grohne.

Fixes: 1180ed5 ("Makefile: make the CC definition conditional")
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Signed-off-by: Coly Li <colyli@suse.de>

---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index dfe00b0..a33319a 100644
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,9 @@ ifdef COVERITY
 COVERITY_FLAGS=-include coverity-gcc-hack.h
 endif
 
-CC ?= $(CROSS_COMPILE)gcc
+ifeq ($(origin CC),default)
+CC := $(CROSS_COMPILE)gcc
+endif
 CXFLAGS ?= -ggdb
 CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter
 ifdef WARN_UNUSED
-- 
2.25.0

openSUSE Build Service is sponsored by