makefile: Add -Werror support for RHEL

The -Werror flag should be enabled for RHEL.  In ARK, however, it is a bit
tricky to enable -Werror as a build bug occasionally leaks through
upstream review and into Linus' tree.  As a consequence, CONFIG_WERROR
cannot be enabled in ARK but the code to add the flag for RHEL commpiles
can be added to the top-level makefile.

This code could be placed in the top-level Makefile, around the -Werror
line added by Linus in 3fe617ccaf ("Enable '-Werror' by default for all
kernel builds"), but given the amount of RHEL Only code here it is best to
keep it separated in our top-level makefile.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
This commit is contained in:
Prarit Bhargava 2023-01-05 18:18:40 -05:00 committed by Justin M. Forbes
parent 8e5043e816
commit 23b5ec1b39
No known key found for this signature in database
GPG Key ID: B8FA7924A4B1C140
1 changed files with 7 additions and 0 deletions

View File

@ -14,3 +14,10 @@ dist-%::
distg-%::
$(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
ifeq (,$(filter $(ARCH), x86 x86_64 powerpc s390 aarch64))
ifneq ($(KBUILD_EXTMOD),)
# always strip out error flags for external modules
KBUILD_CPPFLAGS := $(filter-out -Werror,$(KBUILD_CPPFLAGS))
KBUILD_RUSTFLAGS := $(filter-out -Dwarnings,$(KBUILD_RUSTFLAGS))
endif
endif