@@ -27,8 +27,10 @@ CWARNS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-Wmissing-prototypes -Wmissing-declarations \
-Wwrite-strings -Wcast-align \
-Winit-self \
- -Wframe-larger-than=1024 \
- -Werror
+ -Wframe-larger-than=1024
+ifneq ($(ALLOW_WARNINGS),1)
+CWARNS += -Werror
+endif
# Host tools and options
HOSTCC=gcc
@@ -1,6 +1,9 @@
.DEFAULT_GOAL := all
-override CFLAGS += -O2 -Wall -Werror -I.
+override CFLAGS += -O2 -Wall -I.
+ifneq ($(ALLOW_WARNINGS),1)
+override CFLAGS += -Werror
+endif
OBJS = version.o gard.o
LIBFLASH_OBJS += libflash-file.o libflash-libflash.o libflash-libffs.o libflash-ecc.o libflash-blocklevel.o
OBJS += $(LIBFLASH_OBJS)
@@ -1,6 +1,9 @@
CC = $(CROSS_COMPILE)gcc
-CFLAGS += -m64 -Werror -Wall -g2 -ggdb
+CFLAGS += -m64 -Wall -g2 -ggdb
+ifneq ($(ALLOW_WARNINGS),1)
+CFLAGS += -Werror
+endif
LDFLAGS += -m64
ASFLAGS = -m64
CPPFLAGS += -I. -I../../include -I../../
@@ -9,7 +9,10 @@ INCDIR = $(PREFIX)/include/libflash
VERSION = $(shell ../../make_version.sh)
-CFLAGS += -m64 -Werror -Wall -g2 -ggdb -I. -fPIC
+CFLAGS += -m64 -Wall -g2 -ggdb -I. -fPIC
+ifneq ($(ALLOW_WARNINGS),1)
+CFLAGS += -Werror
+endif
.PHONY: links
links: libflash ccan common
When building in CI, we want to see all potential problems noted by compilers & static analysers that masquerade as a compiler, rather than halting on the first one. This is especially important as we tend to implement different/stricter/expensive checks compared to a typical compiler, and as such, these may not be visible when performing a normal build. This patch conditionally allows compiler warnings by passing ALLOW_WARNINGS=1 as a make variable. The default behaviour remains to fault on the first warning. Signed-off-by: Alastair D'Silva <alastair@d-silva.org> --- Makefile.main | 6 ++++-- external/gard/rules.mk | 5 ++++- external/opal-prd/Makefile | 5 ++++- external/shared/Makefile | 5 ++++- 4 files changed, 16 insertions(+), 5 deletions(-)