2 # Copyright (C) 2009 Salvatore Sanfilippo <antirez at gmail dot com>
3 # This file is released under the BSD license, see the COPYING file
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
11 CFLAGS?= -std=c99 -pedantic -O2 -Wall -W $(ARCH) $(PROF)
15 CCOPT= $(CFLAGS) $(CCLINK) $(ARCH) $(PROF)
16 DEBUG?= -g -rdynamic -ggdb
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
22 PRGNAME = redis-server
23 BENCHPRGNAME = redis-benchmark
24 CLIPRGNAME = redis-cli
26 all: redis-server redis-benchmark redis-cli
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
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
45 $(CC) -o $(PRGNAME) $(CCOPT) $(PTLINK) $(DEBUG) $(OBJ)
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'."
52 redis-benchmark: $(BENCHOBJ)
53 $(CC) -o $(BENCHPRGNAME) $(CCOPT) $(DEBUG) $(BENCHOBJ)
56 $(CC) -o $(CLIPRGNAME) $(CCOPT) $(DEBUG) $(CLIOBJ)
59 $(CC) -c $(CFLAGS) $(DEBUG) $(COMPILE_TIME) $<
62 rm -rf $(PRGNAME) $(BENCHPRGNAME) $(CLIPRGNAME) *.o *.gcda *.gcno *.gcov
68 tclsh utils/build-static-symbols.tcl > staticsymbols.h
77 git log '--pretty=format:%ad %s' --date=short > Changelog
80 make ARCH="-arch i386"
86 make PROF="-fprofile-arcs -ftest-coverage"
89 make PROF="-pg" ARCH="-arch i386"