summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-06-19 23:53:54 -0400
committerTom Rini <trini@konsulko.com>2018-06-21 08:58:50 -0400
commitfa893990e9b53425af5f5059e04a2bffde91ccf9 (patch)
tree230f8575bad6e95b745b28bb8036e470d4ab9cc4 /Makefile
parenta5742efa20384a27d51ee6c43d02c2025536c65d (diff)
Makefile: Ensure we build with -std=gnu11
As many targets are now commonly built with gcc-6 or later (which defaults to a newer C standard than older compilers), certain C constructs are now being used as they produce more readable code. And while all compilers that we support building with support the C11 standard (and GNU11) they do not default to that standard. Ensure that we pass along -std=gnu11 when building. Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile5
1 files changed, 3 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index fe7bf11970..399c5a5b54 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__