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
b9e6314c
Commit
b9e6314c
authored
Sep 11, 2017
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Examples can link with libbrpc.so
Change-Id: I7ac6b4842ae992f95492ef40f7d32ce541026c06
parent
eaea0017
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
11 deletions
+77
-11
Makefile
example/echo_c++/Makefile
+15
-2
Makefile
example/http_c++/Makefile
+19
-2
Makefile
example/memcache_c++/Makefile
+11
-2
Makefile
example/multi_threaded_echo_c++/Makefile
+17
-3
Makefile
example/redis_c++/Makefile
+15
-2
No files found.
example/echo_c++/Makefile
View file @
b9e6314c
...
...
@@ -4,8 +4,13 @@ include $(BRPC_PATH)/config.mk
# 1. Added -fno-omit-frame-pointer: perf/tcmalloc-profiler use frame pointers by default
# 2. Added -D__const__= : Avoid over-optimizations of TLS variables by GCC>=4.8
CXXFLAGS
=
-std
=
c++0x
-g
-DNDEBUG
-O2
-D__const__
=
-pipe
-W
-Wall
-Werror
-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)
)
HDRS
+=
$(BRPC_PATH)
/output/include
LIBS
+=
$(BRPC_PATH)
/output/lib
HDRPATHS
=
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
$
(
addprefix
-L
,
$(LIBS)
)
COMMA
=
,
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
=
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
CLIENT_SOURCES
=
client.cpp
...
...
@@ -27,11 +32,19 @@ clean:
echo_client
:
$(PROTO_OBJS) $(CLIENT_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
endif
echo_server
:
$(PROTO_OBJS) $(SERVER_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
endif
%.pb.cc %.pb.h
:
%.proto
@
echo
"Generating
$@
"
...
...
example/http_c++/Makefile
View file @
b9e6314c
...
...
@@ -8,8 +8,13 @@ CXXFLAGS = -std=c++0x -g -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Werror -Wno-u
ifeq
($(NEED_GPERFTOOLS),
1)
CXXFLAGS
+=
-DBRPC_ENABLE_CPU_PROFILER
-DBRPC_ENABLE_HEAP_PROFILER
endif
HDRPATHS
=
-I
$(BRPC_PATH)
/output/include
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
-L
$(BRPC_PATH)
/output/lib
$
(
addprefix
-L
,
$(LIBS)
)
HDRS
+=
$(BRPC_PATH)
/output/include
LIBS
+=
$(BRPC_PATH)
/output/lib
HDRPATHS
=
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
$
(
addprefix
-L
,
$(LIBS)
)
COMMA
=
,
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
=
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
CLIENT_SOURCES
=
http_client.cpp
...
...
@@ -33,15 +38,27 @@ clean:
http_client
:
$(CLIENT_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
endif
benchmark_http
:
$(BENCHMARK_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
endif
http_server
:
$(PROTO_OBJS) $(SERVER_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
endif
%.pb.cc %.pb.h
:
%.proto
@
echo
"Generating
$@
"
...
...
example/memcache_c++/Makefile
View file @
b9e6314c
BRPC_PATH
=
../../
include
$(BRPC_PATH)/config.mk
CXXFLAGS
=
-std
=
c++0x
-g
-DNDEBUG
-O2
-D__const__
=
-pipe
-W
-Wall
-Werror
-fPIC
-fno-omit-frame-pointer
HDRPATHS
=
-I
$(BRPC_PATH)
/output/include
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
-L
$(BRPC_PATH)
/output/lib
$
(
addprefix
-L
,
$(LIBS)
)
HDRS
+=
$(BRPC_PATH)
/output/include
LIBS
+=
$(BRPC_PATH)
/output/lib
HDRPATHS
=
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
$
(
addprefix
-L
,
$(LIBS)
)
COMMA
=
,
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
=
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
SOURCES
=
$
(
wildcard
*
.cpp
)
...
...
@@ -18,7 +23,11 @@ clean:
memcache_client
:
$(OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
endif
%.o
:
%.cpp
@
echo
"Compiling
$@
"
...
...
example/multi_threaded_echo_c++/Makefile
View file @
b9e6314c
...
...
@@ -8,8 +8,14 @@ CXXFLAGS = -std=c++0x -g -DNDEBUG -O2 -D__const__= -pipe -W -Wall -Werror -Wno-u
ifeq
($(NEED_GPERFTOOLS),
1)
CXXFLAGS
+=
-DBRPC_ENABLE_CPU_PROFILER
-DBRPC_ENABLE_HEAP_PROFILER
endif
HDRPATHS
=
-I
$(BRPC_PATH)
/output/include
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
-L
$(BRPC_PATH)
/output/lib
$
(
addprefix
-L
,
$(LIBS)
)
HDRS
+=
$(BRPC_PATH)
/output/include
LIBS
+=
$(BRPC_PATH)
/output/lib
HDRPATHS
=
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
$
(
addprefix
-L
,
$(LIBS)
)
COMMA
=
,
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
=
,
$(LIBS)
)
STATIC_LINKINGS
+=
-lbrpc
CLIENT_SOURCES
=
client.cpp
...
...
@@ -31,11 +37,19 @@ clean:
echo_client
:
$(PROTO_OBJS) $(CLIENT_OBJS)
@
echo
"Linking
$@
"
$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl
,-Bstatic
$(STATIC_LINKINGS)
-Wl
,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
endif
echo_server
:
$(PROTO_OBJS) $(SERVER_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
endif
%.pb.cc %.pb.h
:
%.proto
@
echo
"Generating
$@
"
...
...
example/redis_c++/Makefile
View file @
b9e6314c
BRPC_PATH
=
../../
include
$(BRPC_PATH)/config.mk
CXXFLAGS
=
-std
=
c++0x
-g
-DNDEBUG
-O2
-D__const__
=
-pipe
-W
-Wall
-Werror
-fPIC
-fno-omit-frame-pointer
HDRPATHS
=
-I
$(BRPC_PATH)
/output/include
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
-L
$(BRPC_PATH)
/output/lib
$
(
addprefix
-L
,
$(LIBS)
)
HDRS
+=
$(BRPC_PATH)
/output/include
LIBS
+=
$(BRPC_PATH)
/output/lib
HDRPATHS
=
$
(
addprefix
-I
,
$(HDRS)
)
LIBPATHS
=
$
(
addprefix
-L
,
$(LIBS)
)
COMMA
=
,
SOPATHS
=
$
(
addprefix
-Wl
$(COMMA)
-rpath
=
,
$(LIBS)
)
DYNAMIC_LINKINGS
+=
-lreadline
-lncurses
STATIC_LINKINGS
+=
-lbrpc
...
...
@@ -22,11 +27,19 @@ clean:
redis_press
:
$(PRESS_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(DYNAMIC_LINKINGS)
-o
$@
endif
redis_cli
:
$(CLI_OBJS)
@
echo
"Linking
$@
"
ifneq
(
"$(LINK_SO)"
,
""
)
@$(CXX)
$(LIBPATHS)
$(SOPATHS)
-Xlinker
"-("
$^
-Xlinker
"-)"
$(STATIC_LINKINGS)
$(DYNAMIC_LINKINGS)
-o
$@
else
@$(CXX)
$(LIBPATHS)
-Xlinker
"-("
$^
-Wl,-Bstatic
$(STATIC_LINKINGS)
-Wl,-Bdynamic
-Xlinker
"-)"
$(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