Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
802f8ca0
Commit
802f8ca0
authored
Apr 30, 2018
by
zyearn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Makefile work as well in MacOs
parent
e6db1594
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
248 additions
and
63 deletions
+248
-63
Makefile
Makefile
+30
-9
config_brpc.sh
config_brpc.sh
+65
-13
Makefile
example/echo_c++/Makefile
+20
-7
Makefile
example/http_c++/Makefile
+23
-9
Makefile
example/memcache_c++/Makefile
+18
-5
Makefile
example/multi_threaded_echo_c++/Makefile
+20
-7
Makefile
example/redis_c++/Makefile
+20
-7
Makefile
test/Makefile
+27
-1
Makefile
tools/parallel_http/Makefile
+5
-1
Makefile
tools/rpc_press/Makefile
+5
-1
Makefile
tools/rpc_replay/Makefile
+5
-1
Makefile
tools/rpc_view/Makefile
+5
-1
Makefile
tools/trackme_server/Makefile
+5
-1
No files found.
Makefile
View file @
802f8ca0
...
...
@@ -14,16 +14,23 @@ DEBUG_CFLAGS = $(filter-out -DNDEBUG,$(CFLAGS)) -DUNIT_TEST
HDRPATHS
=
-I
./src
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
$
(
addprefix
-L
,
$(LIBS)
)
COMMA
=
,
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
=
,
$(LIBS)
)
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
$(COMMA)
,
$(LIBS)
)
SRCEXTS
=
.c .cc .cpp .proto
TARGET_LIB_DY
=
libbrpc.so
ifeq
($(SYSTEM),Darwin)
TARGET_LIB_DY
=
libbrpc.dylib
endif
#required by butil/crc32.cc to boost performance for 10x
ifeq
($(shell
test
$(GCC_VERSION)
-ge
40400;
echo
$$?),0)
CXXFLAGS
+=
-msse4
-msse4
.2
endif
#not solved yet
ifeq
($(shell
test
$(GCC_VERSION)
-ge
70000;
echo
$$?),0)
ifeq
($(CC),gcc)
ifeq
($(shell
test
$(GCC_VERSION)
-ge
70000;
echo
$$?),0)
CXXFLAGS
+=
-Wno-aligned-new
endif
endif
BUTIL_SOURCES
=
\
...
...
@@ -81,6 +88,7 @@ BUTIL_SOURCES = \
src/butil/memory/weak_ptr.cc
\
src/butil/posix/file_descriptor_shuffle.cc
\
src/butil/posix/global_descriptors.cc
\
src/butil/process_util.cc
\
src/butil/rand_util.cc
\
src/butil/rand_util_posix.cc
\
src/butil/fast_rand.cpp
\
...
...
@@ -96,7 +104,6 @@ BUTIL_SOURCES = \
src/butil/strings/string_util.cc
\
src/butil/strings/string_util_constants.cc
\
src/butil/strings/stringprintf.cc
\
src/butil/strings/sys_string_conversions_posix.cc
\
src/butil/strings/utf_offset_string_conversions.cc
\
src/butil/strings/utf_string_conversion_utils.cc
\
src/butil/strings/utf_string_conversions.cc
\
...
...
@@ -142,11 +149,17 @@ BUTIL_SOURCES = \
ifeq
($(SYSTEM),
Linux)
BUTIL_SOURCES
+=
src/butil/file_util_linux.cc
\
src/butil/threading/platform_thread_linux.cc
src/butil/threading/platform_thread_linux.cc
\
src/butil/strings/sys_string_conversions_posix.cc
endif
ifeq
($(SYSTEM),
Darwin)
BUTIL_SOURCES
+=
src/butil/mac/bundle_locations.mm
\
src/butil/mac/foundation_util.mm
src/butil/mac/foundation_util.mm
\
src/butil/file_util_mac.mm
\
src/butil/threading/platform_thread_mac.mm
\
src/butil/strings/sys_string_conversions_mac.mm
\
src/butil/time/time_mac.cc
\
src/butil/mac/scoped_mach_port.cc
endif
BUTIL_OBJS
=
$
(
addsuffix .o,
$
(
basename
$(BUTIL_SOURCES)
))
...
...
@@ -184,7 +197,7 @@ DEBUG_OBJS = $(OBJS:.o=.dbg.o)
PROTOS
=
$(BRPC_PROTOS)
src/idl_options.proto
.PHONY
:
all
all
:
protoc-gen-mcpack libbrpc.a
libbrpc.so
output/include output/lib output/bin
all
:
protoc-gen-mcpack libbrpc.a
$(TARGET_LIB_DY)
output/include output/lib output/bin
.PHONY
:
debug
debug
:
test/libbrpc.dbg.a test/libbvar.dbg.a
...
...
@@ -192,7 +205,7 @@ debug: test/libbrpc.dbg.a test/libbvar.dbg.a
.PHONY
:
clean
clean
:
@
echo
"Cleaning"
@
rm
-rf
src/mcpack2pb/generator.o protoc-gen-mcpack libbrpc.a
libbrpc.so
$(OBJS)
output/include output/lib output/bin
$
(
PROTOS:.proto
=
.pb.h
)
$
(
PROTOS:.proto
=
.pb.cc
)
@
rm
-rf
src/mcpack2pb/generator.o protoc-gen-mcpack libbrpc.a
$(TARGET_LIB_DY)
$(OBJS)
output/include output/lib output/bin
$
(
PROTOS:.proto
=
.pb.h
)
$
(
PROTOS:.proto
=
.pb.cc
)
.PHONY
:
clean_debug
clean_debug
:
...
...
@@ -202,16 +215,24 @@ clean_debug:
protoc-gen-mcpack
:
src/idl_options.pb.cc src/mcpack2pb/generator.o libbrpc.a
@
echo
"Linking
$@
"
ifeq
($(SYSTEM),Linux)
@$(CXX)
-o
$@
$(HDRPATHS)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
else
ifeq
($(SYSTEM),Darwin)
@$(CXX)
-o
$@
$(HDRPATHS)
$(LIBPATHS)
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
endif
# force generation of pb headers before compiling to avoid fail-to-import issues in compiling pb.cc
libbrpc.a
:
$(BRPC_PROTOS:.proto=.pb.h) $(OBJS)
@
echo
"Packing
$@
"
@
ar crs
$@
$
(
filter %.o,
$^
)
libbrpc.so
:
$(BRPC_PROTOS:.proto=.pb.h) $(OBJS)
$(TARGET_LIB_DY)
:
$(BRPC_PROTOS:.proto=.pb.h) $(OBJS)
@
echo
"Linking
$@
"
ifeq
($(SYSTEM),Linux)
@$(CXX)
-shared
-o
$@
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$(filter
%.o,$^)
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
else
ifeq
($(SYSTEM),Darwin)
@$(CXX)
-dynamiclib
-Wl,-headerpad_max_install_names
-o
$@
-install_name
@rpath/$@
$(LIBPATHS)
$(SOPATHS)
$(filter
%.o,$^)
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
endif
test/libbvar.dbg.a
:
$(BVAR_DEBUG_OBJS)
@
echo
"Packing
$@
"
...
...
@@ -229,7 +250,7 @@ output/include:
@
cp
src/idl_options.proto src/idl_options.pb.h
$@
.PHONY
:
output/lib
output/lib
:
libbrpc.a
libbrpc.so
output/lib
:
libbrpc.a
$(TARGET_LIB_DY)
@
echo
"Copying to
$@
"
@
mkdir
-p
$@
@
cp
$^
$@
...
...
config_brpc.sh
View file @
802f8ca0
SYSTEM
=
$(
uname
-s
)
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
ECHO
=
echo
ECHO
=
'echo -e'
SO
=
dylib
LDD
=
"otool -L"
if
[
"
$(
getopt
-V
)
"
=
" --"
]
;
then
...
...
@@ -47,6 +47,10 @@ if [ -z "$CC" ]; then
fi
CC
=
gcc
CXX
=
g++
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
CC
=
clang
CXX
=
clang++
fi
elif
[
-z
"
$CXX
"
]
;
then
>
&2
$ECHO
"--cc and --cxx must be both set or unset"
exit
1
...
...
@@ -97,11 +101,11 @@ find_bin_or_die() {
}
find_dir_of_header
()
{
find
${
HDRS_IN
}
-path
"*/
$1
"
|
head
-n1
|
sed
"s|
$1
||g"
find
-L
${
HDRS_IN
}
-path
"*/
$1
"
|
head
-n1
|
sed
"s|
$1
||g"
}
find_dir_of_header_excluding
()
{
find
${
HDRS_IN
}
-path
"*/
$1
"
|
grep
-v
"
$2
\$
"
|
head
-n1
|
sed
"s|
$1
||g"
find
-L
${
HDRS_IN
}
-path
"*/
$1
"
|
grep
-v
"
$2
\$
"
|
head
-n1
|
sed
"s|
$1
||g"
}
find_dir_of_header_or_die
()
{
...
...
@@ -122,10 +126,29 @@ find_dir_of_header_or_die() {
OPENSSL_HDR
=
$(
find_dir_of_header_or_die openssl/ssl.h
)
STATIC_LINKINGS
=
DYNAMIC_LINKINGS
=
"-lpthread -lrt -lssl -lcrypto -ldl -lz"
DYNAMIC_LINKINGS
=
"-lpthread -lssl -lcrypto -ldl -lz"
if
[
"
$SYSTEM
"
=
"Linux"
]
;
then
DYNAMIC_LINKINGS+
=
" -lrt"
fi
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
DYNAMIC_LINKINGS+
=
" -framework CoreFoundation"
DYNAMIC_LINKINGS+
=
" -framework CoreGraphics"
DYNAMIC_LINKINGS+
=
" -framework CoreData"
DYNAMIC_LINKINGS+
=
" -framework CoreText"
DYNAMIC_LINKINGS+
=
" -framework Security"
DYNAMIC_LINKINGS+
=
" -framework Foundation"
DYNAMIC_LINKINGS+
=
" -Wl,-U,_MallocExtension_ReleaseFreeMemory"
DYNAMIC_LINKINGS+
=
" -Wl,-U,_ProfilerStart"
DYNAMIC_LINKINGS+
=
" -Wl,-U,_ProfilerStop"
fi
append_linking
()
{
if
[
-f
$1
/lib
${
2
}
.a
]
;
then
STATIC_LINKINGS
=
"
$STATIC_LINKINGS
-l
$2
"
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
# *.a must be explicitly specified in clang
STATIC_LINKINGS
=
"
$STATIC_LINKINGS
$1
/lib
${
2
}
.a"
else
STATIC_LINKINGS
=
"
$STATIC_LINKINGS
-l
$2
"
fi
export
STATICALLY_LINKED_
$2
=
1
else
DYNAMIC_LINKINGS
=
"
$DYNAMIC_LINKINGS
-l
$2
"
...
...
@@ -149,9 +172,17 @@ if [ -f $LEVELDB_LIB/libleveldb.a ]; then
fi
fi
if
[
-z
"
$REQUIRE_SNAPPY
"
]
;
then
STATIC_LINKINGS
=
"
$STATIC_LINKINGS
-lleveldb"
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
STATIC_LINKINGS
=
"
$STATIC_LINKINGS
$LEVELDB_LIB
/libleveldb.a"
else
STATIC_LINKINGS
=
"
$STATIC_LINKINGS
-lleveldb"
fi
elif
[
-f
$SNAPPY_LIB
/libsnappy.a
]
;
then
STATIC_LINKINGS
=
"
$STATIC_LINKINGS
-lleveldb -lsnappy"
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
STATIC_LINKINGS
=
"
$STATIC_LINKINGS
$LEVELDB_LIB
/libleveldb.a
$SNAPPY_LIB
/libsnappy.a"
else
STATIC_LINKINGS
=
"
$STATIC_LINKINGS
-lleveldb -lsnappy"
fi
else
DYNAMIC_LINKINGS
=
"
$DYNAMIC_LINKINGS
-lleveldb"
fi
...
...
@@ -207,11 +238,15 @@ append_to_output_libs() {
# $1: libdir, $2: libname, $3: indentation
append_to_output_linkings
()
{
if
[
-f
$1
/lib
$2
.a
]
;
then
append_to_output_libs
$1
$3
append_to_output
"
${
3
}
STATIC_LINKINGS+=-l
$2
"
append_to_output_libs
$1
$3
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
append_to_output
"
${
3
}
STATIC_LINKINGS+=
$1
/lib
$2
.a"
else
append_to_output
"
${
3
}
STATIC_LINKINGS+=-l
$2
"
fi
export
STATICALLY_LINKED_
$2
=
1
else
append_to_output_libs
$1
$3
append_to_output_libs
$1
$3
append_to_output
"
${
3
}
DYNAMIC_LINKINGS+=-l
$2
"
export
STATICALLY_LINKED_
$2
=
0
fi
...
...
@@ -229,11 +264,16 @@ append_to_output "GCC_VERSION=$GCC_VERSION"
append_to_output
"STATIC_LINKINGS=
$STATIC_LINKINGS
"
append_to_output
"DYNAMIC_LINKINGS=
$DYNAMIC_LINKINGS
"
CPPFLAGS
=
"-DBRPC_WITH_GLOG=
$WITH_GLOG
-DGFLAGS_NS=
$GFLAGS_NS
"
if
[
!
-z
"
$DEBUGSYMBOLS
"
]
;
then
CPPFLAGS
=
"
${
CPPFLAGS
}
$DEBUGSYMBOLS
"
fi
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
CPPFLAGS
=
"
${
CPPFLAGS
}
-Wno-deprecated-declarations"
version
=
`
system_profiler SPSoftwareDataType |
grep
"System Version"
|
awk
'{print $5}'
|
awk
-F
.
'{printf "%d.%d", $1, $2}'
`
if
[[
`
echo
"
$version
<10.12"
| bc
-l
`
==
1
]]
;
then
CPPFLAGS
=
"
${
CPPFLAGS
}
-DNO_CLOCK_GETTIME_IN_MAC"
fi
fi
append_to_output
"CPPFLAGS=
${
CPPFLAGS
}
"
...
...
@@ -245,7 +285,11 @@ else
# libprotobuf and libprotoc must be linked same statically or dynamically
# otherwise the bin will crash.
if
[
$STATICALLY_LINKED_protobuf
-gt
0
]
;
then
append_to_output
" STATIC_LINKINGS+=-lprotoc"
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
append_to_output
" STATIC_LINKINGS+=
$(
find
$PROTOBUF_LIB
-name
"libprotoc.a"
|
head
-n1
)
"
else
append_to_output
" STATIC_LINKINGS+=-lprotoc"
fi
else
append_to_output
" DYNAMIC_LINKINGS+=-lprotoc"
fi
...
...
@@ -264,7 +308,11 @@ else
if
[
-f
$TCMALLOC_LIB
/libtcmalloc.
$SO
]
;
then
append_to_output
" DYNAMIC_LINKINGS+=-ltcmalloc_and_profiler"
else
append_to_output
" STATIC_LINKINGS+=-ltcmalloc_and_profiler"
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
append_to_output
" STATIC_LINKINGS+=
$TCMALLOC_LIB
/libtcmalloc.a"
else
append_to_output
" STATIC_LINKINGS+=-ltcmalloc_and_profiler"
fi
fi
fi
append_to_output
"endif"
...
...
@@ -277,7 +325,11 @@ if [ $WITH_GLOG != 0 ]; then
if
[
-f
"
$GLOG_LIB
/libglog.
$SO
"
]
;
then
append_to_output
"DYNAMIC_LINKINGS+=-lglog"
else
append_to_output
"STATIC_LINKINGS+=-lglog"
if
[
"
$SYSTEM
"
=
"Darwin"
]
;
then
append_to_output
"STATIC_LINKINGS+=
$GLOG_LIB
/libglog.a"
else
append_to_output
"STATIC_LINKINGS+=-lglog"
fi
fi
fi
...
...
example/echo_c++/Makefile
View file @
802f8ca0
...
...
@@ -14,9 +14,7 @@ LIBS+=$(BRPC_PATH)/output/lib
HDRPATHS
=
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
$
(
addprefix
-L
,
$(LIBS)
)
COMMA
=
,
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
=
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
$(COMMA)
,
$(LIBS)
)
CLIENT_SOURCES
=
client.cpp
SERVER_SOURCES
=
server.cpp
...
...
@@ -27,6 +25,21 @@ PROTO_GENS = $(PROTOS:.proto=.pb.h) $(PROTOS:.proto=.pb.cc)
CLIENT_OBJS
=
$
(
addsuffix .o,
$
(
basename
$(CLIENT_SOURCES)
))
SERVER_OBJS
=
$
(
addsuffix .o,
$
(
basename
$(SERVER_SOURCES)
))
ifeq
($(SYSTEM),Darwin)
ifneq
(
"$(LINK_SO)"
,
""
)
STATIC_LINKINGS
+=
-lbrpc
else
# *.a must be explicitly specified in clang
STATIC_LINKINGS
+=
$(BRPC_PATH)
/output/lib/libbrpc.a
endif
LINK_OPTIONS_SO
=
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
LINK_OPTIONS
=
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
else
ifeq
($(SYSTEM),Linux)
STATIC_LINKINGS
+=
lbrpc
LINK_OPTIONS_SO
=
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
LINK_OPTIONS
=
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
endif
.PHONY
:
all
all
:
echo_client echo_server
...
...
@@ -38,17 +51,17 @@ clean:
echo_client
:
$(PROTO_OBJS) $(CLIENT_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS
)
-o
$@
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
$(LINK_OPTIONS_SO
)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKING
S)
-o
$@
@$(CXX)
$(LIBPATHS)
$(LINK_OPTION
S)
-o
$@
endif
echo_server
:
$(PROTO_OBJS) $(SERVER_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS
)
-o
$@
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
$(LINK_OPTIONS_SO
)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKING
S)
-o
$@
@$(CXX)
$(LIBPATHS)
$(LINK_OPTION
S)
-o
$@
endif
%.pb.cc %.pb.h
:
%.proto
...
...
example/http_c++/Makefile
View file @
802f8ca0
...
...
@@ -13,9 +13,7 @@ LIBS+=$(BRPC_PATH)/output/lib
HDRPATHS
=
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
$
(
addprefix
-L
,
$(LIBS)
)
COMMA
=
,
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
=
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
$(COMMA)
,
$(LIBS)
)
CLIENT_SOURCES
=
http_client.cpp
BENCHMARK_SOURCES
=
benchmark_http.cpp
...
...
@@ -28,6 +26,21 @@ CLIENT_OBJS = $(addsuffix .o, $(basename $(CLIENT_SOURCES)))
BENCHMARK_OBJS
=
$
(
addsuffix .o,
$
(
basename
$(BENCHMARK_SOURCES)
))
SERVER_OBJS
=
$
(
addsuffix .o,
$
(
basename
$(SERVER_SOURCES)
))
ifeq
($(SYSTEM),Darwin)
ifneq
(
"$(LINK_SO)"
,
""
)
STATIC_LINKINGS
+=
-lbrpc
else
# *.a must be explicitly specified in clang
STATIC_LINKINGS
+=
$(BRPC_PATH)
/output/lib/libbrpc.a
endif
LINK_OPTIONS_SO
=
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
LINK_OPTIONS
=
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
else
ifeq
($(SYSTEM),Linux)
STATIC_LINKINGS
+=
lbrpc
LINK_OPTIONS_SO
=
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
LINK_OPTIONS
=
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
endif
.PHONY
:
all
all
:
http_client benchmark_http http_server
...
...
@@ -39,25 +52,26 @@ clean:
http_client
:
$(CLIENT_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS
)
-o
$@
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
$(LINK_OPTIONS_SO
)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKING
S)
-o
$@
@$(CXX)
$(LIBPATHS)
$(LINK_OPTION
S)
-o
$@
endif
benchmark_http
:
$(BENCHMARK_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS
)
-o
$@
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
$(LINK_OPTIONS_SO
)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKING
S)
-o
$@
@$(CXX)
$(LIBPATHS)
$(LINK_OPTION
S)
-o
$@
endif
http_server
:
$(PROTO_OBJS) $(SERVER_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
@echo
"@$(CXX) $(LIBPATHS) $(SOPATHS) $(LINK_OPTIONS_SO) -o $@"
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
$(LINK_OPTIONS_SO)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKING
S)
-o
$@
@$(CXX)
$(LIBPATHS)
$(LINK_OPTION
S)
-o
$@
endif
%.pb.cc %.pb.h
:
%.proto
...
...
example/memcache_c++/Makefile
View file @
802f8ca0
...
...
@@ -6,13 +6,26 @@ LIBS+=$(BRPC_PATH)/output/lib
HDRPATHS
=
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
$
(
addprefix
-L
,
$(LIBS)
)
COMMA
=
,
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
=
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
$(COMMA)
,
$(LIBS)
)
SOURCES
=
$
(
wildcard
*
.cpp
)
OBJS
=
$
(
addsuffix .o,
$
(
basename
$(SOURCES)
))
ifeq
($(SYSTEM),Darwin)
ifneq
(
"$(LINK_SO)"
,
""
)
STATIC_LINKINGS
+=
-lbrpc
else
# *.a must be explicitly specified in clang
STATIC_LINKINGS
+=
$(BRPC_PATH)
/output/lib/libbrpc.a
endif
LINK_OPTIONS_SO
=
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
LINK_OPTIONS
=
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
else
ifeq
($(SYSTEM),Linux)
STATIC_LINKINGS
+=
lbrpc
LINK_OPTIONS_SO
=
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
LINK_OPTIONS
=
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
endif
.PHONY
:
all
all
:
memcache_client
...
...
@@ -24,9 +37,9 @@ clean:
memcache_client
:
$(OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS
)
-o
$@
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
$(LINK_OPTIONS_SO
)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKING
S)
-o
$@
@$(CXX)
$(LIBPATHS)
$(LINK_OPTION
S)
-o
$@
endif
%.o
:
%.cpp
...
...
example/multi_threaded_echo_c++/Makefile
View file @
802f8ca0
...
...
@@ -14,9 +14,7 @@ LIBS+=$(BRPC_PATH)/output/lib
HDRPATHS
=
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
$
(
addprefix
-L
,
$(LIBS)
)
COMMA
=
,
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
=
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
$(COMMA)
,
$(LIBS)
)
CLIENT_SOURCES
=
client.cpp
SERVER_SOURCES
=
server.cpp
...
...
@@ -27,6 +25,21 @@ PROTO_GENS = $(PROTOS:.proto=.pb.h) $(PROTOS:.proto=.pb.cc)
CLIENT_OBJS
=
$
(
addsuffix .o,
$
(
basename
$(CLIENT_SOURCES)
))
SERVER_OBJS
=
$
(
addsuffix .o,
$
(
basename
$(SERVER_SOURCES)
))
ifeq
($(SYSTEM),Darwin)
ifneq
(
"$(LINK_SO)"
,
""
)
STATIC_LINKINGS
+=
-lbrpc
else
# *.a must be explicitly specified in clang
STATIC_LINKINGS
+=
$(BRPC_PATH)
/output/lib/libbrpc.a
endif
LINK_OPTIONS_SO
=
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
LINK_OPTIONS
=
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
else
ifeq
($(SYSTEM),Linux)
STATIC_LINKINGS
+=
lbrpc
LINK_OPTIONS_SO
=
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
LINK_OPTIONS
=
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
endif
.PHONY
:
all
all
:
echo_client echo_server
...
...
@@ -38,17 +51,17 @@ clean:
echo_client
:
$(PROTO_OBJS) $(CLIENT_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS
)
-o
$@
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
$(LINK_OPTIONS_SO
)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKING
S)
-o
$@
@$(CXX)
$(LIBPATHS)
$(LINK_OPTION
S)
-o
$@
endif
echo_server
:
$(PROTO_OBJS) $(SERVER_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS
)
-o
$@
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
$(LINK_OPTIONS_SO
)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKING
S)
-o
$@
@$(CXX)
$(LIBPATHS)
$(LINK_OPTION
S)
-o
$@
endif
%.pb.cc %.pb.h
:
%.proto
...
...
example/redis_c++/Makefile
View file @
802f8ca0
...
...
@@ -6,17 +6,30 @@ LIBS+=$(BRPC_PATH)/output/lib
HDRPATHS
=
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
$
(
addprefix
-L
,
$(LIBS)
)
COMMA
=
,
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
=
,
$(LIBS)
)
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
$(COMMA)
,
$(LIBS)
)
DYNAMIC_LINKINGS
+=
-lreadline
-lncurses
STATIC_LINKINGS
+=
-lbrpc
PRESS_SOURCES
=
redis_press.cpp
CLI_SOURCES
=
redis_cli.cpp
PRESS_OBJS
=
$
(
addsuffix .o,
$
(
basename
$(PRESS_SOURCES)
))
CLI_OBJS
=
$
(
addsuffix .o,
$
(
basename
$(CLI_SOURCES)
))
ifeq
($(SYSTEM),Darwin)
ifneq
(
"$(LINK_SO)"
,
""
)
STATIC_LINKINGS
+=
-lbrpc
else
# *.a must be explicitly specified in clang
STATIC_LINKINGS
+=
$(BRPC_PATH)
/output/lib/libbrpc.a
endif
LINK_OPTIONS_SO
=
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
LINK_OPTIONS
=
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
else
ifeq
($(SYSTEM),Linux)
STATIC_LINKINGS
+=
lbrpc
LINK_OPTIONS_SO
=
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
LINK_OPTIONS
=
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
endif
.PHONY
:
all
all
:
redis_press redis_cli
...
...
@@ -28,17 +41,17 @@ clean:
redis_press
:
$(PRESS_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS
)
-o
$@
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
$(LINK_OPTIONS_SO
)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKING
S)
-o
$@
@$(CXX)
$(LIBPATHS)
$(LINK_OPTION
S)
-o
$@
endif
redis_cli
:
$(CLI_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS
)
-o
$@
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
$(LINK_OPTIONS_SO
)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKING
S)
-o
$@
@$(CXX)
$(LIBPATHS)
$(LINK_OPTION
S)
-o
$@
endif
%.o
:
%.cpp
...
...
test/Makefile
View file @
802f8ca0
...
...
@@ -9,8 +9,10 @@ ifeq ($(shell test $(GCC_VERSION) -ge 40400; echo $$?),0)
CXXFLAGS
+=
-msse4
-msse4
.2
endif
#not solved yet
ifeq
($(shell
test
$(GCC_VERSION)
-ge
70000;
echo
$$?),0)
ifeq
($(CC),gcc)
ifeq
($(shell
test
$(GCC_VERSION)
-ge
70000;
echo
$$?),0)
CXXFLAGS
+=
-Wno-aligned-new
endif
endif
HDRPATHS
=
-I
.
-I
../src
$
(
addprefix
-I
,
$(HDRS)
)
...
...
@@ -118,6 +120,14 @@ ifeq ($(SYSTEM), Linux)
proc_maps_linux_unittest.cc
endif
# bthread_* functions are used in logging.cc, and they need to be marked as
# weak symbols explicitly in Darwin system.
ifeq
($(SYSTEM),
Darwin)
DYNAMIC_LINKINGS
+=
-Wl
,-U,_bthread_getspecific
DYNAMIC_LINKINGS
+=
-Wl
,-U,_bthread_setspecific
DYNAMIC_LINKINGS
+=
-Wl
,-U,_bthread_key_create
endif
TEST_BUTIL_OBJS
=
iobuf.pb.o
$
(
addsuffix .o,
$
(
basename
$(TEST_BUTIL_SOURCES)
))
TEST_BVAR_SOURCES
=
$
(
wildcard bvar_
*
_unittest.cpp
)
...
...
@@ -156,19 +166,35 @@ FORCE:
test_butil
:
libbrpc.dbg.a $(TEST_BUTIL_OBJS)
@
echo
"Linking
$@
"
ifeq
($(SYSTEM),Linux)
@$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
else
ifeq
($(SYSTEM),Darwin)
@$(CXX)
-o
$@
$(LIBPATHS)
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
endif
test_bvar
:
libbrpc.dbg.a $(TEST_BVAR_OBJS)
@
echo
"Linking
$@
"
ifeq
($(SYSTEM),Linux)
@$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$(TEST_BVAR_OBJS)
libbvar.dbg.a
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
else
ifeq
($(SYSTEM),Darwin)
@$(CXX)
-o
$@
$(LIBPATHS)
$(TEST_BVAR_OBJS)
libbvar.dbg.a
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
endif
bthread%unittest
:
libbrpc.dbg.a bthread%unittest.o
@
echo
"Linking
$@
"
ifeq
($(SYSTEM),Linux)
@$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
else
ifeq
($(SYSTEM),Darwin)
@$(CXX)
-o
$@
$(LIBPATHS)
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
endif
brpc_%_unittest
:
libbrpc.dbg.a $(TEST_PROTO_OBJS) brpc_%_unittest.o
@
echo
"Linking
$@
"
ifeq
($(SYSTEM),Linux)
@$(CXX)
-o
$@
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
else
ifeq
($(SYSTEM),Darwin)
@$(CXX)
-o
$@
$(LIBPATHS)
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
endif
%.pb.cc %.pb.h
:
%.proto
@
echo
"Generating
$@
"
...
...
tools/parallel_http/Makefile
View file @
802f8ca0
...
...
@@ -3,7 +3,7 @@ include $(BRPC_PATH)/config.mk
CXXFLAGS
=
$(CPPFLAGS)
-std
=
c++0x
-DNDEBUG
-O2
-D__const__
=
-pipe
-W
-Wall
-fPIC
-fno-omit-frame-pointer
-Wno-unused-parameter
HDRPATHS
=
-I
$(BRPC_PATH)
/output/include
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
-L
$(BRPC_PATH)
/output/lib
$
(
addprefix
-L
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
STATIC_LINKINGS
+=
$(BRPC_PATH)
/output/lib/libbrpc.a
SOURCES
=
$
(
wildcard
*
.cpp
)
OBJS
=
$
(
addsuffix .o,
$
(
basename
$(SOURCES)
))
...
...
@@ -18,7 +18,11 @@ clean:
parallel_http
:
$(OBJS)
@
echo
"Linking
$@
"
ifeq
($(SYSTEM),Linux)
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
else
ifeq
($(SYSTEM),Darwin)
@$(CXX)
$(LIBPATHS)
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
endif
%.o
:
%.cpp
@
echo
"Compiling
$@
"
...
...
tools/rpc_press/Makefile
View file @
802f8ca0
...
...
@@ -3,7 +3,7 @@ include $(BRPC_PATH)/config.mk
CXXFLAGS
=
$(CPPFLAGS)
-std
=
c++0x
-DNDEBUG
-O2
-D__const__
=
-pipe
-W
-Wall
-fPIC
-fno-omit-frame-pointer
-Wno-unused-parameter
HDRPATHS
=
-I
$(BRPC_PATH)
/output/include
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
-L
$(BRPC_PATH)
/output/lib
$
(
addprefix
-L
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
STATIC_LINKINGS
+=
$(BRPC_PATH)
/output/lib/libbrpc.a
SOURCES
=
$
(
wildcard
*
.cpp
)
OBJS
=
$
(
addsuffix .o,
$
(
basename
$(SOURCES)
))
...
...
@@ -18,7 +18,11 @@ clean:
rpc_press
:
$(OBJS)
@
echo
"Linking
$@
"
ifeq
($(SYSTEM),Linux)
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
else
ifeq
($(SYSTEM),Darwin)
@$(CXX)
$(LIBPATHS)
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
endif
%.o
:
%.cpp
@
echo
"Compiling
$@
"
...
...
tools/rpc_replay/Makefile
View file @
802f8ca0
...
...
@@ -3,7 +3,7 @@ include $(BRPC_PATH)/config.mk
CXXFLAGS
=
$(CPPFLAGS)
-std
=
c++0x
-DNDEBUG
-O2
-D__const__
=
-pipe
-W
-Wall
-fPIC
-fno-omit-frame-pointer
-Wno-unused-parameter
HDRPATHS
=
-I
$(BRPC_PATH)
/output/include
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
-L
$(BRPC_PATH)
/output/lib
$
(
addprefix
-L
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
STATIC_LINKINGS
+=
$(BRPC_PATH)
/output/lib/libbrpc.a
SOURCES
=
$
(
wildcard
*
.cpp
)
OBJS
=
$
(
addsuffix .o,
$
(
basename
$(SOURCES)
))
...
...
@@ -18,7 +18,11 @@ clean:
rpc_replay
:
$(OBJS)
@
echo
"Linking
$@
"
ifeq
($(SYSTEM),Linux)
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
else
ifeq
($(SYSTEM),Darwin)
@$(CXX)
$(LIBPATHS)
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
endif
%.o
:
%.cpp
@
echo
"Compiling
$@
"
...
...
tools/rpc_view/Makefile
View file @
802f8ca0
...
...
@@ -6,7 +6,7 @@ include $(BRPC_PATH)/config.mk
CXXFLAGS
=
$(CPPFLAGS)
-std
=
c++0x
-DNDEBUG
-O2
-D__const__
=
-pipe
-W
-Wall
-Wno-unused-parameter
-fPIC
-fno-omit-frame-pointer
HDRPATHS
=
-I
$(BRPC_PATH)
/output/include
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
-L
$(BRPC_PATH)
/output/lib
$
(
addprefix
-L
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
STATIC_LINKINGS
+=
$(BRPC_PATH)
/output/lib/libbrpc.a
CLIENT_SOURCES
=
rpc_view.cpp
PROTOS
=
$
(
wildcard
*
.proto
)
...
...
@@ -25,7 +25,11 @@ clean:
rpc_view
:
$(PROTO_OBJS) $(CLIENT_OBJS)
@
echo
"Linking
$@
"
ifeq
($(SYSTEM),Linux)
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
else
ifeq
($(SYSTEM),Darwin)
@$(CXX)
$(LIBPATHS)
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
endif
%.pb.cc %.pb.h
:
%.proto
@
echo
"Generating
$@
"
...
...
tools/trackme_server/Makefile
View file @
802f8ca0
...
...
@@ -3,7 +3,7 @@ include $(BRPC_PATH)/config.mk
CXXFLAGS
=
$(CPPFLAGS)
-std
=
c++0x
-DNDEBUG
-O2
-D__const__
=
-pipe
-W
-Wall
-fPIC
-fno-omit-frame-pointer
HDRPATHS
=
-I
$(BRPC_PATH)
/output/include
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
-L
$(BRPC_PATH)
/output/lib
$
(
addprefix
-L
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
STATIC_LINKINGS
+=
$(BRPC_PATH)
/output/lib/libbrpc.a
SOURCES
=
$
(
wildcard
*
.cpp
)
OBJS
=
$
(
addsuffix .o,
$
(
basename
$(SOURCES)
))
...
...
@@ -18,7 +18,11 @@ clean:
trackme_server
:
$(OBJS)
@
echo
"Linking
$@
"
ifeq
($(SYSTEM),Linux)
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
else
ifeq
($(SYSTEM),Darwin)
@$(CXX)
$(LIBPATHS)
$^
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
endif
%.o
:
%.cpp
@
echo
"Compiling
$@
"
...
...
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