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
Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at --- Makefile | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index c72d10a..7289bed 100644 --- a/Makefile +++ b/Makefile @@ -32,11 +32,22 @@ AR ?= ar 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 @@ CLI_OBJS = flashrom.o cli_classic.o cli_output.o print.o 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. @@ -643,8 +655,13 @@ tarball: export @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 + +pedantic: export WARNERROR=no +pedantic: export PEDANTIC=yes +pedantic: clean + $(MAKE)
-.PHONY: all clean distclean compiler pciutils features export tarball dos featuresavailable +.PHONY: all clean distclean compiler pciutils features export tarball dos featuresavailable pedantic
-include $(OBJS:.o=.d)