> On 04 Jun 2017, at 14:37, Willy Tarreau <[email protected]> wrote: > > On Sat, Jun 03, 2017 at 10:36:04AM +0200, Aleksandar Lazic wrote: >> Hi Dmitry Sivachenko, >> >> Dmitry wrote on: >> >>> Hello, >> >>> Right now we have in the Makefile: >> >>> #### Common CFLAGS >>> # These CFLAGS contain general optimization options, CPU-specific >>> optimizations >>> # and debug flags. They may be overridden by some distributions which >>> prefer to >>> # set all of them at once instead of playing with the CPU and DEBUG >>> variables. >>> CFLAGS = $(ARCH_FLAGS) $(CPU_CFLAGS) $(DEBUG_CFLAGS) $(SPEC_CFLAGS) >> >>> So you explicitly suggest to override CFLAGS if someone want to add >>> custom options here (say, tune optimisations). >> >>> But this way now mandatory -fwrap will be lost. Or one must remember not >>> to loose it. >>> This is not convenient. >> >>> I propose to add some means to inherit CFLAGS defined in haproxy's >>> Makefile, but allow to customise it via additional options passed via >>> environment, example attached. >> >>> What do you think? >> >>> (another way would be to add $(CUSTOM_CFLAGS) at the end of CFLAGS >>> assignment). >> >> Personally I would prefer the CUSTOM_CFLAGS way. > > Same here, and it's important not to create confusion on the way > CFLAGS are computed. > > By the way, usually if I need to add some specific flags (eg #define), > I do it via DEFINE or SMALL_OPTS. If I want to change the optimization > options, I use CPU_CFLAGS or CPU_CFLAGS.<target_name>. > > So maybe you already have what you need and only the documentation needs > to be improved. >
FreeBSD ports collection has a rule for CFLAGS customisation: ports framework sets CFLAGS environment and expects it to be used during compilation. Usually people use it to specify different -On options and other optimisations they want. So strictly speaking it is not CPU-specific, but rather environment-specific. So exactly what comment near CFLAGS is about: "". Right now I see only -O2 in CPU_CFLAGS, so it can be used for that purpose. If the consensus will be to use CPU_CFLAGS for my purpose, it's OK, I will switch to it. Thanks.

