blob: 6ee661bee3debdbe8af790f114572f26ec431db8 [file] [log] [blame]
Shad Ansari19249582018-04-30 04:31:00 +00001# 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
15HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
16SYSTEM ?= $(HOST_SYSTEM)
Craig Lutgenf040dba2018-09-27 11:21:43 -050017CXX ?= g++
18#powerpc64-fsl-linux-g++
Shad Ansari19249582018-04-30 04:31:00 +000019CPPFLAGS += `pkg-config --cflags protobuf grpc` -I googleapis/gens
20CXXFLAGS += -std=c++11
Shad Ansari563ea822018-06-28 14:56:27 +000021#LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc` -ldl
Shad Ansari19249582018-04-30 04:31:00 +000022PROTOC = protoc
23GRPC_CPP_PLUGIN = grpc_cpp_plugin
24GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
25
Girish Gowdruc8ed2ef2019-02-13 08:18:44 -080026OBJS = tech_profile.pb.o tech_profile.grpc.pb.o 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
Shad Ansari19249582018-04-30 04:31:00 +000027
28all: googleapis libopenoltapi.a
29
30libopenoltapi.a: $(OBJS)
Jason Huangd33b4d82019-05-15 18:22:57 +080031 ar cr $@ $^
Shad Ansari19249582018-04-30 04:31:00 +000032 ranlib $@
33
34googleapis:
35 if [ ! -e "googleapis" ]; then \
nick6fa80732018-05-22 14:47:10 -040036 git clone https://github.com/googleapis/googleapis.git; \
Nicolas Palpacuer59f72ba2018-07-16 15:16:18 -040037 cd googleapis; \
38 git checkout 475d72b7405c92f06d7f2d4aba866278eb5ad8e9; \
39 cd ..; \
Craig Lutgenf040dba2018-09-27 11:21:43 -050040 make -C googleapis LANGUAGE=cpp GRPCPLUGIN=$(GRPC_CPP_PLUGIN_PATH) all; \
Shad Ansari19249582018-04-30 04:31:00 +000041 fi;
42
43.PRECIOUS: %.grpc.pb.cc
44%.grpc.pb.cc: %.proto
45 $(PROTOC) --proto_path=. -I./googleapis --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
46
47.PRECIOUS: %.pb.cc
48%.pb.cc: %.proto
49 $(PROTOC) --proto_path=. -I./googleapis --cpp_out=. $<
50
51clean:
52 rm -f *.o *.pb.cc *.pb.h *.a
53
54distclean: clean
55 rm -rf googleapis