aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/cpp/route_guide/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cpp/route_guide/Makefile')
-rw-r--r--examples/cpp/route_guide/Makefile8
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/cpp/route_guide/Makefile b/examples/cpp/route_guide/Makefile
index 482c87cce0..ba5e45c05c 100644
--- a/examples/cpp/route_guide/Makefile
+++ b/examples/cpp/route_guide/Makefile
@@ -29,12 +29,20 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
+SYSTEM ?= $(HOST_SYSTEM)
CXX = g++
CPPFLAGS += -I/usr/local/include -pthread
CXXFLAGS += -std=c++11
+ifeq ($(SYSTEM),Darwin)
LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++` \
-lgrpc++_reflection \
-lprotobuf -lpthread -ldl
+else
+LDFLAGS += -L/usr/local/lib `pkg-config --libs grpc++` \
+ -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed \
+ -lprotobuf -lpthread -ldl
+endif
PROTOC = protoc
GRPC_CPP_PLUGIN = grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`