]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: Makefile: add the new ERR variable to force -Werror
authorWilly Tarreau <w@1wt.eu>
Mon, 22 Oct 2018 04:22:46 +0000 (06:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 22 Oct 2018 04:22:46 +0000 (06:22 +0200)
Instead of having to fiddle with the CFLAGS, let's have ERR=1 to enable
-Werror.

Makefile

index b3b68957139ec5ba035ccba825be38bce5a72bb9..2d1798402ec5794f13f05e58c3265a3b3da287e8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -58,6 +58,7 @@
 #   DEP may be cleared to ignore changes to include files during development
 #   SMALL_OPTS may be used to specify some options to shrink memory usage.
 #   DEBUG may be used to set some internal debugging options.
+#   ERR may be set to non-empty to pass -Werror to the compiler
 #   ADDINC may be used to complete the include path in the form -Ipath.
 #   ADDLIB may be used to complete the library list in the form -Lpath -llib.
 #   DEFINE may be used to specify any additional define, which will be reported
@@ -150,6 +151,9 @@ LD = $(CC)
 # Those flags only feed CFLAGS so it is not mandatory to use this form.
 DEBUG_CFLAGS = -g
 
+#### Add -Werror when set to non-empty
+ERR =
+
 #### Compiler-specific flags that may be used to disable some negative over-
 # optimization or to silence some warnings. -fno-strict-aliasing is needed with
 # gcc >= 4.4.
@@ -838,6 +842,11 @@ EBTREE_DIR := ebtree
 #### Global compile options
 VERBOSE_CFLAGS = $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE)
 COPTS  = -Iinclude -I$(EBTREE_DIR) -Wall -Wextra
+
+ifneq ($(ERR),)
+COPTS += -Werror
+endif
+
 COPTS += $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE) $(SILENT_DEFINE)
 COPTS += $(DEBUG) $(OPTIONS_CFLAGS) $(ADDINC)