[OS-BUILD PATCHv6 3/4] makefile: Add -Werror support for RHEL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

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_CPPFLAGS += -Werror' twice and that
-Werror only appears once in gcc calls when compiling kernel files.

Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>

diff --git a/makefile b/makefile
index blahblah..blahblah 100644
--- a/makefile
+++ b/makefile
@@ -14,3 +14,16 @@ 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
+else
+  ifeq ($(ENABLE_WERROR),1)
+    # always set error flags for RHEL builds
+    KBUILD_CPPFLAGS += -Werror
+    KBUILD_RUSTFLAGS += -Dwarnings
+  endif
+endif

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2240
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux