-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
36 lines (25 loc) · 805 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
LDFLAGS = -L$(HOME)/.local/lib `pkg-config --libs protobuf grpc++`\
-Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed\
-ldl
CXX = g++
CPPFLAGS += `pkg-config --cflags protobuf grpc`
CXXFLAGS += -std=c++11
GRPC_CPP_PLUGIN = grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
# idk if necesarry
export PKG_CONFIG_PATH=$(HOME)/.local/lib/pkgconfig/
all: client server
client: service.pb.o service.grpc.pb.o client.o
$(CXX) $^ $(LDFLAGS) -o $@
server: service.pb.o service.grpc.pb.o server.o
$(CXX) $^ $(LDFLAGS) -o $@
rserver: server
./server
rclient: client
./client
%.grpc.pb.cc: %.proto
protoc --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
%.pb.cc: %.proto
protoc --cpp_out=. $<
clean:
rm -f *.o *.pb.cc *.pb.h client server