1# Redis dependency Makefile 2 3UNAME_S:=$(shell sh -c 'uname -s 2> /dev/null || echo not') 4 5LUA_CFLAGS=-O2 -Wall $(ARCH) 6ifeq ($(UNAME_S),SunOS) 7 # Make isinf() available 8 LUA_CFLAGS+= -D__C99FEATURES__=1 9endif 10 11JEMALLOC_CFLAGS= 12ifeq ($(ARCH),-m32) 13 JEMALLOC_CFLAGS+=CFLAGS="-std=gnu99 -Wall -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -m32" 14endif 15 16CCCOLOR="\033[34m" 17LINKCOLOR="\033[34;1m" 18SRCCOLOR="\033[33m" 19BINCOLOR="\033[37;1m" 20MAKECOLOR="\033[32;1m" 21ENDCOLOR="\033[0m" 22 23default: 24 @echo "Explicit target required" 25 26# Clean everything when ARCH is different 27ifneq ($(shell sh -c '[ -f .make-arch ] && cat .make-arch'), $(ARCH)) 28.make-arch: distclean 29else 30.make-arch: 31endif 32 33.make-arch: 34 -(echo $(ARCH) > .make-arch) 35 36distclean: 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 41 -(rm -f .make-arch) 42 43hiredis: .make-arch 44 @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)hiredis$(ENDCOLOR) 45 cd hiredis && $(MAKE) static ARCH="$(ARCH)" 46 47linenoise: .make-arch 48 @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)linenoise$(ENDCOLOR) 49 cd linenoise && $(MAKE) ARCH="$(ARCH)" 50 51lua: .make-arch 52 @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)lua$(ENDCOLOR) 53 cd lua && $(MAKE) CFLAGS="$(LUA_CFLAGS)" MYLDFLAGS="$(ARCH)" ansi 54 55jemalloc: .make-arch 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 58 59.PHONY: default conditional_clean hiredis linenoise lua jemalloc 60