]>
Commit | Line | Data |
---|---|---|
4b8a6394 PN |
1 | # Redis dependency Makefile |
2 | ||
de07849e | 3 | uname_S:= $(shell sh -c 'uname -s 2>/dev/null || echo not') |
4b8a6394 PN |
4 | |
5 | CCCOLOR="\033[34m" | |
6 | LINKCOLOR="\033[34;1m" | |
7 | SRCCOLOR="\033[33m" | |
8 | BINCOLOR="\033[37;1m" | |
9 | MAKECOLOR="\033[32;1m" | |
10 | ENDCOLOR="\033[0m" | |
11 | ||
12 | default: | |
13 | @echo "Explicit target required" | |
14 | ||
de07849e PN |
15 | .PHONY: default |
16 | ||
17 | # Prerequisites target | |
18 | .make-prerequisites: | |
19 | @touch $@ | |
20 | ||
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 | |
4b8a6394 PN |
26 | endif |
27 | ||
de07849e PN |
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 | |
33 | endif | |
4b8a6394 PN |
34 | |
35 | distclean: | |
36 | -(cd hiredis && $(MAKE) clean) > /dev/null || true | |
9035e23d | 37 | -(cd liblmdb && $(MAKE) clean) > /dev/null || true |
4b8a6394 PN |
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 | |
de07849e PN |
41 | -(rm -f .make-*) |
42 | ||
43 | .PHONY: distclean | |
44 | ||
45 | hiredis: .make-prerequisites | |
46 | @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) | |
47 | cd hiredis && $(MAKE) static | |
48 | ||
49 | .PHONY: hiredis | |
50 | ||
9035e23d JF |
51 | liblmdb: .make-prerequisites |
52 | @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) | |
53 | cd liblmdb && $(MAKE) all | |
54 | ||
55 | .PHONY: liblmdb | |
56 | ||
de07849e PN |
57 | linenoise: .make-prerequisites |
58 | @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) | |
59 | cd linenoise && $(MAKE) | |
60 | ||
61 | .PHONY: linenoise | |
62 | ||
63 | ifeq ($(uname_S),SunOS) | |
64 | # Make isinf() available | |
65 | LUA_CFLAGS= -D__C99FEATURES__=1 | |
66 | endif | |
67 | ||
68 | LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI $(CFLAGS) | |
69 | LUA_LDFLAGS+= $(LDFLAGS) | |
4b8a6394 | 70 | |
de07849e PN |
71 | lua: .make-prerequisites |
72 | @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) | |
73 | cd lua/src && $(MAKE) all CFLAGS="$(LUA_CFLAGS)" MYLDFLAGS="$(LUA_LDFLAGS)" | |
4b8a6394 | 74 | |
de07849e | 75 | .PHONY: lua |
4b8a6394 | 76 | |
de07849e PN |
77 | JEMALLOC_CFLAGS= -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops $(CFLAGS) |
78 | JEMALLOC_LDFLAGS= $(LDFLAGS) | |
4b8a6394 | 79 | |
de07849e PN |
80 | jemalloc: .make-prerequisites |
81 | @printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) | |
82 | cd jemalloc && ./configure --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" | |
4917a6a8 | 83 | cd jemalloc && $(MAKE) CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" lib/libjemalloc.a |
4b8a6394 | 84 | |
de07849e | 85 | .PHONY: jemalloc |