summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2020-04-17 17:14:15 +0200
committerJean Delvare <jdelvare@suse.de>2020-04-17 17:14:15 +0200
commit5b3c8e9950262fc941bb5b3b3a1275720d47d62d (patch)
treedfb9d513efd126b8444a3b92caf32f165557920e /Makefile
parent51bfbe2d5e8728e47f38eb44464f58ad674c4289 (diff)
downloaddmidecode-git-5b3c8e9950262fc941bb5b3b3a1275720d47d62d.tar.gz
Allow overriding build settings from the environment
Let packagers pass their own CC, CFLAGS and LDFLAGS settings. The settings which are specific to dmidecode are appended later so that they are applied no matter what. This should fix bug #55805: https://savannah.nongnu.org/bugs/?55805 Signed-off-by: Jean Delvare <jdelvare@suse.de>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 9 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 194a523..7aa729d 100644
--- a/Makefile
+++ b/Makefile
@@ -12,8 +12,13 @@
# (at your option) any later version.
#
-CC = gcc
-CFLAGS = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
+CC ?= gcc
+# Base CFLAGS can be overridden by environment
+CFLAGS ?= -O2
+# When debugging, disable -O2 and enable -g
+#CFLAGS ?= -g
+
+CFLAGS += -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
-Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef
# Let lseek and mmap support 64-bit wide offsets
@@ -22,12 +27,8 @@ CFLAGS += -D_FILE_OFFSET_BITS=64
#CFLAGS += -DBIGENDIAN
#CFLAGS += -DALIGNMENT_WORKAROUND
-# When debugging, disable -O2 and enable -g.
-CFLAGS += -O2
-#CFLAGS += -g
-
-# Pass linker flags here
-LDFLAGS =
+# Pass linker flags here (can be set from environment too)
+LDFLAGS ?=
DESTDIR =
prefix = /usr/local