Makefile: allow disabling compiler warnings

Move the user-specified CFLAGS to the end of the CFLAGS definition, so
that warnings the Makefile enables can be disabled using -Wno-$foo.
This is useful when old compilers give false positive warnings.
This commit is contained in:
Eric Biggers 2020-10-18 14:21:25 -07:00
parent ef936b6521
commit 303bb42c52

View File

@ -45,14 +45,14 @@ cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null \
1>&2 2>/dev/null; then echo $(1); fi)
override CFLAGS := \
-O2 -fomit-frame-pointer $(CFLAGS) -std=c99 -I. \
-Wall -Wundef \
-O2 -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \
$(call cc-option,-Wpedantic) \
$(call cc-option,-Wdeclaration-after-statement) \
$(call cc-option,-Wmissing-prototypes) \
$(call cc-option,-Wstrict-prototypes) \
$(call cc-option,-Wvla) \
$(call cc-option,-Wimplicit-fallthrough)
$(call cc-option,-Wimplicit-fallthrough) \
$(CFLAGS)
FREESTANDING :=
ifdef FREESTANDING