Skip to content

Commit c77b4aa

Browse files
zandreyjforissier
authored andcommitted
flags: do not override CFLAGS from host
Some build systems set CFLAGS in environment before the build, but they got overridden by CFLAGS immediate assignment operator. Replace immediate assignment with append directive and use override directive, so the former definition of CFLAGS gets passed either from command line or via environment is completely expanded (see [1] for detailed explanation of override directive and variable append). Link: [1] https://www.gnu.org/software/make/manual/html_node/Override-Directive.html Signed-off-by: Andrey Zhizhikin <[email protected]> Reviewed-by: Jerome Forissier <[email protected]> Reviewed-by: Joakim Bech <[email protected]>
1 parent e9e5596 commit c77b4aa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

flags.mk

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CROSS_COMPILE ?= arm-linux-gnueabihf-
66
CC ?= $(CROSS_COMPILE)gcc
77
AR ?= $(CROSS_COMPILE)ar
88

9-
CFLAGS := -Wall -Wbad-function-cast -Wcast-align \
9+
override CFLAGS += -Wall -Wbad-function-cast -Wcast-align \
1010
-Werror-implicit-function-declaration -Wextra \
1111
-Wfloat-equal -Wformat-nonliteral -Wformat-security \
1212
-Wformat=2 -Winit-self -Wmissing-declarations \
@@ -16,13 +16,13 @@ CFLAGS := -Wall -Wbad-function-cast -Wcast-align \
1616
-Wswitch-default -Wunsafe-loop-optimizations \
1717
-Wwrite-strings -D_FILE_OFFSET_BITS=64
1818
ifeq ($(CFG_WERROR),y)
19-
CFLAGS += -Werror
19+
override CFLAGS += -Werror
2020
endif
21-
CFLAGS += -c -fPIC
21+
override CFLAGS += -c -fPIC
2222

2323
DEBUG ?= 0
2424
ifeq ($(DEBUG), 1)
25-
CFLAGS += -DDEBUG -O0 -g
25+
override CFLAGS += -DDEBUG -O0 -g
2626
endif
2727

2828
RM := rm -f

0 commit comments

Comments
 (0)