2011-11-15 20:40:49 +00:00
|
|
|
# Redis dependency Makefile
|
|
|
|
|
2012-03-25 02:25:03 +00:00
|
|
|
uname_S:= $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
2011-11-15 20:40:49 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
|
2012-03-25 02:25:03 +00:00
|
|
|
.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
|
2011-11-15 20:40:49 +00:00
|
|
|
endif
|
|
|
|
|
2012-03-25 02:25:03 +00:00
|
|
|
# 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
|
2011-11-15 20:40:49 +00:00
|
|
|
|
|
|
|
distclean:
|
|
|
|
-(cd hiredis && $(MAKE) clean) > /dev/null || true
|
|
|
|
-(cd linenoise && $(MAKE) clean) > /dev/null || true
|
|
|
|
-(cd lua && $(MAKE) clean) > /dev/null || true
|
|
|
|
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
|
2020-08-25 18:21:29 +00:00
|
|
|
-(cd hdr_histogram && $(MAKE) clean) > /dev/null || true
|
2012-03-25 02:25:03 +00:00
|
|
|
-(rm -f .make-*)
|
|
|
|
|
|
|
|
.PHONY: distclean
|
|
|
|
|
2019-09-12 07:56:54 +00:00
|
|
|
ifeq ($(BUILD_TLS),yes)
|
|
|
|
HIREDIS_MAKE_FLAGS = USE_SSL=1
|
|
|
|
endif
|
|
|
|
|
2012-03-25 02:25:03 +00:00
|
|
|
hiredis: .make-prerequisites
|
|
|
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
2019-09-12 07:56:54 +00:00
|
|
|
cd hiredis && $(MAKE) static $(HIREDIS_MAKE_FLAGS)
|
2012-03-25 02:25:03 +00:00
|
|
|
|
|
|
|
.PHONY: hiredis
|
|
|
|
|
|
|
|
linenoise: .make-prerequisites
|
|
|
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
|
|
|
cd linenoise && $(MAKE)
|
|
|
|
|
|
|
|
.PHONY: linenoise
|
|
|
|
|
2020-08-25 18:21:29 +00:00
|
|
|
hdr_histogram: .make-prerequisites
|
|
|
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
|
|
|
cd hdr_histogram && $(MAKE)
|
|
|
|
|
|
|
|
.PHONY: hdr_histogram
|
|
|
|
|
2012-03-25 02:25:03 +00:00
|
|
|
ifeq ($(uname_S),SunOS)
|
2013-03-16 07:35:20 +00:00
|
|
|
# Make isinf() available
|
|
|
|
LUA_CFLAGS= -D__C99FEATURES__=1
|
2012-03-25 02:25:03 +00:00
|
|
|
endif
|
|
|
|
|
2020-09-29 14:10:54 +00:00
|
|
|
LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP $(CFLAGS)
|
2012-03-25 02:25:03 +00:00
|
|
|
LUA_LDFLAGS+= $(LDFLAGS)
|
2013-03-12 01:04:40 +00:00
|
|
|
# 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
|
2020-09-29 14:10:54 +00:00
|
|
|
ARFLAGS=rc
|
2011-11-15 20:40:49 +00:00
|
|
|
|
2012-03-25 02:25:03 +00:00
|
|
|
lua: .make-prerequisites
|
|
|
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
2013-03-12 01:04:40 +00:00
|
|
|
cd lua/src && $(MAKE) all CFLAGS="$(LUA_CFLAGS)" MYLDFLAGS="$(LUA_LDFLAGS)" AR="$(AR) $(ARFLAGS)"
|
2011-11-15 20:40:49 +00:00
|
|
|
|
2012-03-25 02:25:03 +00:00
|
|
|
.PHONY: lua
|
2011-11-15 20:40:49 +00:00
|
|
|
|
2012-03-25 02:25:03 +00:00
|
|
|
JEMALLOC_CFLAGS= -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops $(CFLAGS)
|
|
|
|
JEMALLOC_LDFLAGS= $(LDFLAGS)
|
2011-11-15 20:40:49 +00:00
|
|
|
|
2012-03-25 02:25:03 +00:00
|
|
|
jemalloc: .make-prerequisites
|
|
|
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
2020-09-21 13:57:15 +00:00
|
|
|
cd jemalloc && ./configure --with-version=5.1.0-0-g0 --with-lg-quantum=3 --with-jemalloc-prefix=je_ CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)"
|
2012-11-01 14:36:37 +00:00
|
|
|
cd jemalloc && $(MAKE) CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" lib/libjemalloc.a
|
2011-11-15 20:40:49 +00:00
|
|
|
|
2012-03-25 02:25:03 +00:00
|
|
|
.PHONY: jemalloc
|