Allow the user to disable -Werror which can sometimes raises unexpected build failures. More information on why -Werror is an issue can be found here: https://embeddedartistry.com/blog/2017/05/22/werror-is-not-your-friend This patch is a tentative to find an upstreamable solution to a patch that is carried in buildroot for more than 5 years: https://git.buildroot.net/buildroot/commit/?id=0bb0443ee97c61dad1b9e595b0e421de3eed58b9 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@xxxxxxxxx> --- Makefile | 5 ++++- configure | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 24686dd..24b50a6 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,10 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing -fno-common COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized -COMMON_CFLAGS += -Wignored-qualifiers -Werror -Wno-missing-braces +COMMON_CFLAGS += -Wignored-qualifiers -Wno-missing-braces +ifeq ($(CONFIG_WERROR),y) +COMMON_CFLAGS += -Werror +endif frame-pointer-flag=-f$(if $(KEEP_FRAME_POINTER),no-,)omit-frame-pointer fomit_frame_pointer := $(call cc-option, $(frame-pointer-flag), "") diff --git a/configure b/configure index c4fb4a2..8447762 100755 --- a/configure +++ b/configure @@ -30,6 +30,7 @@ gen_se_header= page_size= earlycon= efi= +werror=y usage() { cat <<-EOF @@ -75,6 +76,8 @@ usage() { Specify a PL011 compatible UART at address ADDR. Supported register stride is 32 bit only. --[enable|disable]-efi Boot and run from UEFI (disabled by default, x86_64 only) + --[enable|disable]-werror + Disable -Werror (enabled by default) EOF exit 1 } @@ -148,6 +151,12 @@ while [[ "$1" = -* ]]; do --disable-efi) efi=n ;; + --enable-werror) + werror=y + ;; + --disable-werror) + werror=n + ;; --help) usage ;; @@ -371,6 +380,7 @@ WA_DIVIDE=$wa_divide GENPROTIMG=${GENPROTIMG-genprotimg} HOST_KEY_DOCUMENT=$host_key_document CONFIG_EFI=$efi +CONFIG_WERROR=$werror GEN_SE_HEADER=$gen_se_header EOF if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then -- 2.35.1