From 924e85eac33c6301503029c795ea13ab2f0f6ad3 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 280d63097..e6d72f902 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 @@ -70,7 +70,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 @@ -116,6 +116,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) $(SERVER_LDFLAGS) $(DEBUG) FINAL_LIBS=-lm