]> git.saurik.com Git - redis.git/blob - Makefile
non-blocking VM data structures, just a start
[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 PTLINK?= -lpthread
10 else
11 CFLAGS?= -std=c99 -pedantic -O2 -Wall -W $(ARCH) $(PROF)
12 CCLINK?= -lm
13 PTLINK?= -lpthread
14 endif
15 CCOPT= $(CFLAGS) $(CCLINK) $(ARCH) $(PROF)
16 DEBUG?= -g -rdynamic -ggdb
17
18 OBJ = adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o
19 BENCHOBJ = ae.o anet.o benchmark.o sds.o adlist.o zmalloc.o
20 CLIOBJ = anet.o sds.o adlist.o redis-cli.o zmalloc.o
21
22 PRGNAME = redis-server
23 BENCHPRGNAME = redis-benchmark
24 CLIPRGNAME = redis-cli
25
26 all: redis-server redis-benchmark redis-cli
27
28 # Deps (use make dep to generate this)
29 adlist.o: adlist.c adlist.h zmalloc.h
30 ae.o: ae.c ae.h zmalloc.h ae_select.c ae_epoll.c
31 ae_select.o: ae_select.c
32 anet.o: anet.c fmacros.h anet.h
33 benchmark.o: benchmark.c fmacros.h ae.h anet.h sds.h adlist.h zmalloc.h
34 dict.o: dict.c fmacros.h dict.h zmalloc.h
35 lzf_c.o: lzf_c.c lzfP.h
36 lzf_d.o: lzf_d.c lzfP.h
37 pqsort.o: pqsort.c
38 redis-cli.o: redis-cli.c fmacros.h anet.h sds.h adlist.h zmalloc.h
39 redis.o: redis.c fmacros.h config.h redis.h ae.h sds.h anet.h dict.h \
40 adlist.h zmalloc.h lzf.h pqsort.h staticsymbols.h
41 sds.o: sds.c sds.h zmalloc.h
42 zmalloc.o: zmalloc.c config.h
43
44 redis-server: $(OBJ)
45 $(CC) -o $(PRGNAME) $(CCOPT) $(PTLINK) $(DEBUG) $(OBJ)
46 @echo ""
47 @echo "Hint: To run the test-redis.tcl script is a good idea."
48 @echo "Launch the redis server with ./redis-server, then in another"
49 @echo "terminal window enter this directory and run 'make test'."
50 @echo ""
51
52 redis-benchmark: $(BENCHOBJ)
53 $(CC) -o $(BENCHPRGNAME) $(CCOPT) $(DEBUG) $(BENCHOBJ)
54
55 redis-cli: $(CLIOBJ)
56 $(CC) -o $(CLIPRGNAME) $(CCOPT) $(DEBUG) $(CLIOBJ)
57
58 .c.o:
59 $(CC) -c $(CFLAGS) $(DEBUG) $(COMPILE_TIME) $<
60
61 clean:
62 rm -rf $(PRGNAME) $(BENCHPRGNAME) $(CLIPRGNAME) *.o *.gcda *.gcno *.gcov
63
64 dep:
65 $(CC) -MM *.c
66
67 staticsymbols:
68 tclsh utils/build-static-symbols.tcl > staticsymbols.h
69
70 test:
71 tclsh test-redis.tcl
72
73 bench:
74 ./redis-benchmark
75
76 log:
77 git log '--pretty=format:%ad %s' --date=short > Changelog
78
79 32bit:
80 make ARCH="-arch i386"
81
82 gprof:
83 make PROF="-pg"
84
85 gcov:
86 make PROF="-fprofile-arcs -ftest-coverage"
87
88 32bitgprof:
89 make PROF="-pg" ARCH="-arch i386"