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
fc810f77
Commit
fc810f77
authored
Jun 18, 2011
by
Pieter Noordhuis
Browse files
Allow *extra* CFLAGS/LDFLAGS via arguments
parent
79056321
Changes
1
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
fc810f77
...
@@ -13,8 +13,9 @@ HIREDIS_MINOR=10
...
@@ -13,8 +13,9 @@ HIREDIS_MINOR=10
# Fallback to gcc when $CC is not in $PATH.
# Fallback to gcc when $CC is not in $PATH.
CC
:=
$(
shell
sh
-c
'type
$(CC)
>/dev/null 2>/dev/null && echo
$(CC)
|| echo gcc'
)
CC
:=
$(
shell
sh
-c
'type
$(CC)
>/dev/null 2>/dev/null && echo
$(CC)
|| echo gcc'
)
OPTIMIZATION
?=
-O3
OPTIMIZATION
?=
-O3
CFLAGS
=
$(OPTIMIZATION)
-fPIC
-Wall
-W
-Wstrict-prototypes
-Wwrite-strings
$(ARCH)
$(PROF)
WARNINGS
=
-Wall
-W
-Wstrict-prototypes
-Wwrite-strings
LDFLAGS
=
REAL_CFLAGS
=
$(OPTIMIZATION)
-fPIC
$(CFLAGS)
$(WARNINGS)
$(ARCH)
$(PROF)
REAL_LDFLAGS
=
$(LDFLAGS)
DEBUG
?=
-g
-ggdb
DEBUG
?=
-g
-ggdb
DYLIBSUFFIX
=
so
DYLIBSUFFIX
=
so
...
@@ -28,7 +29,7 @@ STLIB_MAKE_CMD=ar rcs $(STLIBNAME)
...
@@ -28,7 +29,7 @@ STLIB_MAKE_CMD=ar rcs $(STLIBNAME)
uname_S
:=
$(
shell
sh
-c
'uname -s 2>/dev/null || echo not'
)
uname_S
:=
$(
shell
sh
-c
'uname -s 2>/dev/null || echo not'
)
ifeq
($(uname_S),SunOS)
ifeq
($(uname_S),SunOS)
LDFLAGS
=
-ldl
-lnsl
-lsocket
LDFLAGS
+
=
-ldl
-lnsl
-lsocket
DYLIB_MAKE_CMD
=
$(CC)
-G
-o
$(DYLIBNAME)
-h
$(DYLIB_MINOR_NAME)
DYLIB_MAKE_CMD
=
$(CC)
-G
-o
$(DYLIBNAME)
-h
$(DYLIB_MINOR_NAME)
STLIB_MAKE_CMD
=
ar rcs
$(STLIBNAME)
STLIB_MAKE_CMD
=
ar rcs
$(STLIBNAME)
INSTALL
=
cp
-r
INSTALL
=
cp
-r
...
@@ -66,10 +67,10 @@ static: $(STLIBNAME)
...
@@ -66,10 +67,10 @@ static: $(STLIBNAME)
# Binaries:
# Binaries:
hiredis-example-libevent
:
example-libevent.c adapters/libevent.h $(STLIBNAME)
hiredis-example-libevent
:
example-libevent.c adapters/libevent.h $(STLIBNAME)
$(CC)
-o
$@
$(CFLAGS)
$(DEBUG)
$(LDFLAGS)
-levent
example-libevent.c
$(STLIBNAME)
$(CC)
-o
$@
$(
REAL_
CFLAGS)
$(DEBUG)
$(
REAL_
LDFLAGS)
-levent
example-libevent.c
$(STLIBNAME)
hiredis-example-libev
:
example-libev.c adapters/libev.h $(STLIBNAME)
hiredis-example-libev
:
example-libev.c adapters/libev.h $(STLIBNAME)
$(CC)
-o
$@
$(CFLAGS)
$(DEBUG)
$(LDFLAGS)
-lev
example-libev.c
$(STLIBNAME)
$(CC)
-o
$@
$(
REAL_
CFLAGS)
$(DEBUG)
$(
REAL_
LDFLAGS)
-lev
example-libev.c
$(STLIBNAME)
ifndef
AE_DIR
ifndef
AE_DIR
hiredis-example-ae
:
hiredis-example-ae
:
...
@@ -77,11 +78,11 @@ hiredis-example-ae:
...
@@ -77,11 +78,11 @@ hiredis-example-ae:
@
false
@
false
else
else
hiredis-example-ae
:
example-ae.c adapters/ae.h $(STLIBNAME)
hiredis-example-ae
:
example-ae.c adapters/ae.h $(STLIBNAME)
$(CC)
-o
$@
$(CFLAGS)
$(DEBUG)
-I
$(AE_DIR)
$(LDFLAGS)
$(AE_DIR)
/ae.o
$(AE_DIR)
/zmalloc.o example-ae.c
$(STLIBNAME)
$(CC)
-o
$@
$(
REAL_
CFLAGS)
$(DEBUG)
-I
$(AE_DIR)
$(
REAL_
LDFLAGS)
$(AE_DIR)
/ae.o
$(AE_DIR)
/zmalloc.o example-ae.c
$(STLIBNAME)
endif
endif
hiredis-%
:
%.o $(STLIBNAME)
hiredis-%
:
%.o $(STLIBNAME)
$(CC)
-o
$@
$(CFLAGS)
$(DEBUG)
$(LDFLAGS)
$<
$(STLIBNAME)
$(CC)
-o
$@
$(
REAL_
CFLAGS)
$(DEBUG)
$(
REAL_
LDFLAGS)
$<
$(STLIBNAME)
test
:
hiredis-test
test
:
hiredis-test
./hiredis-test
./hiredis-test
...
@@ -99,7 +100,7 @@ check: hiredis-test
...
@@ -99,7 +100,7 @@ check: hiredis-test
kill
`
cat
/tmp/hiredis-test-redis.pid
`
kill
`
cat
/tmp/hiredis-test-redis.pid
`
.c.o
:
.c.o
:
$(CC)
-std
=
c99
-pedantic
-c
$(CFLAGS)
$(OBJARCH)
$(DEBUG)
$(COMPILE_TIME)
$<
$(CC)
-std
=
c99
-pedantic
-c
$(
REAL_
CFLAGS)
$(OBJARCH)
$(DEBUG)
$(COMPILE_TIME)
$<
clean
:
clean
:
rm
-rf
$(DYLIBNAME)
$(STLIBNAME)
$(BINS)
hiredis-example
*
*
.o
*
.gcda
*
.gcno
*
.gcov
rm
-rf
$(DYLIBNAME)
$(STLIBNAME)
$(BINS)
hiredis-example
*
*
.o
*
.gcda
*
.gcno
*
.gcov
...
...
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