You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.7 KiB

  1. commit e1b3aa5613a5edbb52a44d69b3e6007d9d631981
  2. Author: Willy Tarreau <w@1wt.eu>
  3. Date: Mon Oct 22 06:22:46 2018 +0200
  4. BUILD: Makefile: add the new ERR variable to force -Werror
  5. Instead of having to fiddle with the CFLAGS, let's have ERR=1 to enable
  6. -Werror.
  7. (cherry picked from commit 23cd43e2d6fa2b6892a786a1a720c5f24e657f10)
  8. Signed-off-by: Willy Tarreau <w@1wt.eu>
  9. diff --git a/Makefile b/Makefile
  10. index 6ffc1b06..94e04738 100644
  11. --- a/Makefile
  12. +++ b/Makefile
  13. @@ -57,6 +57,7 @@
  14. # DEP may be cleared to ignore changes to include files during development
  15. # SMALL_OPTS may be used to specify some options to shrink memory usage.
  16. # DEBUG may be used to set some internal debugging options.
  17. +# ERR may be set to non-empty to pass -Werror to the compiler
  18. # ADDINC may be used to complete the include path in the form -Ipath.
  19. # ADDLIB may be used to complete the library list in the form -Lpath -llib.
  20. # DEFINE may be used to specify any additional define, which will be reported
  21. @@ -143,6 +144,9 @@ LD = $(CC)
  22. # Those flags only feed CFLAGS so it is not mandatory to use this form.
  23. DEBUG_CFLAGS = -g
  24. +#### Add -Werror when set to non-empty
  25. +ERR =
  26. +
  27. #### Compiler-specific flags that may be used to disable some negative over-
  28. # optimization or to silence some warnings. -fno-strict-aliasing is needed with
  29. # gcc >= 4.4.
  30. @@ -807,6 +811,11 @@ EBTREE_DIR := ebtree
  31. #### Global compile options
  32. VERBOSE_CFLAGS = $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE)
  33. COPTS = -Iinclude -I$(EBTREE_DIR) -Wall
  34. +
  35. +ifneq ($(ERR),)
  36. +COPTS += -Werror
  37. +endif
  38. +
  39. COPTS += $(CFLAGS) $(TARGET_CFLAGS) $(SMALL_OPTS) $(DEFINE) $(SILENT_DEFINE)
  40. COPTS += $(DEBUG) $(OPTIONS_CFLAGS) $(ADDINC)