]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Respect $(CROSS_COMPILE) when $(CC) is the default
authordann frazier <dann.frazier@canonical.com>
Mon, 9 Dec 2019 20:54:13 +0000 (13:54 -0700)
committerJes Sorensen <jsorensen@fb.com>
Thu, 16 Jan 2020 18:46:53 +0000 (13:46 -0500)
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>
Makefile

index dfe00b0a0be807597cb979342c15867bd11c570f..a33319a890cf1b9335acd4eb4a0ea1dd1467cfc2 100644 (file)
--- 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