1 # Redis dependency Makefile
3 UNAME_S:=$(shell sh -c 'uname -s 2> /dev/null || echo not')
5 LUA_CFLAGS=-O2 -Wall $(ARCH)
6 ifeq ($(UNAME_S),SunOS)
7 # Make isinf() available
8 LUA_CFLAGS+= -D__C99FEATURES__=1
13 JEMALLOC_CFLAGS+=CFLAGS="-std=gnu99 -Wall -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -m32"
17 LINKCOLOR="\033[34;1m"
20 MAKECOLOR="\033[32;1m"
24 @echo "Explicit target required"
26 # Clean everything when ARCH is different
27 ifneq ($(shell sh -c '[ -f .make-arch ] && cat .make-arch'), $(ARCH))
34 -(echo $(ARCH) > .make-arch)
37 -(cd hiredis && $(MAKE) clean) > /dev/null || true
38 -(cd linenoise && $(MAKE) clean) > /dev/null || true
39 -(cd lua && $(MAKE) clean) > /dev/null || true
40 -(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
44 @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)hiredis$(ENDCOLOR)
45 cd hiredis && $(MAKE) static ARCH="$(ARCH)"
48 @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)linenoise$(ENDCOLOR)
49 cd linenoise && $(MAKE) ARCH="$(ARCH)"
52 @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)lua$(ENDCOLOR)
53 cd lua && $(MAKE) CFLAGS="$(LUA_CFLAGS)" MYLDFLAGS="$(ARCH)" ansi
56 @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)jemalloc$(ENDCOLOR)
57 cd jemalloc && ./configure $(JEMALLOC_CFLAGS) --with-jemalloc-prefix=je_ --enable-cc-silence && $(MAKE) lib/libjemalloc.a
59 .PHONY: default conditional_clean hiredis linenoise lua jemalloc