]>
Commit | Line | Data |
---|---|---|
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 | |
29 | anet.o: anet.c fmacros.h anet.h | |
30 | benchmark.o: benchmark.c fmacros.h ae.h anet.h sds.h adlist.h zmalloc.h | |
31 | dict.o: dict.c fmacros.h dict.h zmalloc.h | |
32 | lzf_c.o: lzf_c.c lzfP.h | |
33 | lzf_d.o: lzf_d.c lzfP.h | |
34 | pqsort.o: pqsort.c | |
35 | redis-cli.o: redis-cli.c fmacros.h anet.h sds.h adlist.h zmalloc.h | |
36 | redis.o: redis.c fmacros.h ae.h sds.h anet.h dict.h adlist.h zmalloc.h lzf.h pqsort.h config.h | |
37 | sds.o: sds.c sds.h zmalloc.h | |
38 | zmalloc.o: zmalloc.c config.h | |
39 | ||
40 | redis-server: $(OBJ) | |
41 | $(CC) -o $(PRGNAME) $(CCOPT) $(DEBUG) $(OBJ) | |
42 | @echo "" | |
43 | @echo "Hint: To run the test-redis.tcl script is a good idea." | |
44 | @echo "Launch the redis server with ./redis-server, then in another" | |
45 | @echo "terminal window enter this directory and run 'make test'." | |
46 | @echo "" | |
47 | ||
48 | redis-benchmark: $(BENCHOBJ) | |
49 | $(CC) -o $(BENCHPRGNAME) $(CCOPT) $(DEBUG) $(BENCHOBJ) | |
50 | ||
51 | redis-cli: $(CLIOBJ) | |
52 | $(CC) -o $(CLIPRGNAME) $(CCOPT) $(DEBUG) $(CLIOBJ) | |
53 | ||
54 | .c.o: | |
55 | $(CC) -c $(CFLAGS) $(DEBUG) $(COMPILE_TIME) $< | |
56 | ||
57 | clean: | |
58 | rm -rf $(PRGNAME) $(BENCHPRGNAME) $(CLIPRGNAME) *.o | |
59 | ||
60 | dep: | |
61 | $(CC) -MM *.c | |
62 | ||
63 | test: | |
64 | tclsh test-redis.tcl | |
65 | ||
66 | bench: | |
67 | ./redis-benchmark | |
68 | ||
69 | log: | |
70 | git log '--pretty=format:%ad %s' --date=short > Changelog | |
71 | ||
72 | 32bit: | |
73 | make ARCH="-arch i386" | |
74 | ||
75 | gprof: | |
76 | make PROF="-pg" | |
77 | ||
78 | 32bitgprof: | |
79 | make PROF="-pg" ARCH="-arch i386" |