]> git.saurik.com Git - redis.git/blob - Makefile
version marked 1.3.2
[redis.git] / Makefile
1 # Redis Makefile
2 # Copyright (C) 2009 Salvatore Sanfilippo <antirez at gmail dot com>
3 # This file is released under the BSD license, see the COPYING file
4
5 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
6 ifeq ($(uname_S),SunOS)
7 CFLAGS?= -std=c99 -pedantic -O2 -Wall -W -D__EXTENSIONS__ -D_XPG6
8 CCLINK?= -ldl -lnsl -lsocket -lm
9 else
10 CFLAGS?= -std=c99 -pedantic -O2 -Wall -W $(ARCH) $(PROF)
11 CCLINK?= -lm
12 endif
13 CCOPT= $(CFLAGS) $(CCLINK) $(ARCH) $(PROF)
14 DEBUG?= -g -rdynamic -ggdb
15
16 OBJ = adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o
17 BENCHOBJ = ae.o anet.o benchmark.o sds.o adlist.o zmalloc.o
18 CLIOBJ = anet.o sds.o adlist.o redis-cli.o zmalloc.o
19
20 PRGNAME = redis-server
21 BENCHPRGNAME = redis-benchmark
22 CLIPRGNAME = redis-cli
23
24 all: redis-server redis-benchmark redis-cli
25
26 # Deps (use make dep to generate this)
27 adlist.o: adlist.c adlist.h zmalloc.h
28 ae.o: ae.c ae.h zmalloc.h ae_select.c ae_epoll.c
29 ae_select.o: ae_select.c
30 anet.o: anet.c fmacros.h anet.h
31 benchmark.o: benchmark.c fmacros.h ae.h anet.h sds.h adlist.h zmalloc.h
32 dict.o: dict.c fmacros.h dict.h zmalloc.h
33 lzf_c.o: lzf_c.c lzfP.h
34 lzf_d.o: lzf_d.c lzfP.h
35 pqsort.o: pqsort.c
36 redis-cli.o: redis-cli.c fmacros.h anet.h sds.h adlist.h zmalloc.h
37 redis.o: redis.c fmacros.h config.h redis.h ae.h sds.h anet.h dict.h \
38 adlist.h zmalloc.h lzf.h pqsort.h staticsymbols.h
39 sds.o: sds.c sds.h zmalloc.h
40 zmalloc.o: zmalloc.c config.h
41
42 redis-server: $(OBJ)
43 $(CC) -o $(PRGNAME) $(CCOPT) $(DEBUG) $(OBJ)
44 @echo ""
45 @echo "Hint: To run the test-redis.tcl script is a good idea."
46 @echo "Launch the redis server with ./redis-server, then in another"
47 @echo "terminal window enter this directory and run 'make test'."
48 @echo ""
49
50 redis-benchmark: $(BENCHOBJ)
51 $(CC) -o $(BENCHPRGNAME) $(CCOPT) $(DEBUG) $(BENCHOBJ)
52
53 redis-cli: $(CLIOBJ)
54 $(CC) -o $(CLIPRGNAME) $(CCOPT) $(DEBUG) $(CLIOBJ)
55
56 .c.o:
57 $(CC) -c $(CFLAGS) $(DEBUG) $(COMPILE_TIME) $<
58
59 clean:
60 rm -rf $(PRGNAME) $(BENCHPRGNAME) $(CLIPRGNAME) *.o *.gcda *.gcno *.gcov
61
62 dep:
63 $(CC) -MM *.c
64
65 staticsymbols:
66 tclsh utils/build-static-symbols.tcl > staticsymbols.h
67
68 test:
69 tclsh test-redis.tcl
70
71 bench:
72 ./redis-benchmark
73
74 log:
75 git log '--pretty=format:%ad %s' --date=short > Changelog
76
77 32bit:
78 make ARCH="-arch i386"
79
80 gprof:
81 make PROF="-pg"
82
83 gcov:
84 make PROF="-fprofile-arcs -ftest-coverage"
85
86 32bitgprof:
87 make PROF="-pg" ARCH="-arch i386"