From: Prarit Bhargava prarit@redhat.com
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 3fe617ccafd6 ("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. Reviewers should note that there is no harm in calling 'KBUILD_CFLAGS += -Werror' twice and that -Werror only appears once in gcc calls when compiling kernel files.
Signed-off-by: Prarit Bhargava prarit@redhat.com
diff --git a/makefile b/makefile index blahblah..blahblah 100644 --- a/makefile +++ b/makefile @@ -14,3 +14,13 @@ dist-%:: distg-%:: $(MAKE) -C redhat $(@) $(_EXTRA_ARGS)
+# Enable -Werror for RHEL +ifneq ($(DISABLE_WERROR),1) +ifneq ($(WITH_GCOV),1) +ifeq ($(KBUILD_EXTMOD),) +ifneq (,$(filter $(ARCH), x86 x86_64 powerpc s390 aarch64)) +KBUILD_CPPFLAGS-$(CONFIG_WERROR) += -Werror +endif +endif +endif +endif
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2240
From: Prarit Bhargava on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2240#note_1230134...
Good point, however, as I mentioned in the commit log we still occasionally see compile warnings in upstream code and we cannot have the build fail in ARK/Fedora due to those errors. That would bring ARK/Fedora to a halt :(. As such, I am not enabling CONFIG_WERROR in ARK/Fedora.
As for the top-level Makefile, I also addressed in the commit log: there is enough RHEL only code here that I'd prefer not to put it in the top-level Makefile as doing so would make future rebases in ARK/Fedora more difficult for @ptalbert and @jmflinuxtx. That's why I've put the code in out top-level makefile instead of the Makefile.
@ptalbert and @jmflinuxtx? Thoughts? Am I overthinking this and maybe I should just put the code in the top-level Makefile?
kernel@lists.fedoraproject.org