Blame SOURCES/0023-Allow-overriding-build-settings-from-the-environment.patch

f877e3
From 5b3c8e9950262fc941bb5b3b3a1275720d47d62d Mon Sep 17 00:00:00 2001
f877e3
From: Jean Delvare <jdelvare@suse.de>
f877e3
Date: Fri, 17 Apr 2020 17:14:15 +0200
f877e3
Subject: [PATCH 23/23] Allow overriding build settings from the environment
f877e3
f877e3
Let packagers pass their own CC, CFLAGS and LDFLAGS settings. The
f877e3
settings which are specific to dmidecode are appended later so that
f877e3
they are applied no matter what.
f877e3
f877e3
This should fix bug #55805:
f877e3
https://savannah.nongnu.org/bugs/?55805
f877e3
f877e3
Signed-off-by: Jean Delvare <jdelvare@suse.de>
f877e3
---
f877e3
 Makefile | 17 +++++++++--------
f877e3
 1 file changed, 9 insertions(+), 8 deletions(-)
f877e3
f877e3
diff --git a/Makefile b/Makefile
f877e3
index 194a523bdb46..7aa729d8ca01 100644
f877e3
--- a/Makefile
f877e3
+++ b/Makefile
f877e3
@@ -12,8 +12,13 @@
f877e3
 #   (at your option) any later version.
f877e3
 #
f877e3
 
f877e3
-CC      = gcc
f877e3
-CFLAGS  = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
f877e3
+CC     ?= gcc
f877e3
+# Base CFLAGS can be overridden by environment
f877e3
+CFLAGS ?= -O2
f877e3
+# When debugging, disable -O2 and enable -g
f877e3
+#CFLAGS ?= -g
f877e3
+
f877e3
+CFLAGS += -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
f877e3
           -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef
f877e3
 
f877e3
 # Let lseek and mmap support 64-bit wide offsets
f877e3
@@ -22,12 +27,8 @@ CFLAGS += -D_FILE_OFFSET_BITS=64
f877e3
 #CFLAGS += -DBIGENDIAN
f877e3
 #CFLAGS += -DALIGNMENT_WORKAROUND
f877e3
 
f877e3
-# When debugging, disable -O2 and enable -g.
f877e3
-CFLAGS += -O2
f877e3
-#CFLAGS += -g
f877e3
-
f877e3
-# Pass linker flags here
f877e3
-LDFLAGS =
f877e3
+# Pass linker flags here (can be set from environment too)
f877e3
+LDFLAGS ?=
f877e3
 
f877e3
 DESTDIR =
f877e3
 prefix  = /usr/local
f877e3
-- 
f877e3
2.17.1
f877e3