Makefile 6.0 KB
Newer Older
A
antirez 已提交
1 2 3 4
# Redis Makefile
# Copyright (C) 2009 Salvatore Sanfilippo <antirez at gmail dot com>
# This file is released under the BSD license, see the COPYING file

5
release_hdr := $(shell sh -c './mkreleasehdr.sh')
6
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
7
OPTIMIZATION?=-O2
8
ifeq ($(uname_S),SunOS)
9
  CFLAGS?= -std=c99 -pedantic $(OPTIMIZATION) -Wall -W -D__EXTENSIONS__ -D_XPG6
10
  CCLINK?= -ldl -lnsl -lsocket -lm -lpthread
11
else
12
  CFLAGS?= -std=c99 -pedantic $(OPTIMIZATION) -Wall -W $(ARCH) $(PROF)
13
  CCLINK?= -lm -pthread
14
endif
15
CCOPT= $(CFLAGS) $(CCLINK) $(ARCH) $(PROF)
H
hrothgar 已提交
16
DEBUG?= -g -rdynamic -ggdb 
A
antirez 已提交
17

18
PREFIX= /usr/local
A
antirez 已提交
19 20 21
INSTALL_BIN= $(INSTALL_TOP)/bin
INSTALL= cp -p

22
OBJ = adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o vm.o pubsub.o multi.o debug.o sort.o intset.o
23
BENCHOBJ = ae.o anet.o redis-benchmark.o sds.o adlist.o zmalloc.o
24
CLIOBJ = anet.o sds.o adlist.o redis-cli.o zmalloc.o linenoise.o
25
CHECKDUMPOBJ = redis-check-dump.o lzf_c.o lzf_d.o
P
Pieter Noordhuis 已提交
26
CHECKAOFOBJ = redis-check-aof.o
A
antirez 已提交
27 28 29 30

PRGNAME = redis-server
BENCHPRGNAME = redis-benchmark
CLIPRGNAME = redis-cli
31
CHECKDUMPPRGNAME = redis-check-dump
P
Pieter Noordhuis 已提交
32
CHECKAOFPRGNAME = redis-check-aof
A
antirez 已提交
33

P
Pieter Noordhuis 已提交
34
all: redis-server redis-benchmark redis-cli redis-check-dump redis-check-aof
A
antirez 已提交
35

A
antirez 已提交
36

A
antirez 已提交
37
# Deps (use make dep to generate this)
A
antirez 已提交
38
adlist.o: adlist.c adlist.h zmalloc.h
39 40 41
ae.o: ae.c ae.h zmalloc.h config.h ae_kqueue.c
ae_epoll.o: ae_epoll.c
ae_kqueue.o: ae_kqueue.c
42
ae_select.o: ae_select.c
A
antirez 已提交
43
anet.o: anet.c fmacros.h anet.h
A
antirez 已提交
44 45 46 47 48 49 50 51
aof.o: aof.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
config.o: config.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
db.o: db.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
debug.o: debug.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h sha1.h
A
antirez 已提交
52
dict.o: dict.c fmacros.h dict.h zmalloc.h
A
antirez 已提交
53
intset.o: intset.c intset.h zmalloc.h
A
antirez 已提交
54
linenoise.o: linenoise.c fmacros.h
A
antirez 已提交
55 56
lzf_c.o: lzf_c.c lzfP.h
lzf_d.o: lzf_d.c lzfP.h
A
antirez 已提交
57 58 59 60 61 62
multi.o: multi.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
networking.o: networking.c redis.h fmacros.h config.h ae.h sds.h dict.h \
  adlist.h zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
object.o: object.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
A
antirez 已提交
63
pqsort.o: pqsort.c
A
antirez 已提交
64 65 66 67
pubsub.o: pubsub.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
rdb.o: rdb.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h lzf.h
68 69
redis-benchmark.o: redis-benchmark.c fmacros.h ae.h anet.h sds.h adlist.h \
  zmalloc.h
A
antirez 已提交
70
redis-check-aof.o: redis-check-aof.c fmacros.h config.h
71
redis-check-dump.o: redis-check-dump.c lzf.h
A
antirez 已提交
72 73 74 75
redis-cli.o: redis-cli.c fmacros.h version.h anet.h sds.h adlist.h \
  zmalloc.h linenoise.h
