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

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