Skip to content

Commit 5b3c8e9

Browse files
committed
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 <[email protected]>
1 parent 51bfbe2 commit 5b3c8e9

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Makefile

+9-8
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
# (at your option) any later version.
1313
#
1414

15-
CC = gcc
16-
CFLAGS = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
15+
CC ?= gcc
16+
# Base CFLAGS can be overridden by environment
17+
CFLAGS ?= -O2
18+
# When debugging, disable -O2 and enable -g
19+
#CFLAGS ?= -g
20+
21+
CFLAGS += -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
1722
-Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef
1823

1924
# Let lseek and mmap support 64-bit wide offsets
@@ -22,12 +27,8 @@ CFLAGS += -D_FILE_OFFSET_BITS=64
2227
#CFLAGS += -DBIGENDIAN
2328
#CFLAGS += -DALIGNMENT_WORKAROUND
2429

25-
# When debugging, disable -O2 and enable -g.
26-
CFLAGS += -O2
27-
#CFLAGS += -g
28-
29-
# Pass linker flags here
30-
LDFLAGS =
30+
# Pass linker flags here (can be set from environment too)
31+
LDFLAGS ?=
3132

3233
DESTDIR =
3334
prefix = /usr/local

0 commit comments

Comments
 (0)