Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 1 | # Copyright (c) 2018 Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at: |
| 6 | # |
| 7 | # http:#www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | HOST_SYSTEM = $(shell uname | cut -f 1 -d_) |
| 16 | SYSTEM ?= $(HOST_SYSTEM) |
| 17 | CXX = g++ |
| 18 | CPPFLAGS += `pkg-config --cflags protobuf grpc` -I googleapis/gens |
| 19 | CXXFLAGS += -std=c++11 |
Shad Ansari | 563ea82 | 2018-06-28 14:56:27 +0000 | [diff] [blame] | 20 | #LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc` -ldl |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 21 | PROTOC = protoc |
| 22 | GRPC_CPP_PLUGIN = grpc_cpp_plugin |
| 23 | GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)` |
| 24 | |
| 25 | OBJS = openolt.pb.o openolt.grpc.pb.o ./googleapis/gens/google/api/annotations.grpc.pb.o ./googleapis/gens/google/api/annotations.pb.o ./googleapis/gens/google/api/http.pb.o |
| 26 | |
| 27 | all: googleapis libopenoltapi.a |
| 28 | |
| 29 | libopenoltapi.a: $(OBJS) |
| 30 | ar ru $@ $^ |
| 31 | ranlib $@ |
| 32 | |
| 33 | googleapis: |
| 34 | if [ ! -e "googleapis" ]; then \ |
nick | 6fa8073 | 2018-05-22 14:47:10 -0400 | [diff] [blame] | 35 | git clone https://github.com/googleapis/googleapis.git; \ |
Nicolas Palpacuer | 59f72ba | 2018-07-16 15:16:18 -0400 | [diff] [blame] | 36 | cd googleapis; \ |
| 37 | git checkout 475d72b7405c92f06d7f2d4aba866278eb5ad8e9; \ |
| 38 | cd ..; \ |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 39 | make -C googleapis LANGUAGE=cpp all; \ |
| 40 | fi; |
| 41 | |
| 42 | .PRECIOUS: %.grpc.pb.cc |
| 43 | %.grpc.pb.cc: %.proto |
| 44 | $(PROTOC) --proto_path=. -I./googleapis --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $< |
| 45 | |
| 46 | .PRECIOUS: %.pb.cc |
| 47 | %.pb.cc: %.proto |
| 48 | $(PROTOC) --proto_path=. -I./googleapis --cpp_out=. $< |
| 49 | |
| 50 | clean: |
| 51 | rm -f *.o *.pb.cc *.pb.h *.a |
| 52 | |
| 53 | distclean: clean |
| 54 | rm -rf googleapis |