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
hiredis
Commits
d9759edb
Commit
d9759edb
authored
Jan 04, 2012
by
Pieter Noordhuis
Browse files
Move common Makefile variables to separate file
parent
910d46c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
d9759edb
...
@@ -3,43 +3,10 @@
...
@@ -3,43 +3,10 @@
# Copyright (C) 2010-2011 Pieter Noordhuis <pcnoordhuis at gmail dot com>
# Copyright (C) 2010-2011 Pieter Noordhuis <pcnoordhuis at gmail dot com>
# This file is released under the BSD license, see the COPYING file
# This file is released under the BSD license, see the COPYING file
include
./Makefile.common
OBJ
=
net.o hiredis.o sds.o async.o parser.o object.o handle.o format.o
OBJ
=
net.o hiredis.o sds.o async.o parser.o object.o handle.o format.o
BINS
=
hiredis-example hiredis-test
BINS
=
hiredis-example hiredis-test
LIBNAME
=
libhiredis
HIREDIS_MAJOR
=
0
HIREDIS_MINOR
=
10
# Fallback to gcc when $CC is not in $PATH.
CC
:=
$(
shell
sh
-c
'type
$(CC)
>/dev/null 2>/dev/null && echo
$(CC)
|| echo gcc'
)
OPTIMIZATION
?=
-O3
WARNINGS
=
-Wall
-W
-Wstrict-prototypes
-Wwrite-strings
-Wno-unused-label
DEBUG
?=
-g
-ggdb
REAL_CFLAGS
=
$(OPTIMIZATION)
-fPIC
$(CFLAGS)
$(WARNINGS)
$(DEBUG)
REAL_LDFLAGS
=
$(LDFLAGS)
DYLIBSUFFIX
=
so
STLIBSUFFIX
=
a
DYLIB_MINOR_NAME
=
$(LIBNAME)
.
$(DYLIBSUFFIX)
.
$(HIREDIS_MAJOR)
.
$(HIREDIS_MINOR)
DYLIB_MAJOR_NAME
=
$(LIBNAME)
.
$(DYLIBSUFFIX)
.
$(HIREDIS_MAJOR)
DYLIBNAME
=
$(LIBNAME)
.
$(DYLIBSUFFIX)
DYLIB_MAKE_CMD
=
$(CC)
-shared
-Wl
,-soname,
$(DYLIB_MINOR_NAME)
-o
$(DYLIBNAME)
$(LDFLAGS)
STLIBNAME
=
$(LIBNAME)
.
$(STLIBSUFFIX)
STLIB_MAKE_CMD
=
ar rcs
$(STLIBNAME)
# Platform-specific overrides
uname_S
:=
$(
shell
sh
-c
'uname -s 2>/dev/null || echo not'
)
ifeq
($(uname_S),SunOS)
REAL_LDFLAGS
+=
-ldl
-lnsl
-lsocket
DYLIB_MAKE_CMD
=
$(CC)
-G
-o
$(DYLIBNAME)
-h
$(DYLIB_MINOR_NAME)
$(LDFLAGS)
INSTALL
=
cp
-r
endif
ifeq
($(uname_S),Darwin)
DYLIBSUFFIX
=
dylib
DYLIB_MINOR_NAME
=
$(LIBNAME)
.
$(HIREDIS_MAJOR)
.
$(HIREDIS_MINOR)
.
$(DYLIBSUFFIX)
DYLIB_MAJOR_NAME
=
$(LIBNAME)
.
$(HIREDIS_MAJOR)
.
$(DYLIBSUFFIX)
DYLIB_MAKE_CMD
=
$(CC)
-shared
-Wl
,-install_name,
$(DYLIB_MINOR_NAME)
-o
$(DYLIBNAME)
$(LDFLAGS)
endif
all
:
$(DYLIBNAME) $(BINS)
all
:
$(DYLIBNAME) $(BINS)
...
@@ -94,12 +61,6 @@ check: hiredis-test
...
@@ -94,12 +61,6 @@ check: hiredis-test
(
kill
`
cat
/tmp/hiredis-test-redis.pid
`
&&
false
)
(
kill
`
cat
/tmp/hiredis-test-redis.pid
`
&&
false
)
kill
`
cat
/tmp/hiredis-test-redis.pid
`
kill
`
cat
/tmp/hiredis-test-redis.pid
`
test/test-%.o
:
test/test-%.c $(STLIBNAME)
$(CC)
-std
=
c99
-pedantic
-o
$@
-c
$(REAL_CFLAGS)
$<
test/test-%
:
test/test-%.o $(STLIBNAME)
$(CC)
-o
$@
$(REAL_LDFLAGS)
$^
.c.o
:
.c.o
:
$(CC)
-std
=
c99
-pedantic
-c
$(REAL_CFLAGS)
$<
$(CC)
-std
=
c99
-pedantic
-c
$(REAL_CFLAGS)
$<
...
...
Makefile.common
0 → 100644
View file @
d9759edb
LIBNAME
=
libhiredis
HIREDIS_MAJOR
=
0
HIREDIS_MINOR
=
10
# Fallback to gcc when $CC is not in $PATH.
CC
:=
$(
shell
sh
-c
'type
$(CC)
>/dev/null 2>/dev/null && echo
$(CC)
|| echo gcc'
)
OPTIMIZATION
?=
-O3
WARNINGS
=
-Wall
-W
-Wstrict-prototypes
-Wwrite-strings
-Wno-unused-label
DEBUG
?=
-g
-ggdb
REAL_CFLAGS
=
$(OPTIMIZATION)
-fPIC
$(CFLAGS)
$(WARNINGS)
$(DEBUG)
REAL_LDFLAGS
=
$(LDFLAGS)
DYLIBSUFFIX
=
so
STLIBSUFFIX
=
a
DYLIB_MINOR_NAME
=
$(LIBNAME)
.
$(DYLIBSUFFIX)
.
$(HIREDIS_MAJOR)
.
$(HIREDIS_MINOR)
DYLIB_MAJOR_NAME
=
$(LIBNAME)
.
$(DYLIBSUFFIX)
.
$(HIREDIS_MAJOR)
DYLIBNAME
=
$(LIBNAME)
.
$(DYLIBSUFFIX)
DYLIB_MAKE_CMD
=
$(CC)
-shared
-Wl
,-soname,
$(DYLIB_MINOR_NAME)
-o
$(DYLIBNAME)
$(LDFLAGS)
STLIBNAME
=
$(LIBNAME)
.
$(STLIBSUFFIX)
STLIB_MAKE_CMD
=
ar rcs
$(STLIBNAME)
# Platform-specific overrides
uname_S
:=
$(
shell
sh
-c
'uname -s 2>/dev/null || echo not'
)
ifeq
($(uname_S),SunOS)
REAL_LDFLAGS
+=
-ldl
-lnsl
-lsocket
DYLIB_MAKE_CMD
=
$(CC)
-G
-o
$(DYLIBNAME)
-h
$(DYLIB_MINOR_NAME)
$(LDFLAGS)
INSTALL
=
cp
-r
endif
ifeq
($(uname_S),Darwin)
DYLIBSUFFIX
=
dylib
DYLIB_MINOR_NAME
=
$(LIBNAME)
.
$(HIREDIS_MAJOR)
.
$(HIREDIS_MINOR)
.
$(DYLIBSUFFIX)
DYLIB_MAJOR_NAME
=
$(LIBNAME)
.
$(HIREDIS_MAJOR)
.
$(DYLIBSUFFIX)
DYLIB_MAKE_CMD
=
$(CC)
-shared
-Wl
,-install_name,
$(DYLIB_MINOR_NAME)
-o
$(DYLIBNAME)
$(LDFLAGS)
endif
test/Makefile
0 → 100644
View file @
d9759edb
include
../Makefile.common
TESTS
=
test-format test-parser test-object test-handle
all
:
$(TESTS)
test-%
:
test-%.o
$(CC)
-o
$@
$(REAL_LDFLAGS)
$<
../
$(STLIBNAME)
.c.o
:
$(CC)
-std
=
c99
-pedantic
-c
$(REAL_CFLAGS)
-O0
$<
clean
:
rm
-f
*
.o
$(TESTS)
include
./Makefile.dep
dep
:
$(CC)
-MM
*
.c
>
Makefile.dep
.PHONY
:
all clean dep
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