]>
Commit | Line | Data |
---|---|---|
ed9b544e | 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 | ||
325d1eb4 | 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 | |
a7866db6 | 8 | CCLINK?= -ldl -lnsl -lsocket -lm |
92f8e882 | 9 | PTLINK?= -lpthread |
325d1eb4 | 10 | else |
d0ccebcf | 11 | CFLAGS?= -std=c99 -pedantic -O2 -Wall -W $(ARCH) $(PROF) |
a7866db6 | 12 | CCLINK?= -lm |
92f8e882 | 13 | PTLINK?= -lpthread |
325d1eb4 | 14 | endif |
d0ccebcf | 15 | CCOPT= $(CFLAGS) $(CCLINK) $(ARCH) $(PROF) |
01fe7151 | 16 | DEBUG?= -g -rdynamic -ggdb |
ed9b544e | 17 | |
5f5b9840 | 18 | OBJ = adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o |
ed9b544e | 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) | |
9e9c0ce1 | 29 | adlist.o: adlist.c adlist.h zmalloc.h |
64f36a58 | 30 | ae.o: ae.c ae.h zmalloc.h ae_select.c ae_epoll.c |
266373b2 | 31 | ae_select.o: ae_select.c |
9e9c0ce1 | 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 | |
266373b2 | 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 | |
9e9c0ce1 | 41 | sds.o: sds.c sds.h zmalloc.h |
42 | zmalloc.o: zmalloc.c config.h | |
ed9b544e | 43 | |
44 | redis-server: $(OBJ) | |
92f8e882 | 45 | $(CC) -o $(PRGNAME) $(CCOPT) $(PTLINK) $(DEBUG) $(OBJ) |
ed9b544e | 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: | |
325d1eb4 | 59 | $(CC) -c $(CFLAGS) $(DEBUG) $(COMPILE_TIME) $< |
ed9b544e | 60 | |
61 | clean: | |
fc77604c | 62 | rm -rf $(PRGNAME) $(BENCHPRGNAME) $(CLIPRGNAME) *.o *.gcda *.gcno *.gcov |
ed9b544e | 63 | |
64 | dep: | |
65 | $(CC) -MM *.c | |
66 | ||
bcfc686d | 67 | staticsymbols: |
68 | tclsh utils/build-static-symbols.tcl > staticsymbols.h | |
69 | ||
ed9b544e | 70 | test: |
71 | tclsh test-redis.tcl | |
72 | ||
73 | bench: | |
74 | ./redis-benchmark | |
378fd421 | 75 | |
76 | log: | |
77 | git log '--pretty=format:%ad %s' --date=short > Changelog | |
fd8ccf44 | 78 | |
79 | 32bit: | |
80 | make ARCH="-arch i386" | |
d0ccebcf | 81 | |
82 | gprof: | |
83 | make PROF="-pg" | |
84 | ||
fc77604c | 85 | gcov: |
86 | make PROF="-fprofile-arcs -ftest-coverage" | |
87 | ||
d0ccebcf | 88 | 32bitgprof: |
89 | make PROF="-pg" ARCH="-arch i386" |