Nico Huber has uploaded this change for review. ( https://review.coreboot.org/23806
Change subject: Be optionally seriously pedantic ......................................................................
Be optionally seriously pedantic
This allows to easily test flashrom with numerous compiler warnings enabled. A new variable "PEDANTIC" is introduced which disables the feature by default, but can be overriden on the CLI. Additionally a new phony target "pedantic" is introduced which disables -Werror, enables the pedantic warnings and calls the default target recursively. It also has 'clean' as prerequisite to create consistent output.
--- TODO: - make it possible to execute other targets with make pedantic(?) (something like "make pedantic target=djgpp-dos") - refine warnings used
Change-Id: Ie731bdd2af95fb9eb2ee12c34e7e1998a113cd93 Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at --- M Makefile 1 file changed, 19 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/06/23806/1
diff --git a/Makefile b/Makefile index 26f978f..143382a 100644 --- a/Makefile +++ b/Makefile @@ -32,11 +32,22 @@ RANLIB ?= ranlib
WARNERROR ?= yes +PEDANTIC ?= no
ifeq ($(WARNERROR), yes) CFLAGS += -Werror endif
+ifeq ($(PEDANTIC), yes) +CFLAGS += -std=c99 --pedantic -Wextra -fstrict-aliasing\ + -Wmissing-include-dirs -Winit-self -Wswitch-enum \ + -Wundef -Wbad-function-cast -Wcast-qual -Wcast-align -Wconversion \ + -Wstrict-prototypes -Wmissing-declarations -Wredundant-decls\ + \ + -Wno-unused-parameter + # -Wno-missing-field-initializers -Wno-sign-conversion +endif + # Determine the destination processor architecture override ARCH := $(strip $(shell LC_ALL=C $(CC) -E arch.h|grep -v '^#'))
@@ -248,6 +259,7 @@ PROGRAMMER_OBJS = udelay.o programmer.o
all: pciutils features $(PROGRAM)$(EXEC_SUFFIX) + @echo $(CFLAGS)
# Set the flashrom version string from the highest revision number # of the checked out flashrom files. @@ -671,8 +683,13 @@ @echo Created $(EXPORTDIR)/flashrom-$(RELEASENAME).tar.bz2
djgpp-dos: clean - make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip WARNERROR=no OS_ARCH=DOS + $(MAKE) CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip WARNERROR=no OS_ARCH=DOS
-.PHONY: all clean distclean compiler pciutils features export tarball dos featuresavailable +pedantic: export WARNERROR=no +pedantic: export PEDANTIC=yes +pedantic: clean + $(MAKE) + +.PHONY: all clean distclean compiler pciutils features export tarball dos featuresavailable pedantic
-include $(OBJS:.o=.d)