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