
Add a new USE_SYSTEM_HIREDIS make variable to select whether to link against the system libhiredis (and libhiredis_ssl if BUILD_TLS is enabled). Move the sdscompat.h header from the vendored hiredis directory to src/, as this file is not and has never been part of the upstream hiredis project, it got added in commit bffbbeaa9a1a6b8e81384297272cb0631502e8fd in redis itself.
118 lines
3.3 KiB
Makefile
118 lines
3.3 KiB
Makefile
# Redis dependency Makefile
|
|
|
|
uname_S:= $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
|
uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
|
|
|
|
CCCOLOR="\033[34m"
|
|
LINKCOLOR="\033[34;1m"
|
|
SRCCOLOR="\033[33m"
|
|
BINCOLOR="\033[37;1m"
|
|
MAKECOLOR="\033[32;1m"
|
|
ENDCOLOR="\033[0m"
|
|
|
|
default:
|
|
@echo "Explicit target required"
|
|
|
|
.PHONY: default
|
|
|
|
# Prerequisites target
|
|
.make-prerequisites:
|
|
@touch $@
|
|
|
|
# Clean everything when CFLAGS is different
|
|
ifneq ($(shell sh -c '[ -f .make-cflags ] && cat .make-cflags || echo none'), $(CFLAGS))
|
|
.make-cflags: distclean
|
|
-(echo "$(CFLAGS)" > .make-cflags)
|
|
.make-prerequisites: .make-cflags
|
|
endif
|
|
|
|
# Clean everything when LDFLAGS is different
|
|
ifneq ($(shell sh -c '[ -f .make-ldflags ] && cat .make-ldflags || echo none'), $(LDFLAGS))
|
|
.make-ldflags: distclean
|
|
-(echo "$(LDFLAGS)" > .make-ldflags)
|
|
.make-prerequisites: .make-ldflags
|
|
endif
|
|
|
|
distclean:
|
|
ifneq ($(USE_SYSTEM_HIREDIS),yes)
|
|
-(cd hiredis && $(MAKE) clean) > /dev/null || true
|
|
endif
|
|
-(cd linenoise && $(MAKE) clean) > /dev/null || true
|
|
-(cd lua && $(MAKE) clean) > /dev/null || true
|
|
ifneq ($(USE_SYSTEM_JEMALLOC),yes)
|
|
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
|
|
endif
|
|
ifneq ($(USE_SYSTEM_ROCKSDB),yes)
|
|
-(cd rocksdb && $(MAKE) clean) > /dev/null || true
|
|
endif
|
|
-(cd hdr_histogram && $(MAKE) clean) > /dev/null || true
|
|
-(rm -f .make-*)
|
|
|
|
.PHONY: distclean
|
|
|
|
ifeq ($(BUILD_TLS),yes)
|
|
HIREDIS_MAKE_FLAGS = USE_SSL=1
|
|
endif
|
|
|
|
hiredis: .make-prerequisites
|
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
|
cd hiredis && $(MAKE) static $(HIREDIS_MAKE_FLAGS)
|
|
|
|
.PHONY: hiredis
|
|
|
|
linenoise: .make-prerequisites
|
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
|
cd linenoise && $(MAKE)
|
|
|
|
.PHONY: linenoise
|
|
|
|
.PHONY: memkind
|
|
memkind:
|
|
cd memkind && $(MAKE)
|
|
|
|
|
|
hdr_histogram: .make-prerequisites
|
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
|
cd hdr_histogram && $(MAKE)
|
|
|
|
.PHONY: hdr_histogram
|
|
|
|
ifeq ($(uname_S),SunOS)
|
|
# Make isinf() available
|
|
LUA_CFLAGS= -D__C99FEATURES__=1
|
|
endif
|
|
|
|
LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP $(CFLAGS)
|
|
LUA_LDFLAGS+= $(LDFLAGS)
|
|
# lua's Makefile defines AR="ar rcu", which is unusual, and makes it more
|
|
# challenging to cross-compile lua (and redis). These defines make it easier
|
|
# to fit redis into cross-compilation environments, which typically set AR.
|
|
AR=ar
|
|
ARFLAGS=rc
|
|
|
|
lua: .make-prerequisites
|
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
|
cd lua/src && $(MAKE) all CFLAGS="$(LUA_CFLAGS)" MYLDFLAGS="$(LUA_LDFLAGS)" AR="$(AR) $(ARFLAGS)"
|
|
|
|
.PHONY: lua
|
|
|
|
JEMALLOC_CFLAGS= -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops $(CFLAGS)
|
|
JEMALLOC_LDFLAGS= $(LDFLAGS)
|
|
|
|
jemalloc: .make-prerequisites
|
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
|
cd jemalloc && ./configure --with-version=5.2.1-0-g0 --with-lg-quantum=3 --disable-cxx CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)"
|
|
cd jemalloc && $(MAKE) CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" lib/libjemalloc.a
|
|
|
|
.PHONY: jemalloc
|
|
|
|
rocksdb: .make-prerequisites
|
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
|
ifeq ($(uname_M),x86_64)
|
|
cd rocksdb && CFLAGS=-Wno-error PORTABLE=1 USE_SSE=1 FORCE_SSE42=1 $(MAKE) static_lib
|
|
else
|
|
cd rocksdb && PORTABLE=1 $(MAKE) static_lib
|
|
endif
|
|
|
|
.PHONY: rocksdb
|