Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: third_party/grpc/examples/cpp/helloworld/Makefile

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #
2 # Copyright 2015-2016, Google Inc.
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
8 #
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following disclaimer
13 # in the documentation and/or other materials provided with the
14 # distribution.
15 # * Neither the name of Google Inc. nor the names of its
16 # contributors may be used to endorse or promote products derived from
17 # this software without specific prior written permission.
18 #
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #
31
32 CXX = g++
33 CPPFLAGS += -I/usr/local/include -pthread
34 CXXFLAGS += -std=c++11
35 LDFLAGS += -L/usr/local/lib -lgrpc++_unsecure -lgrpc -lprotobuf -lpthread -ldl
36 PROTOC = protoc
37 GRPC_CPP_PLUGIN = grpc_cpp_plugin
38 GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
39
40 PROTOS_PATH = ../../protos
41
42 vpath %.proto $(PROTOS_PATH)
43
44 all: system-check greeter_client greeter_server greeter_async_client greeter_asy nc_server
45
46 greeter_client: helloworld.pb.o helloworld.grpc.pb.o greeter_client.o
47 $(CXX) $^ $(LDFLAGS) -o $@
48
49 greeter_server: helloworld.pb.o helloworld.grpc.pb.o greeter_server.o
50 $(CXX) $^ $(LDFLAGS) -o $@
51
52 greeter_async_client: helloworld.pb.o helloworld.grpc.pb.o greeter_async_client. o
53 $(CXX) $^ $(LDFLAGS) -o $@
54
55 greeter_async_server: helloworld.pb.o helloworld.grpc.pb.o greeter_async_server. o
56 $(CXX) $^ $(LDFLAGS) -o $@
57
58 .PRECIOUS: %.grpc.pb.cc
59 %.grpc.pb.cc: %.proto
60 $(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC _CPP_PLUGIN_PATH) $<
61
62 .PRECIOUS: %.pb.cc
63 %.pb.cc: %.proto
64 $(PROTOC) -I $(PROTOS_PATH) --cpp_out=. $<
65
66 clean:
67 rm -f *.o *.pb.cc *.pb.h greeter_client greeter_server greeter_async_cli ent greeter_async_server
68
69
70 # The following is to test your system and ensure a smoother experience.
71 # They are by no means necessary to actually compile a grpc-enabled software.
72
73 PROTOC_CMD = which $(PROTOC)
74 PROTOC_CHECK_CMD = $(PROTOC) --version | grep -q libprotoc.3
75 PLUGIN_CHECK_CMD = which $(GRPC_CPP_PLUGIN)
76 HAS_PROTOC = $(shell $(PROTOC_CMD) > /dev/null && echo true || echo false)
77 ifeq ($(HAS_PROTOC),true)
78 HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false)
79 endif
80 HAS_PLUGIN = $(shell $(PLUGIN_CHECK_CMD) > /dev/null && echo true || echo false)
81
82 SYSTEM_OK = false
83 ifeq ($(HAS_VALID_PROTOC),true)
84 ifeq ($(HAS_PLUGIN),true)
85 SYSTEM_OK = true
86 endif
87 endif
88
89 system-check:
90 ifneq ($(HAS_VALID_PROTOC),true)
91 @echo " DEPENDENCY ERROR"
92 @echo
93 @echo "You don't have protoc 3.0.0 installed in your path."
94 @echo "Please install Google protocol buffers 3.0.0 and its compiler."
95 @echo "You can find it here:"
96 @echo
97 @echo " https://github.com/google/protobuf/releases/tag/v3.0.0-beta-2"
98 @echo
99 @echo "Here is what I get when trying to evaluate your version of protoc :"
100 @echo
101 -$(PROTOC) --version
102 @echo
103 @echo
104 endif
105 ifneq ($(HAS_PLUGIN),true)
106 @echo " DEPENDENCY ERROR"
107 @echo
108 @echo "You don't have the grpc c++ protobuf plugin installed in your pat h."
109 @echo "Please install grpc. You can find it here:"
110 @echo
111 @echo " https://github.com/grpc/grpc"
112 @echo
113 @echo "Here is what I get when trying to detect if you have the plugin:"
114 @echo
115 -which $(GRPC_CPP_PLUGIN)
116 @echo
117 @echo
118 endif
119 ifneq ($(SYSTEM_OK),true)
120 @false
121 endif
OLDNEW
« no previous file with comments | « third_party/grpc/examples/cpp/cpptutorial.md ('k') | third_party/grpc/examples/cpp/helloworld/README.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698