1 # Redis dependency Makefile
3 uname_S:= $(shell sh -c 'uname -s 2>/dev/null || echo not')
13 @echo "Explicit target required"
17 # Prerequisites target
21 # Clean everything when CFLAGS is different
22 ifneq ($(shell sh -c '[ -f .make-cflags ] && cat .make-cflags || echo none'), $(CFLAGS))
23 .make-cflags: distclean
24 -(echo "$(CFLAGS)" > .make-cflags)
25 .make-prerequisites: .make-cflags
28 # Clean everything when LDFLAGS is different
29 ifneq ($(shell sh -c '[ -f .make-ldflags ] && cat .make-ldflags || echo none'), $(LDFLAGS))
30 .make-ldflags: distclean
31 -(echo "$(LDFLAGS)" > .make-ldflags)
32 .make-prerequisites: .make-ldflags
36 -(cd hiredis && $(MAKE) clean) > /dev/null || true
37 -(cd linenoise && $(MAKE) clean) > /dev/null || true
38 -(cd lua && $(MAKE) clean) > /dev/null || true
39 -(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
44 hiredis: .make-prerequisites
45 @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
46 cd hiredis && $(MAKE) static
50 linenoise: .make-prerequisites
51 @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
52 cd linenoise && $(MAKE)
56 ifeq ($(uname_S),SunOS)
57 # Make isinf() available
58 LUA_CFLAGS= -D__C99FEATURES__=1
61 LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI $(CFLAGS)
62 LUA_LDFLAGS+= $(LDFLAGS)
64 lua: .make-prerequisites
65 @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
66 cd lua/src && $(MAKE) all CFLAGS="$(LUA_CFLAGS)" MYLDFLAGS="$(LUA_LDFLAGS)"
70 JEMALLOC_CFLAGS= -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops $(CFLAGS)
71 JEMALLOC_LDFLAGS= $(LDFLAGS)
73 jemalloc: .make-prerequisites
74 @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
75 cd jemalloc && ./configure --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)"
76 cd jemalloc && $(MAKE) CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" lib/libjemalloc.a