From 3ab066f71002de28025a7b28af4e90310294e40e Mon Sep 17 00:00:00 2001 From: Roshan Khatri <117414976+roshkhatri@users.noreply.github.com> Date: Sat, 30 Mar 2024 07:42:00 -0700 Subject: [PATCH] For additional compatibility this adds REDIS_CFLAGS and REDIS_LDFLAGS support to MAKEFILE (#66) This resolves (1.viii) from https://github.com/valkey-io/valkey/issues/43 > REDIS_FLAGS will be updated to SERVER_FLAGS. Maybe we should also allow REDIS_FLAGS -> SERVER_FLAGS as well, for an extra layer of compatibility. --------- Signed-off-by: Roshan Khatri --- src/Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index f762e2912..e8d6fcca3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,12 +1,12 @@ -# Redis Makefile +# Valkey Makefile # Copyright (C) 2009 Salvatore Sanfilippo # This file is released under the BSD license, see the COPYING file # # The Makefile composes the final FINAL_CFLAGS and FINAL_LDFLAGS using -# what is needed for Redis plus the standard CFLAGS and LDFLAGS passed. +# what is needed for Valkey plus the standard CFLAGS and LDFLAGS passed. # However when building the dependencies (Jemalloc, Lua, Hiredis, ...) # CFLAGS and LDFLAGS are propagated to the dependencies, so to pass -# flags only to be used when compiling / linking Redis itself SERVER_CFLAGS +# flags only to be used when compiling / linking Valkey itself SERVER_CFLAGS # and SERVER_LDFLAGS are used instead (this is the case of 'make gcov'). # # Dependencies are stored in the Makefile.dep file. To rebuild this file @@ -76,7 +76,7 @@ ifeq ($(uname_S),Linux) MALLOC=jemalloc endif -# To get ARM stack traces if Redis crashes we need a special C flag. +# To get ARM stack traces if Valkey crashes we need a special C flag. ifneq (,$(filter aarch64 armv%,$(uname_M))) CFLAGS+=-funwind-tables endif @@ -122,6 +122,14 @@ endif # Override default settings if possible -include .make-settings +# For added compatibility REDIS_CFLAGS and REDIS_LDFLAGS are also supported. +ifdef REDIS_CFLAGS + SERVER_CFLAGS := $(REDIS_CFLAGS) +endif +ifdef REDIS_LDFLAGS + SERVER_LDFLAGS := $(REDIS_LDFLAGS) +endif + FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(SERVER_CFLAGS) FINAL_LDFLAGS=$(LDFLAGS) $(OPT) $(SERVER_LDFLAGS) $(DEBUG) FINAL_LIBS=-lm