https://bugs.openldap.org/show_bug.cgi?id=9525
--- Comment #3 from Quanah Gibson-Mount quanah@openldap.org --- (In reply to Howard Chu from comment #1)
(In reply to Quanah Gibson-Mount from comment #0)
Currently the contrib makefiles use a variable "OPT", instead they should be fixed to correctly honor CFLAGS, CPPFLAGS, and LDFLAGS as appropriate
No.
CFLAGS / CPPFLAGS are to control non-optimization-related compilation flags. OPT is to control optimization only, without changing any other aspect of the build.
In particular, CFLAGS comprises the entire set of flags; overriding CFLAGS from the make commandline usually means you have to either redundantly specify a lot of important flags, or lose them in the process.
Modern builds use tools to do the builds, which set up the CFLAGS, CPPFLAGS, and LFLAGS so that a consistent build can be obtained across the board. Tools such as these are used whether for distributions or general hobbyists. The use of OPT breaks the ability to explicitly set critical flags, for example around producing hardened builds, when building contrib overlays and modules that are *not* ignored when building the standard overlays and modules, creating inconsistent results and breaking expectations that build behavior should be consistent regardless of whether they are overlays shipped in the main portion of OpenLDAP or as contrib modules.