[U-Boot] [PATCH] Makefile: Ensure we build with -std=gnu11

Tom Rini trini at konsulko.com
Wed Jun 20 03:57:31 UTC 2018


With the move to using at least gcc-6 for many targets we now have C
code that requires the GNU11 C standard to be used in all cases.

Signed-off-by: Tom Rini <trini at konsulko.com>
---
 Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index fe7bf11970b8..399c5a5b549d 100644
--- a/Makefile
+++ b/Makefile
@@ -263,8 +263,9 @@ HOSTCXXFLAGS = -O2
 # Some Linux distributions (including RHEL7, SLES13, Debian 8) still
 # have older compilers as their default, so we make it explicit for
 # these that our host tools are GNU11 (i.e. C11 w/ GNU extensions).
+CSTD_FLAG := -std=gnu11
 ifeq ($(HOSTOS),linux)
-HOSTCFLAGS += --std=gnu11
+HOSTCFLAGS += $(CSTD_FLAG)
 endif
 
 ifeq ($(HOSTOS),cygwin)
@@ -370,7 +371,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
 
 KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
 		   -Wno-format-security \
-		   -fno-builtin -ffreestanding
+		   -fno-builtin -ffreestanding $(CSTD_FLAG)
 KBUILD_CFLAGS	+= -fshort-wchar
 KBUILD_AFLAGS   := -D__ASSEMBLY__
 
-- 
2.7.4



More information about the U-Boot mailing list