Makefile respect user's SERVER_CFLAGS and OPT (#55)

Makefile respect user's SERVER_CFLAGS and OPT.

This was unintentionally modified by
38632278fd (diff-3e2513390df543315686d7c85bd901ca9256268970032298815d2f893a9f0685).

Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
This commit is contained in:
Roshan Khatri 2024-03-27 15:19:04 -07:00 committed by GitHub
parent 11ddd8b289
commit c7df0f06e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,17 +16,20 @@ release_hdr := $(shell sh -c './mkreleasehdr.sh')
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
CLANG := $(findstring clang,$(shell sh -c '$(CC) --version | head -1'))
# Optimization flags. To override, the OPTIMIZATION variable can be passed, but
# some automatic defaults are added to it. To specify optimization flags
# explicitly without any defaults added, pass the OPT variable instead.
OPTIMIZATION?=-O3
ifeq ($(OPTIMIZATION),-O3)
ifeq (clang,$(CLANG))
SERVER_CFLAGS+=-flto
OPTIMIZATION+=-flto
else
SERVER_CFLAGS+=-flto=auto
OPTIMIZATION+=-flto=auto
endif
SERVER_LDFLAGS+=-O3 -flto
endif
ifneq ($(OPTIMIZATION),-O0)
SERVER_CFLAGS+=-fno-omit-frame-pointer
OPTIMIZATION+=-fno-omit-frame-pointer
endif
DEPENDENCY_TARGETS=hiredis linenoise lua hdr_histogram fpconv
NODEPS:=clean distclean
@ -120,7 +123,7 @@ endif
-include .make-settings
FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(SERVER_CFLAGS)
FINAL_LDFLAGS=$(LDFLAGS) $(SERVER_LDFLAGS) $(DEBUG)
FINAL_LDFLAGS=$(LDFLAGS) $(OPT) $(SERVER_LDFLAGS) $(DEBUG)
FINAL_LIBS=-lm
DEBUG=-g -ggdb