From 799edfaadf2ef0f3ab45703780b1a4226abed702 Mon Sep 17 00:00:00 2001 From: michael-grunder Date: Thu, 23 Dec 2021 11:09:58 -0800 Subject: Don't link with crypto libs if USE_SSL isn't set. --- Makefile | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9e5f024..a293c1a 100644 --- a/Makefile +++ b/Makefile @@ -91,17 +91,19 @@ ifeq ($(TEST_ASYNC),1) export CFLAGS+=-DHIREDIS_TEST_ASYNC endif -ifeq ($(uname_S),Linux) - ifdef OPENSSL_PREFIX +ifeq ($(USE_SSL),1) + ifeq ($(uname_S),Linux) + ifdef OPENSSL_PREFIX + CFLAGS+=-I$(OPENSSL_PREFIX)/include + SSL_LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto + else + SSL_LDFLAGS=-lssl -lcrypto + endif + else + OPENSSL_PREFIX?=/usr/local/opt/openssl CFLAGS+=-I$(OPENSSL_PREFIX)/include SSL_LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto - else - SSL_LDFLAGS=-lssl -lcrypto endif -else - OPENSSL_PREFIX?=/usr/local/opt/openssl - CFLAGS+=-I$(OPENSSL_PREFIX)/include - SSL_LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto endif ifeq ($(uname_S),FreeBSD) @@ -231,7 +233,10 @@ hiredis-example-push: examples/example-push.c $(STLIBNAME) examples: $(EXAMPLES) TEST_LIBS = $(STLIBNAME) $(SSL_STLIB) -TEST_LDFLAGS = $(SSL_LDFLAGS) -lssl -lcrypto -lpthread +TEST_LDFLAGS = $(SSL_LDFLAGS) +ifeq ($(USE_SSL),1) + TEST_LDFLAGS += -pthread +endif ifeq ($(TEST_ASYNC),1) TEST_LDFLAGS += -levent endif -- cgit v1.2.3