redis.o: redis.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
76
release.o: release.c release.h
A
antirez 已提交
77 78
replication.o: replication.c redis.h fmacros.h config.h ae.h sds.h dict.h \
  adlist.h zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
A
antirez 已提交
79
sds.o: sds.c sds.h zmalloc.h
80
sha1.o: sha1.c sha1.h
A
antirez 已提交
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
sort.o: sort.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h pqsort.h
t_hash.o: t_hash.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
t_list.o: t_list.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
t_set.o: t_set.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
t_string.o: t_string.c redis.h fmacros.h config.h ae.h sds.h dict.h \
  adlist.h zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
t_zset.o: t_zset.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
util.o: util.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
vm.o: vm.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
  zmalloc.h anet.h zipmap.h ziplist.h intset.h version.h
97
ziplist.o: ziplist.c zmalloc.h ziplist.h
98
zipmap.o: zipmap.c zmalloc.h
A
antirez 已提交
99
zmalloc.o: zmalloc.c config.h
A
antirez 已提交
100

101
redis-server: $(OBJ)
102
	$(CC) -o $(PRGNAME) $(CCOPT) $(DEBUG) $(OBJ)
A
antirez 已提交
103
	@echo ""
104
	@echo "Hint: To run 'make test' is a good idea ;)"
A
antirez 已提交
105 106 107 108 109 110 111 112
	@echo ""

redis-benchmark: $(BENCHOBJ)
	$(CC) -o $(BENCHPRGNAME) $(CCOPT) $(DEBUG) $(BENCHOBJ)

redis-cli: $(CLIOBJ)
	$(CC) -o $(CLIPRGNAME) $(CCOPT) $(DEBUG) $(CLIOBJ)

113 114 115
redis-check-dump: $(CHECKDUMPOBJ)
	$(CC) -o $(CHECKDUMPPRGNAME) $(CCOPT) $(DEBUG) $(CHECKDUMPOBJ)

P
Pieter Noordhuis 已提交
116 117 118
redis-check-aof: $(CHECKAOFOBJ)
	$(CC) -o $(CHECKAOFPRGNAME) $(CCOPT) $(DEBUG) $(CHECKAOFOBJ)

A
antirez 已提交
119
.c.o:
120
	$(CC) -c $(CFLAGS) $(DEBUG) $(COMPILE_TIME) $<
A
antirez 已提交
121 122

clean:
P
Pieter Noordhuis 已提交
123
	rm -rf $(PRGNAME) $(BENCHPRGNAME) $(CLIPRGNAME) $(CHECKDUMPPRGNAME) $(CHECKAOFPRGNAME) *.o *.gcda *.gcno *.gcov
A
antirez 已提交
124 125 126 127

dep:
	$(CC) -MM *.c

128
test:
129
	(cd ..; tclsh8.5 tests/test_helper.tcl --tags "${TAGS}")
A
antirez 已提交
130 131 132

bench:
	./redis-benchmark
A
antirez 已提交
133 134

log:
A
antirez 已提交
135
	git log '--pretty=format:%ad %s (%cn)' --date=short > ../Changelog
136 137

32bit:
138 139 140 141
	@echo ""
	@echo "WARNING: if it fails under Linux you probably need to install libc6-dev-i386"
	@echo ""
	make ARCH="-m32"
142 143 144 145

gprof:
	make PROF="-pg"

146 147 148
gcov:
	make PROF="-fprofile-arcs -ftest-coverage"

149 150 151
noopt:
	make OPTIMIZATION=""

152 153
32bitgprof:
	make PROF="-pg" ARCH="-arch i386"
A
antirez 已提交
154 155 156 157 158 159 160

install: all
	$(INSTALL) $(PRGNAME) $(INSTALL_BIN)
	$(INSTALL) $(BENCHPRGNAME) $(INSTALL_BIN)
	$(INSTALL) $(CLIPRGNAME) $(INSTALL_BIN)
	$(INSTALL) $(CHECKDUMPPRGNAME) $(INSTALL_BIN)
	$(INSTALL) $(CHECKAOFPRGNAME) $(INSTALL_BIN)