Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
9e62dc17
Commit
9e62dc17
authored
Jun 20, 2011
by
antirez
Browse files
Makefile modified to build with jemalloc
parent
b4a79b9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
9e62dc17
...
...
@@ -12,6 +12,7 @@ clean:
cd
src
&&
$(MAKE)
$@
cd
deps/hiredis
&&
$(MAKE)
$@
cd
deps/linenoise
&&
$(MAKE)
$@
cd
deps/jemalloc
&&
$(MAKE)
distclean
$(TARGETS)
:
cd
src
&&
$(MAKE)
$@
...
...
src/Makefile
View file @
9e62dc17
...
...
@@ -5,35 +5,45 @@
release_hdr
:=
$(
shell
sh
-c
'./mkreleasehdr.sh'
)
uname_S
:=
$(
shell
sh
-c
'uname -s 2>/dev/null || echo not'
)
OPTIMIZATION
?=
-O2
ifeq
($(uname_S),Linux)
ifneq
($(FORCE_LIBC_MALLOC),yes)
USE_JEMALLOC
=
yes
endif
endif
ifeq
($(uname_S),SunOS)
CFLAGS
?=
-std
=
c99
-pedantic
$(OPTIMIZATION)
-Wall
-W
-D__EXTENSIONS__
-D_XPG6
CCLINK
?=
-ldl
-lnsl
-lsocket
-lm
-lpthread
DEBUG
?=
-g
-ggdb
CFLAGS
?=
-std
=
c99
-pedantic
$(OPTIMIZATION)
-Wall
-W
-D__EXTENSIONS__
-D_XPG6
CCLINK
?=
-ldl
-lnsl
-lsocket
-lm
-lpthread
DEBUG
?=
-g
-ggdb
else
CFLAGS
?=
-std
=
c99
-pedantic
$(OPTIMIZATION)
-Wall
-W
$(ARCH)
$(PROF)
CCLINK
?=
-lm
-pthread
DEBUG
?=
-g
-rdynamic
-ggdb
CFLAGS
?=
-std
=
c99
-pedantic
$(OPTIMIZATION)
-Wall
-W
$(ARCH)
$(PROF)
CCLINK
?=
-lm
-pthread
DEBUG
?=
-g
-rdynamic
-ggdb
endif
ifeq
($(USE_TCMALLOC),yes)
ALLOD_DEPS
=
ALLOC_LINK
=
-ltcmalloc
ALLOC_FLAGS
=
-DUSE_TCMALLOC
endif
ifeq
($(USE_TCMALLOC_MINIMAL),yes)
ALLOD_DEPS
=
ALLOC_LINK
=
-ltcmalloc_minimal
ALLOC_FLAGS
=
-DUSE_TCMALLOC
endif
ifeq
($(USE_JEMALLOC),yes)
ALLOC_LINK
=
-ljemalloc
ALLOC_FLAGS
=
-DUSE_JEMALLOC
ALLOC_DEP
=
../deps/jemalloc/lib/libjemalloc.a
ALLOC_LINK
=
$(ALLOC_DEP)
ALLOC_FLAGS
=
-DUSE_JEMALLOC
-I
../deps/jemalloc/include
endif
CCLINK
+=
$(ALLOC_LINK)
CFLAGS
+=
$(ALLOC_FLAGS)
CCOPT
=
$(CFLAGS)
$(CCLINK)
$(ARCH)
$(PROF)
CCOPT
=
$(CFLAGS)
$(ARCH)
$(PROF)
PREFIX
=
/usr/local
INSTALL_BIN
=
$(PREFIX)
/bin
...
...
@@ -136,35 +146,42 @@ ziplist.o: ziplist.c zmalloc.h ziplist.h
zipmap.o
:
zipmap.c zmalloc.h
zmalloc.o
:
zmalloc.c config.h
.PHONY
:
dependencies
dependencies
:
@
printf
'%b %b\n'
$(MAKECOLOR)
MAKE
$(ENDCOLOR)
$(BINCOLOR)
hiredis
$(ENDCOLOR)
@
cd
../deps/hiredis
&&
$(MAKE)
static
ARCH
=
"
$(ARCH)
"
@
printf
'%b %b\n'
$(MAKECOLOR)
MAKE
$(ENDCOLOR)
$(BINCOLOR)
linenoise
$(ENDCOLOR)
@
cd
../deps/linenoise
&&
$(MAKE)
ARCH
=
"
$(ARCH)
"
../deps/jemalloc/lib/libjemalloc.a
:
cd
../deps/jemalloc
&&
./configure
--with-jemalloc-prefix
=
je_
--enable-cc-silence
&&
$(MAKE)
lib/libjemalloc.a
redis-server
:
$(OBJ)
$(QUIET_CC)$(CC)
-o
$(PRGNAME)
$(CCOPT)
$(DEBUG)
$(OBJ)
$(QUIET_CC)$(CC)
-o
$(PRGNAME)
$(CCOPT)
$(DEBUG)
$(OBJ)
$(CCLINK)
$(ALLOC_LINK)
redis-benchmark
:
dependencies $(BENCHOBJ)
@
cd
../deps/hiredis
&&
$(MAKE)
static
$(QUIET_LINK)$(CC)
-o
$(BENCHPRGNAME)
$(CCOPT)
$(DEBUG)
$(BENCHOBJ)
../deps/hiredis/libhiredis.a
$(QUIET_LINK)$(CC)
-o
$(BENCHPRGNAME)
$(CCOPT)
$(DEBUG)
$(BENCHOBJ)
../deps/hiredis/libhiredis.a
$(CCLINK)
$(ALLOC_LINK)
redis-benchmark.o
:
$(QUIET_CC)$(CC)
-c
$(CFLAGS)
-I
../deps/hiredis
$(DEBUG)
$(COMPILE_TIME)
$<
redis-cli
:
dependencies $(CLIOBJ)
$(QUIET_LINK)$(CC)
-o
$(CLIPRGNAME)
$(CCOPT)
$(DEBUG)
$(CLIOBJ)
../deps/hiredis/libhiredis.a ../deps/linenoise/linenoise.o
$(QUIET_LINK)$(CC)
-o
$(CLIPRGNAME)
$(CCOPT)
$(DEBUG)
$(CLIOBJ)
../deps/hiredis/libhiredis.a ../deps/linenoise/linenoise.o
$(CCLINK)
$(ALLOC_LINK)
redis-cli.o
:
$(QUIET_CC)$(CC)
-c
$(CFLAGS)
-I
../deps/hiredis
-I
../deps/linenoise
$(DEBUG)
$(COMPILE_TIME)
$<
redis-check-dump
:
$(CHECKDUMPOBJ)
$(QUIET_LINK)$(CC)
-o
$(CHECKDUMPPRGNAME)
$(CCOPT)
$(DEBUG)
$(CHECKDUMPOBJ)
$(QUIET_LINK)$(CC)
-o
$(CHECKDUMPPRGNAME)
$(CCOPT)
$(DEBUG)
$(CHECKDUMPOBJ)
$(CCLINK)
$(ALLOC_LINK)
redis-check-aof
:
$(CHECKAOFOBJ)
$(QUIET_LINK)$(CC)
-o
$(CHECKAOFPRGNAME)
$(CCOPT)
$(DEBUG)
$(CHECKAOFOBJ)
$(QUIET_LINK)$(CC)
-o
$(CHECKAOFPRGNAME)
$(CCOPT)
$(DEBUG)
$(CHECKAOFOBJ)
$(CCLINK)
$(ALLOC_LINK)
.c.o
:
# Because the jemalloc.h header is generated as a part of the jemalloc build
# process, building it should complete before building any other object.
%.o
:
%.c $(ALLOC_DEP)
$(QUIET_CC)$(CC)
-c
$(CFLAGS)
$(DEBUG)
$(COMPILE_TIME)
$<
clean
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment