Clean up Makefiles
Remove unused variables. Instead of overriding non-standard variables such as ARCH and PROF, use standard variables CFLAGS and LDFLAGS to override Makefile settings. Move dependencies generated by `make dep` to a separate file.
This commit is contained in:
parent
a86a8fdcfe
commit
b866abc78e
85
deps/Makefile
vendored
85
deps/Makefile
vendored
@ -1,17 +1,6 @@
|
|||||||
# Redis dependency Makefile
|
# Redis dependency Makefile
|
||||||
|
|
||||||
UNAME_S:=$(shell sh -c 'uname -s 2> /dev/null || echo not')
|
uname_S:= $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
||||||
|
|
||||||
LUA_CFLAGS=-O2 -Wall $(ARCH)
|
|
||||||
ifeq ($(UNAME_S),SunOS)
|
|
||||||
# Make isinf() available
|
|
||||||
LUA_CFLAGS+= -D__C99FEATURES__=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
JEMALLOC_CFLAGS=
|
|
||||||
ifeq ($(ARCH),-m32)
|
|
||||||
JEMALLOC_CFLAGS+=CFLAGS="-std=gnu99 -Wall -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -m32"
|
|
||||||
endif
|
|
||||||
|
|
||||||
CCCOLOR="\033[34m"
|
CCCOLOR="\033[34m"
|
||||||
LINKCOLOR="\033[34;1m"
|
LINKCOLOR="\033[34;1m"
|
||||||
@ -23,37 +12,67 @@ ENDCOLOR="\033[0m"
|
|||||||
default:
|
default:
|
||||||
@echo "Explicit target required"
|
@echo "Explicit target required"
|
||||||
|
|
||||||
# Clean everything when ARCH is different
|
.PHONY: default
|
||||||
ifneq ($(shell sh -c '[ -f .make-arch ] && cat .make-arch'), $(ARCH))
|
|
||||||
.make-arch: distclean
|
# Prerequisites target
|
||||||
else
|
.make-prerequisites:
|
||||||
.make-arch:
|
@touch $@
|
||||||
|
|
||||||
|
# Clean everything when CFLAGS is different
|
||||||
|
ifneq ($(shell sh -c '[ -f .make-cflags ] && cat .make-cflags || echo none'), $(CFLAGS))
|
||||||
|
.make-cflags: distclean
|
||||||
|
-(echo "$(CFLAGS)" > .make-cflags)
|
||||||
|
.make-prerequisites: .make-cflags
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.make-arch:
|
# Clean everything when LDFLAGS is different
|
||||||
-(echo $(ARCH) > .make-arch)
|
ifneq ($(shell sh -c '[ -f .make-ldflags ] && cat .make-ldflags || echo none'), $(LDFLAGS))
|
||||||
|
.make-ldflags: distclean
|
||||||
|
-(echo "$(LDFLAGS)" > .make-ldflags)
|
||||||
|
.make-prerequisites: .make-ldflags
|
||||||
|
endif
|
||||||
|
|
||||||
distclean:
|
distclean:
|
||||||
-(cd hiredis && $(MAKE) clean) > /dev/null || true
|
-(cd hiredis && $(MAKE) clean) > /dev/null || true
|
||||||
-(cd linenoise && $(MAKE) clean) > /dev/null || true
|
-(cd linenoise && $(MAKE) clean) > /dev/null || true
|
||||||
-(cd lua && $(MAKE) clean) > /dev/null || true
|
-(cd lua && $(MAKE) clean) > /dev/null || true
|
||||||
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
|
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
|
||||||
-(rm -f .make-arch)
|
-(rm -f .make-*)
|
||||||
|
|
||||||
hiredis: .make-arch
|
.PHONY: distclean
|
||||||
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)hiredis$(ENDCOLOR)
|
|
||||||
cd hiredis && $(MAKE) static ARCH="$(ARCH)"
|
|
||||||
|
|
||||||
linenoise: .make-arch
|
hiredis: .make-prerequisites
|
||||||
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)linenoise$(ENDCOLOR)
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
||||||
cd linenoise && $(MAKE) ARCH="$(ARCH)"
|
cd hiredis && $(MAKE) static
|
||||||
|
|
||||||
lua: .make-arch
|
.PHONY: hiredis
|
||||||
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)lua$(ENDCOLOR)
|
|
||||||
cd lua && $(MAKE) CFLAGS="$(LUA_CFLAGS)" MYLDFLAGS="$(ARCH)" ansi
|
|
||||||
|
|
||||||
jemalloc: .make-arch
|
linenoise: .make-prerequisites
|
||||||
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)jemalloc$(ENDCOLOR)
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
||||||
cd jemalloc && ./configure $(JEMALLOC_CFLAGS) --with-jemalloc-prefix=je_ --enable-cc-silence && $(MAKE) lib/libjemalloc.a
|
cd linenoise && $(MAKE)
|
||||||
|
|
||||||
.PHONY: default conditional_clean hiredis linenoise lua jemalloc
|
.PHONY: linenoise
|
||||||
|
|
||||||
|
ifeq ($(uname_S),SunOS)
|
||||||
|
# Make isinf() available
|
||||||
|
LUA_CFLAGS= -D__C99FEATURES__=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI $(CFLAGS)
|
||||||
|
LUA_LDFLAGS+= $(LDFLAGS)
|
||||||
|
|
||||||
|
lua: .make-prerequisites
|
||||||
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
||||||
|
cd lua/src && $(MAKE) all CFLAGS="$(LUA_CFLAGS)" MYLDFLAGS="$(LUA_LDFLAGS)"
|
||||||
|
|
||||||
|
.PHONY: lua
|
||||||
|
|
||||||
|
JEMALLOC_CFLAGS= -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops $(CFLAGS)
|
||||||
|
JEMALLOC_LDFLAGS= $(LDFLAGS)
|
||||||
|
|
||||||
|
jemalloc: .make-prerequisites
|
||||||
|
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
||||||
|
cd jemalloc && ./configure --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)"
|
||||||
|
cd jemalloc && $(MAKE) lib/libjemalloc.a
|
||||||
|
|
||||||
|
.PHONY: jemalloc
|
||||||
|
17
deps/linenoise/Makefile
vendored
17
deps/linenoise/Makefile
vendored
@ -1,10 +1,21 @@
|
|||||||
linenoise_example: linenoise.h linenoise.c
|
STD=
|
||||||
|
WARN= -Wall
|
||||||
|
OPT= -Os
|
||||||
|
|
||||||
|
R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
|
||||||
|
R_LDFLAGS= $(LDFLAGS)
|
||||||
|
DEBUG= -g
|
||||||
|
|
||||||
|
R_CC=$(CC) $(R_CFLAGS)
|
||||||
|
R_LD=$(CC) $(R_LDFLAGS)
|
||||||
|
|
||||||
|
linenoise.o: linenoise.h linenoise.c
|
||||||
|
|
||||||
linenoise_example: linenoise.o example.o
|
linenoise_example: linenoise.o example.o
|
||||||
$(CC) $(ARCH) -Wall -W -Os -g -o linenoise_example linenoise.o example.o
|
$(R_LD) -o $@ $^
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) $(ARCH) -c -Wall -W -Os -g $<
|
$(R_CC) -c $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f linenoise_example *.o
|
rm -f linenoise_example *.o
|
||||||
|
272
src/Makefile
272
src/Makefile
@ -7,16 +7,25 @@ uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
|||||||
OPTIMIZATION?=-O2
|
OPTIMIZATION?=-O2
|
||||||
DEPENDENCY_TARGETS=hiredis linenoise lua
|
DEPENDENCY_TARGETS=hiredis linenoise lua
|
||||||
|
|
||||||
|
STD= -std=c99 -pedantic
|
||||||
|
WARN= -Wall
|
||||||
|
OPT= $(OPTIMIZATION)
|
||||||
|
|
||||||
ifeq ($(uname_S),SunOS)
|
ifeq ($(uname_S),SunOS)
|
||||||
CFLAGS?=-std=c99 -pedantic $(OPTIMIZATION) -Wall -W -D__EXTENSIONS__ -D_XPG6
|
R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) -D__EXTENSIONS__ -D_XPG6
|
||||||
CCLINK?=-ldl -lnsl -lsocket -lm -lpthread
|
R_LDFLAGS= $(LDFLAGS)
|
||||||
DEBUG?=-g -ggdb
|
R_LIBS= $(LIBS) -ldl -lnsl -lsocket -lm -lpthread
|
||||||
|
DEBUG= -g -ggdb
|
||||||
else
|
else
|
||||||
CFLAGS?=-std=c99 -pedantic $(OPTIMIZATION) -Wall -W $(ARCH) $(PROF)
|
R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
|
||||||
CCLINK?=-lm -pthread
|
R_LDFLAGS= $(LDFLAGS)
|
||||||
DEBUG?=-g -rdynamic -ggdb
|
R_LIBS= $(LIBS) -lm -pthread
|
||||||
|
DEBUG= -g -rdynamic -ggdb
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Include paths to dependencies
|
||||||
|
R_CFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src
|
||||||
|
|
||||||
# Default allocator
|
# Default allocator
|
||||||
ifeq ($(uname_S),Linux)
|
ifeq ($(uname_S),Linux)
|
||||||
MALLOC?=jemalloc
|
MALLOC?=jemalloc
|
||||||
@ -38,24 +47,23 @@ ifeq ($(USE_JEMALLOC),yes)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MALLOC),tcmalloc)
|
ifeq ($(MALLOC),tcmalloc)
|
||||||
ALLOC_LINK=-ltcmalloc
|
R_CFLAGS+= -DUSE_TCMALLOC
|
||||||
ALLOC_FLAGS=-DUSE_TCMALLOC
|
R_LIBS+= -ltcmalloc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MALLOC),tcmalloc_minimal)
|
ifeq ($(MALLOC),tcmalloc_minimal)
|
||||||
ALLOC_LINK=-ltcmalloc_minimal
|
R_CFLAGS+= -DUSE_TCMALLOC
|
||||||
ALLOC_FLAGS=-DUSE_TCMALLOC
|
R_LIBS+= -ltcmalloc_minimal
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(MALLOC),jemalloc)
|
ifeq ($(MALLOC),jemalloc)
|
||||||
ALLOC_LINK=../deps/jemalloc/lib/libjemalloc.a -ldl
|
|
||||||
ALLOC_FLAGS=-DUSE_JEMALLOC -I../deps/jemalloc/include
|
|
||||||
DEPENDENCY_TARGETS+= jemalloc
|
DEPENDENCY_TARGETS+= jemalloc
|
||||||
|
R_CFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include
|
||||||
|
R_LIBS+= ../deps/jemalloc/lib/libjemalloc.a -ldl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CCLINK+= $(ALLOC_LINK)
|
R_CC=$(QUIET_CC)$(CC) $(R_CFLAGS)
|
||||||
CFLAGS+= $(ALLOC_FLAGS)
|
R_LD=$(QUIET_LINK)$(CC) $(R_LDFLAGS)
|
||||||
CCOPT= $(CFLAGS) $(ARCH) $(PROF)
|
|
||||||
|
|
||||||
PREFIX= /usr/local
|
PREFIX= /usr/local
|
||||||
INSTALL_BIN= $(PREFIX)/bin
|
INSTALL_BIN= $(PREFIX)/bin
|
||||||
@ -69,176 +77,100 @@ MAKECOLOR="\033[32;1m"
|
|||||||
ENDCOLOR="\033[0m"
|
ENDCOLOR="\033[0m"
|
||||||
|
|
||||||
ifndef V
|
ifndef V
|
||||||
QUIET_CC = @printf ' %b %b\n' $(CCCOLOR)CC$(ENDCOLOR) $(SRCCOLOR)$@$(ENDCOLOR);
|
QUIET_CC = @printf ' %b %b\n' $(CCCOLOR)CC$(ENDCOLOR) $(SRCCOLOR)$@$(ENDCOLOR) 1>&2;
|
||||||
QUIET_LINK = @printf ' %b %b\n' $(LINKCOLOR)LINK$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR);
|
QUIET_LINK = @printf ' %b %b\n' $(LINKCOLOR)LINK$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) 1>&2;
|
||||||
endif
|
endif
|
||||||
|
|
||||||
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 pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o memtest.o crc64.o
|
R_SERVER_NAME= redis-server
|
||||||
BENCHOBJ = ae.o anet.o redis-benchmark.o sds.o adlist.o zmalloc.o
|
R_SERVER_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 pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o memtest.o crc64.o
|
||||||
CLIOBJ = anet.o sds.o adlist.o redis-cli.o zmalloc.o release.o
|
R_CLI_NAME= redis-cli
|
||||||
CHECKDUMPOBJ = redis-check-dump.o lzf_c.o lzf_d.o
|
R_CLI_OBJ= anet.o sds.o adlist.o redis-cli.o zmalloc.o release.o
|
||||||
CHECKAOFOBJ = redis-check-aof.o
|
R_BENCHMARK_NAME= redis-benchmark
|
||||||
|
R_BENCHMARK_OBJ= ae.o anet.o redis-benchmark.o sds.o adlist.o zmalloc.o redis-benchmark.o
|
||||||
|
R_CHECK_DUMP_NAME= redis-check-dump
|
||||||
|
R_CHECK_DUMP_OBJ= redis-check-dump.o lzf_c.o lzf_d.o
|
||||||
|
R_CHECK_AOF_NAME= redis-check-aof
|
||||||
|
R_CHECK_AOF_OBJ= redis-check-aof.o
|
||||||
|
|
||||||
PRGNAME = redis-server
|
all: $(R_SERVER_NAME) $(R_CLI_NAME) $(R_BENCHMARK_NAME) $(R_CHECK_DUMP_NAME) $(R_CHECK_AOF_NAME)
|
||||||
BENCHPRGNAME = redis-benchmark
|
|
||||||
CLIPRGNAME = redis-cli
|
|
||||||
CHECKDUMPPRGNAME = redis-check-dump
|
|
||||||
CHECKAOFPRGNAME = redis-check-aof
|
|
||||||
|
|
||||||
all: redis-benchmark redis-cli redis-check-dump redis-check-aof redis-server
|
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Hint: To run 'make test' is a good idea ;)"
|
@echo "Hint: To run 'make test' is a good idea ;)"
|
||||||
@echo ""
|
@echo ""
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
|
||||||
# Deps (use make dep to generate this)
|
# Deps (use make dep to generate this)
|
||||||
adlist.o: adlist.c adlist.h zmalloc.h
|
include Makefile.dep
|
||||||
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
|
|
||||||
ae_select.o: ae_select.c
|
|
||||||
anet.o: anet.c fmacros.h anet.h
|
|
||||||
aof.o: aof.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h bio.h
|
|
||||||
bio.o: bio.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h bio.h
|
|
||||||
cluster.o: cluster.c redis.h fmacros.h config.h ae.h sds.h dict.h \
|
|
||||||
adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h \
|
|
||||||
rio.h
|
|
||||||
config.o: config.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h
|
|
||||||
crc16.o: crc16.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h
|
|
||||||
db.o: db.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h
|
|
||||||
debug.o: debug.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h sha1.h
|
|
||||||
dict.o: dict.c fmacros.h dict.h zmalloc.h
|
|
||||||
endianconv.o: endianconv.c
|
|
||||||
intset.o: intset.c intset.h zmalloc.h endianconv.h
|
|
||||||
lzf_c.o: lzf_c.c lzfP.h
|
|
||||||
lzf_d.o: lzf_d.c lzfP.h
|
|
||||||
multi.o: multi.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h
|
|
||||||
networking.o: networking.c redis.h fmacros.h config.h ae.h sds.h dict.h \
|
|
||||||
adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h \
|
|
||||||
rio.h
|
|
||||||
object.o: object.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h
|
|
||||||
pqsort.o: pqsort.c
|
|
||||||
pubsub.o: pubsub.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h
|
|
||||||
rand.o: rand.c
|
|
||||||
rdb.o: rdb.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h lzf.h \
|
|
||||||
zipmap.h
|
|
||||||
redis-benchmark.o: redis-benchmark.c fmacros.h ae.h \
|
|
||||||
../deps/hiredis/hiredis.h sds.h adlist.h zmalloc.h
|
|
||||||
redis-check-aof.o: redis-check-aof.c fmacros.h config.h
|
|
||||||
redis-check-dump.o: redis-check-dump.c lzf.h
|
|
||||||
redis-cli.o: redis-cli.c fmacros.h version.h ../deps/hiredis/hiredis.h \
|
|
||||||
sds.h zmalloc.h ../deps/linenoise/linenoise.h help.h
|
|
||||||
redis.o: redis.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h \
|
|
||||||
slowlog.h bio.h asciilogo.h
|
|
||||||
release.o: release.c release.h
|
|
||||||
replication.o: replication.c redis.h fmacros.h config.h ae.h sds.h dict.h \
|
|
||||||
adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h \
|
|
||||||
rio.h
|
|
||||||
rio.o: rio.c fmacros.h rio.h sds.h util.h
|
|
||||||
scripting.o: scripting.c redis.h fmacros.h config.h ae.h sds.h dict.h \
|
|
||||||
adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h \
|
|
||||||
rio.h sha1.h rand.h
|
|
||||||
sds.o: sds.c sds.h zmalloc.h
|
|
||||||
sha1.o: sha1.c sha1.h config.h
|
|
||||||
slowlog.o: slowlog.c redis.h fmacros.h config.h ae.h sds.h dict.h \
|
|
||||||
adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h \
|
|
||||||
rio.h slowlog.h
|
|
||||||
sort.o: sort.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h \
|
|
||||||
pqsort.h
|
|
||||||
syncio.o: syncio.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
|
||||||
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.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 ziplist.h intset.h version.h util.h rdb.h rio.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 ziplist.h intset.h version.h util.h rdb.h rio.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 ziplist.h intset.h version.h util.h rdb.h rio.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 ziplist.h intset.h version.h util.h rdb.h \
|
|
||||||
rio.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 ziplist.h intset.h version.h util.h rdb.h rio.h
|
|
||||||
util.o: util.c fmacros.h util.h
|
|
||||||
ziplist.o: ziplist.c zmalloc.h util.h ziplist.h endianconv.h
|
|
||||||
zipmap.o: zipmap.c zmalloc.h endianconv.h
|
|
||||||
zmalloc.o: zmalloc.c config.h zmalloc.h
|
|
||||||
|
|
||||||
# Clean local objects when ARCH is different
|
dep:
|
||||||
ifneq ($(shell sh -c '[ -f .make-arch ] && cat .make-arch'), $(ARCH))
|
$(R_CC) -MM *.c
|
||||||
.make-arch: clean
|
|
||||||
else
|
|
||||||
.make-arch:
|
|
||||||
endif
|
|
||||||
|
|
||||||
.make-arch:
|
.PHONY: dep
|
||||||
-(cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS) ARCH="$(ARCH)")
|
|
||||||
-(echo $(ARCH) > .make-arch)
|
|
||||||
|
|
||||||
# Clean local objects when allocator changes
|
# Prerequisites target
|
||||||
ifneq ($(shell sh -c '[ -f .make-malloc ] && cat .make-malloc'), $(MALLOC))
|
.make-prerequisites:
|
||||||
.make-malloc: clean
|
|
||||||
else
|
|
||||||
.make-malloc:
|
|
||||||
endif
|
|
||||||
|
|
||||||
.make-malloc:
|
|
||||||
-(echo $(MALLOC) > .make-malloc)
|
|
||||||
|
|
||||||
# Union of make-prerequisites
|
|
||||||
.make-prerequisites: .make-arch .make-malloc
|
|
||||||
@touch $@
|
@touch $@
|
||||||
|
|
||||||
redis-server: .make-prerequisites $(OBJ)
|
# Clean local objects and build dependencies when R_CFLAGS is different
|
||||||
$(QUIET_LINK)$(CC) -o $(PRGNAME) $(CCOPT) $(DEBUG) $(OBJ) ../deps/lua/src/liblua.a $(CCLINK)
|
ifneq ($(shell sh -c '[ -f .make-cflags ] && cat .make-cflags || echo none'), $(R_CFLAGS))
|
||||||
|
.make-cflags: clean
|
||||||
|
-(cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS))
|
||||||
|
-(echo "$(R_CFLAGS)" > .make-cflags)
|
||||||
|
.make-prerequisites: .make-cflags
|
||||||
|
endif
|
||||||
|
|
||||||
redis-benchmark: .make-prerequisites $(BENCHOBJ)
|
# Clean local objects when R_LDFLAGS is different
|
||||||
$(QUIET_LINK)$(CC) -o $(BENCHPRGNAME) $(CCOPT) $(DEBUG) $(BENCHOBJ) ../deps/hiredis/libhiredis.a $(CCLINK)
|
ifneq ($(shell sh -c '[ -f .make-ldflags ] && cat .make-ldflags || echo none'), $(R_LDFLAGS))
|
||||||
|
.make-ldflags: clean
|
||||||
|
-(echo "$(R_LDFLAGS)" > .make-ldflags)
|
||||||
|
.make-prerequisites: .make-ldflags
|
||||||
|
endif
|
||||||
|
|
||||||
redis-benchmark.o: redis-benchmark.c .make-prerequisites
|
# Clean local objects when MALLOC is different
|
||||||
$(QUIET_CC)$(CC) -c $(CFLAGS) -I../deps/hiredis $(DEBUG) $(COMPILE_TIME) $<
|
ifneq ($(shell sh -c '[ -f .make-malloc ] && cat .make-malloc || echo none'), $(MALLOC))
|
||||||
|
.make-malloc: clean
|
||||||
|
-(echo "$(MALLOC)" > .make-malloc)
|
||||||
|
.make-prerequisites: .make-malloc
|
||||||
|
endif
|
||||||
|
|
||||||
redis-cli: .make-prerequisites $(CLIOBJ)
|
# redis-server
|
||||||
$(QUIET_LINK)$(CC) -o $(CLIPRGNAME) $(CCOPT) $(DEBUG) $(CLIOBJ) ../deps/hiredis/libhiredis.a ../deps/linenoise/linenoise.o $(CCLINK)
|
$(R_SERVER_NAME): $(R_SERVER_OBJ)
|
||||||
|
$(R_LD) -o $@ $^ ../deps/lua/src/liblua.a $(R_LIBS)
|
||||||
|
|
||||||
redis-cli.o: redis-cli.c .make-prerequisites
|
# redis-cli
|
||||||
$(QUIET_CC)$(CC) -c $(CFLAGS) -I../deps/hiredis -I../deps/linenoise $(DEBUG) $(COMPILE_TIME) $<
|
$(R_CLI_NAME): $(R_CLI_OBJ)
|
||||||
|
$(R_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/linenoise/linenoise.o $(R_LIBS)
|
||||||
|
|
||||||
redis-check-dump: .make-prerequisites $(CHECKDUMPOBJ)
|
# redis-benchmark
|
||||||
$(QUIET_LINK)$(CC) -o $(CHECKDUMPPRGNAME) $(CCOPT) $(DEBUG) $(CHECKDUMPOBJ) $(CCLINK)
|
$(R_BENCHMARK_NAME): $(R_BENCHMARK_OBJ)
|
||||||
|
$(R_LD) -o $@ $^ ../deps/hiredis/libhiredis.a $(R_LIBS)
|
||||||
|
|
||||||
redis-check-aof: .make-prerequisites $(CHECKAOFOBJ)
|
# redis-check-dump
|
||||||
$(QUIET_LINK)$(CC) -o $(CHECKAOFPRGNAME) $(CCOPT) $(DEBUG) $(CHECKAOFOBJ) $(CCLINK)
|
$(R_CHECK_DUMP_NAME): $(R_CHECK_DUMP_OBJ)
|
||||||
|
$(R_LD) -o $@ $^ $(R_LIBS)
|
||||||
|
|
||||||
# Because the jemalloc.h header is generated as a part of the jemalloc build
|
# redis-check-aof
|
||||||
# process, building it should complete before building any other object. Instead of
|
$(R_CHECK_AOF_NAME): $(R_CHECK_AOF_OBJ)
|
||||||
# depending on a single artifact, simply build all dependencies first.
|
$(R_LD) -o $@ $^ $(R_LIBS)
|
||||||
|
|
||||||
|
# Because the jemalloc.h header is generated as a part of the jemalloc build,
|
||||||
|
# building it should complete before building any other object. Instead of
|
||||||
|
# depending on a single artifact, build all dependencies first.
|
||||||
%.o: %.c .make-prerequisites
|
%.o: %.c .make-prerequisites
|
||||||
$(QUIET_CC)$(CC) -c $(CFLAGS) $(DEBUG) $(COMPILE_TIME) -I../deps/lua/src $<
|
$(R_CC) -c $<
|
||||||
|
|
||||||
.PHONY: all clean distclean lcov
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(PRGNAME) $(BENCHPRGNAME) $(CLIPRGNAME) $(CHECKDUMPPRGNAME) $(CHECKAOFPRGNAME) *.o *.gcda *.gcno *.gcov redis.info lcov-html
|
rm -rf $(R_SERVER_NAME) $(R_CLI_NAME) $(R_BENCHMARK_NAME) $(R_CHECK_DUMP_NAME) $(R_CHECK_AOF_NAME) *.o *.gcda *.gcno *.gcov redis.info lcov-html
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
-(cd ../deps && $(MAKE) distclean)
|
-(cd ../deps && $(MAKE) distclean)
|
||||||
-(rm -f .make-arch .make-malloc)
|
-(rm -f .make-*)
|
||||||
|
|
||||||
dep:
|
.PHONY: distclean
|
||||||
$(CC) -MM *.c -I ../deps/hiredis -I ../deps/linenoise
|
|
||||||
|
|
||||||
test: redis-server redis-check-aof
|
test: $(R_SERVER_NAME) $(R_CHECK_AOF_NAME)
|
||||||
@(cd ..; ./runtest)
|
@(cd ..; ./runtest)
|
||||||
|
|
||||||
lcov:
|
lcov:
|
||||||
@ -247,8 +179,10 @@ lcov:
|
|||||||
@geninfo -o redis.info .
|
@geninfo -o redis.info .
|
||||||
@genhtml --legend -o lcov-html redis.info
|
@genhtml --legend -o lcov-html redis.info
|
||||||
|
|
||||||
bench:
|
.PHONY: lcov
|
||||||
./redis-benchmark
|
|
||||||
|
bench: $(R_BENCHMARK_NAME)
|
||||||
|
./$(R_BENCHMARK_NAME)
|
||||||
|
|
||||||
log:
|
log:
|
||||||
git log '--pretty=format:%ad %s (%cn)' --date=short > ../Changelog
|
git log '--pretty=format:%ad %s (%cn)' --date=short > ../Changelog
|
||||||
@ -257,27 +191,27 @@ log:
|
|||||||
@echo ""
|
@echo ""
|
||||||
@echo "WARNING: if it fails under Linux you probably need to install libc6-dev-i386"
|
@echo "WARNING: if it fails under Linux you probably need to install libc6-dev-i386"
|
||||||
@echo ""
|
@echo ""
|
||||||
$(MAKE) ARCH="-m32" JEMALLOC_CFLAGS='CFLAGS="-std=gnu99 -Wall -pipe -g3 -fvisibility=hidden -O3 -funroll-loops -m32"'
|
$(MAKE) CFLAGS="$(CFLAGS) -m32" LDFLAGS="$(LDFLAGS) -m32"
|
||||||
|
|
||||||
gprof:
|
gprof:
|
||||||
$(MAKE) PROF="-pg"
|
$(MAKE) CFLAGS="$(CFLAGS) -pg" LDFLAGS="$(LDFLAGS) -pg"
|
||||||
|
|
||||||
gcov:
|
gcov:
|
||||||
$(MAKE) PROF="-fprofile-arcs -ftest-coverage -DCOVERAGE_TEST"
|
$(MAKE) CFLAGS="$(CFLAGS) -fprofile-arcs -ftest-coverage -DCOVERAGE_TEST"
|
||||||
|
|
||||||
noopt:
|
noopt:
|
||||||
$(MAKE) OPTIMIZATION=""
|
$(MAKE) OPT="-O0"
|
||||||
|
|
||||||
32bitgprof:
|
32bitgprof:
|
||||||
$(MAKE) PROF="-pg" ARCH="-arch i386"
|
$(MAKE) CFLAGS="$(CFLAGS) -m32" LDFLAGS="$(LDFLAGS) -m32" gprof
|
||||||
|
|
||||||
src/help.h:
|
src/help.h:
|
||||||
@../utils/generate-command-help.rb > help.h
|
@../utils/generate-command-help.rb > help.h
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p $(INSTALL_BIN)
|
mkdir -p $(INSTALL_BIN)
|
||||||
$(INSTALL) $(PRGNAME) $(INSTALL_BIN)
|
$(INSTALL) $(R_SERVER_NAME) $(INSTALL_BIN)
|
||||||
$(INSTALL) $(BENCHPRGNAME) $(INSTALL_BIN)
|
$(INSTALL) $(R_BENCHMARK_NAME) $(INSTALL_BIN)
|
||||||
$(INSTALL) $(CLIPRGNAME) $(INSTALL_BIN)
|
$(INSTALL) $(R_CLI_NAME) $(INSTALL_BIN)
|
||||||
$(INSTALL) $(CHECKDUMPPRGNAME) $(INSTALL_BIN)
|
$(INSTALL) $(R_CHECK_DUMP_NAME) $(INSTALL_BIN)
|
||||||
$(INSTALL) $(CHECKAOFPRGNAME) $(INSTALL_BIN)
|
$(INSTALL) $(R_CHECK_AOF_NAME) $(INSTALL_BIN)
|
||||||
|
83
src/Makefile.dep
Normal file
83
src/Makefile.dep
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
adlist.o: adlist.c adlist.h zmalloc.h
|
||||||
|
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
|
||||||
|
ae_select.o: ae_select.c
|
||||||
|
anet.o: anet.c fmacros.h anet.h
|
||||||
|
aof.o: aof.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h bio.h
|
||||||
|
bio.o: bio.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h bio.h
|
||||||
|
config.o: config.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h
|
||||||
|
crc16.o: crc16.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h
|
||||||
|
db.o: db.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h
|
||||||
|
debug.o: debug.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h sha1.h
|
||||||
|
dict.o: dict.c fmacros.h dict.h zmalloc.h
|
||||||
|
endianconv.o: endianconv.c
|
||||||
|
intset.o: intset.c intset.h zmalloc.h endianconv.h
|
||||||
|
lzf_c.o: lzf_c.c lzfP.h
|
||||||
|
lzf_d.o: lzf_d.c lzfP.h
|
||||||
|
memtest.o: memtest.c
|
||||||
|
migrate.o: migrate.c redis.h fmacros.h config.h ae.h sds.h dict.h \
|
||||||
|
adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h \
|
||||||
|
rio.h
|
||||||
|
multi.o: multi.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h
|
||||||
|
networking.o: networking.c redis.h fmacros.h config.h ae.h sds.h dict.h \
|
||||||
|
adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h \
|
||||||
|
rio.h
|
||||||
|
object.o: object.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h
|
||||||
|
pqsort.o: pqsort.c
|
||||||
|
pubsub.o: pubsub.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h
|
||||||
|
rand.o: rand.c
|
||||||
|
rdb.o: rdb.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h lzf.h \
|
||||||
|
zipmap.h
|
||||||
|
redis-benchmark.o: redis-benchmark.c fmacros.h ae.h \
|
||||||
|
../deps/hiredis/hiredis.h sds.h adlist.h zmalloc.h
|
||||||
|
redis-check-aof.o: redis-check-aof.c fmacros.h config.h
|
||||||
|
redis-check-dump.o: redis-check-dump.c lzf.h
|
||||||
|
redis-cli.o: redis-cli.c fmacros.h version.h ../deps/hiredis/hiredis.h \
|
||||||
|
sds.h zmalloc.h ../deps/linenoise/linenoise.h help.h
|
||||||
|
redis.o: redis.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h \
|
||||||
|
slowlog.h bio.h asciilogo.h
|
||||||
|
release.o: release.c release.h
|
||||||
|
replication.o: replication.c redis.h fmacros.h config.h ae.h sds.h dict.h \
|
||||||
|
adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h \
|
||||||
|
rio.h
|
||||||
|
rio.o: rio.c fmacros.h rio.h sds.h util.h
|
||||||
|
scripting.o: scripting.c redis.h fmacros.h config.h ae.h sds.h dict.h \
|
||||||
|
adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h \
|
||||||
|
rio.h sha1.h rand.h
|
||||||
|
sds.o: sds.c sds.h zmalloc.h
|
||||||
|
sha1.o: sha1.c sha1.h config.h
|
||||||
|
slowlog.o: slowlog.c redis.h fmacros.h config.h ae.h sds.h dict.h \
|
||||||
|
adlist.h zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h \
|
||||||
|
rio.h slowlog.h
|
||||||
|
sort.o: sort.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.h \
|
||||||
|
pqsort.h
|
||||||
|
syncio.o: syncio.c redis.h fmacros.h config.h ae.h sds.h dict.h adlist.h \
|
||||||
|
zmalloc.h anet.h ziplist.h intset.h version.h util.h rdb.h rio.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 ziplist.h intset.h version.h util.h rdb.h rio.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 ziplist.h intset.h version.h util.h rdb.h rio.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 ziplist.h intset.h version.h util.h rdb.h rio.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 ziplist.h intset.h version.h util.h rdb.h \
|
||||||
|
rio.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 ziplist.h intset.h version.h util.h rdb.h rio.h
|
||||||
|
util.o: util.c fmacros.h util.h
|
||||||
|
ziplist.o: ziplist.c zmalloc.h util.h ziplist.h endianconv.h
|
||||||
|
zipmap.o: zipmap.c zmalloc.h endianconv.h
|
||||||
|
zmalloc.o: zmalloc.c config.h zmalloc.h
|
Loading…
x
Reference in New Issue
Block a user