blob: 514dd3cb04249df79ff28d81e5eca8d723abda12 [file] [log] [blame]
Girish Gowdraa707e7c2019-11-07 11:36:13 +05301#Copyright 2018-present Open Networking Foundation
Shad Ansari01b0e652018-04-05 21:02:53 +00002#
Girish Gowdraa707e7c2019-11-07 11:36:13 +05303#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
Shad Ansari01b0e652018-04-05 21:02:53 +00006#
Girish Gowdraa707e7c2019-11-07 11:36:13 +05307#http://www.apache.org/licenses/LICENSE-2.0
Shad Ansari01b0e652018-04-05 21:02:53 +00008#
Girish Gowdraa707e7c2019-11-07 11:36:13 +05309#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.
Shad Ansari01b0e652018-04-05 21:02:53 +000014
15########################################################################
16##
17##
Luca Pretee75aaa52018-04-13 12:19:12 -070018## Config
Shad Ansari01b0e652018-04-05 21:02:53 +000019##
20##
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000021TOP_DIR=`pwd`
Shad Ansari9acc9732018-10-30 18:01:44 +000022OPENOLTDEVICE ?= generic
Craig Lutgen88a22ad2018-10-04 12:30:46 -050023
Shad Ansari01b0e652018-04-05 21:02:53 +000024#
25# Three vendor proprietary source files are required to build BAL.
26# SW-BCM68620_<VER>.zip - Broadcom BAL source and Maple SDK.
27# sdk-all-<SDK_VER>.tar.gz - Broadcom Qumran SDK.
Craig Lutgenf040dba2018-09-27 11:21:43 -050028# ACCTON_BAL_<BAL_VER>-<DEV_VER>.patch - Accton/Edgecore's patch.
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000029BAL_MAJOR_VER = 3
Jason Huang09b73ea2020-01-08 17:52:05 +080030BAL_MINOR_VER = 2
31BAL_REV_A_VER = 3
32BAL_REV_B_VER = 2
33BAL_API_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER).$(BAL_REV_B_VER)
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000034BAL_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER).$(BAL_REV_B_VER)
35SDK_VER = 6.5.13
Jason Huang09b73ea2020-01-08 17:52:05 +080036DEV_VER ?= 201912230101
Shad Ansari01b0e652018-04-05 21:02:53 +000037#
38# Version of Open Network Linux (ONL).
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000039ONL_KERN_VER_MAJOR = 4.14
40
41# OpenOLT Proto version.
42# This specifies the GIT tag in https://github.com/opencord/voltha-protos
43# repo that we need to refer to, to pick the right version of
44# openolt.proto and tech_profile.proto
Burak Gurdagc78b9e12019-11-29 11:14:51 +000045OPENOLT_PROTO_VER ?= v3.1.0
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000046
Shad Ansari01b0e652018-04-05 21:02:53 +000047#
48# Build directory
49BUILD_DIR = build
Girish Gowdraddf9a162020-01-27 12:56:27 +053050
51# Protobuf installation
52PROTOBUF_VER = 3.5.0
53PROTOBUF_ADDR = https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOBUF_VER)/protobuf-cpp-$(PROTOBUF_VER).tar.gz
54PROTOBUF_DST = /tmp/protobuf-$(PROTOBUF_VER)
55protoc-bin = $(HOME)/openolt-agent-test-lib/grpc/$(GRPC_VER)/bin/protoc
56
Luca Pretee75aaa52018-04-13 12:19:12 -070057#
58# GRPC installation
59GRPC_ADDR = https://github.com/grpc/grpc
60GRPC_DST = /tmp/grpc
61GRPC_VER = v1.10.x
Girish Gowdraddf9a162020-01-27 12:56:27 +053062grpc-cpp-plugin-bin = $(HOME)/openolt-agent-test-lib/grpc/$(GRPC_VER)/bin/grpc_cpp_plugin
Shad Ansari2cddc552018-06-26 20:34:27 +000063
64USER := $(shell echo $(USER))
Luca Pretee75aaa52018-04-13 12:19:12 -070065#
Shad Ansari01b0e652018-04-05 21:02:53 +000066########################################################################
67##
68##
Luca Prete08e6f802018-04-17 11:49:45 -070069## Install prerequisites
Shad Ansari01b0e652018-04-05 21:02:53 +000070##
71##
72HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
73SYSTEM ?= $(HOST_SYSTEM)
Luca Pretee75aaa52018-04-13 12:19:12 -070074
Humera Kouser5ac56612019-07-25 20:23:01 -040075VERSION ?= $(shell cat ../VERSION)
76
77#set ref and commit date only if committed
78LABEL_VCS_URL ?= $(shell git remote get-url $(shell git remote))
79LABEL_VCS_REF = $(shell git rev-parse HEAD)
80LABEL_BUILD_DATE ?= $(shell date -u "+%Y-%m-%dT%H:%M:%SZ")
81LABEL_COMMIT_DATE = $(shell git show -s --format=%cd --date=iso-strict HEAD)
82
Craig Lutgenf040dba2018-09-27 11:21:43 -050083LIBGRPC_PATH=$(shell pkg-config --libs-only-L grpc | sed s/-L// | sed s/\ //g)
84LIBPROTOBUF_PATH=$(shell PKG_CONFIG_ALLOW_SYSTEM_LIBS=true pkg-config --libs-only-L protobuf | sed s/-L// | sed s/\ //g)
85
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000086CXX = @CXX@-4.9
Craig Lutgenf040dba2018-09-27 11:21:43 -050087CXXFLAGS += @CXXFLAGS@
88CXXFLAGS += $(shell pkg-config --cflags-only-I grpc++)
Humera Kouser5ac56612019-07-25 20:23:01 -040089CPPFLAGS += @CPPFLAGS@
Shad Ansari01b0e652018-04-05 21:02:53 +000090CPPFLAGS += `pkg-config --cflags protobuf grpc`
Humera Kouser5ac56612019-07-25 20:23:01 -040091CPPFLAGS += -DVERSION=\"$(VERSION)\" -DBAL_VER=\"$(BAL_VER)\" -DLABEL_VCS_URL=\"$(LABEL_VCS_URL)\" \
92 -DLABEL_VCS_REF=\"$(LABEL_VCS_REF)\" -DLABEL_BUILD_DATE=\"$(LABEL_BUILD_DATE)\" \
Girish Gowdraddf9a162020-01-27 12:56:27 +053093 -DLABEL_COMMIT_DATE=\"$(LABEL_COMMIT_DATE)\" -DFLOW_CHECKER
Craig Lutgen7ebee132018-11-16 15:31:11 -060094CXXFLAGS += -std=c++11 -fpermissive -Wno-literal-suffix
Craig Lutgenf040dba2018-09-27 11:21:43 -050095LDFLAGS += @LDFLAGS@
96LDFLAGS += `pkg-config --libs protobuf grpc++ grpc` -ldl -lgpr
Shad Ansari9acc9732018-10-30 18:01:44 +000097CXXFLAGSDEVICE = -I./device -I./device/$(OPENOLTDEVICE) -I./device/generic
Craig Lutgenf040dba2018-09-27 11:21:43 -050098
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +000099export CXX CXXFLAGS OPENOLT_PROTO_VER
Luca Pretee75aaa52018-04-13 12:19:12 -0700100
Girish Gowdraddf9a162020-01-27 12:56:27 +0530101prereqs-system:
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000102 sudo apt-get -q -y install git pkg-config build-essential autoconf libtool libgflags-dev libgtest-dev clang libc++-dev unzip docker.io
103 sudo apt-get install -y build-essential autoconf libssl-dev gawk debhelper dh-systemd init-system-helpers curl cmake ccache g++-4.9
Luca Pretee75aaa52018-04-13 12:19:12 -0700104
Girish Gowdraddf9a162020-01-27 12:56:27 +0530105prereqs-local: $(protoc-bin) $(grpc-cpp-plugin-bin)
106
107$(protoc-bin):
108 # Install protobuf
109 rm -rf $(PROTOBUF_DST)
110 cd /tmp && wget $(PROTOBUF_ADDR)
111 cd /tmp && tar -zxvf protobuf-cpp-$(PROTOBUF_VER).tar.gz
112 cd $(PROTOBUF_DST) && ./autogen.sh
113 mkdir -p $(HOME)/openolt-agent-test-lib/grpc/$(GRPC_VER)
114 cd $(PROTOBUF_DST) && ./configure --prefix=$(HOME)/openolt-agent-test-lib/grpc/$(GRPC_VER)
115 make -C $(PROTOBUF_DST)
116 make -C $(PROTOBUF_DST) install
117
118$(grpc-cpp-plugin-bin):
119 # Install GRPC, protoc
Luca Pretee75aaa52018-04-13 12:19:12 -0700120 rm -rf $(GRPC_DST)
Girish Gowdraddf9a162020-01-27 12:56:27 +0530121 cd /tmp && git clone -b $(GRPC_VER) $(GRPC_ADDR) $(GRPC_DST)
Luca Pretee75aaa52018-04-13 12:19:12 -0700122 cd $(GRPC_DST) && git submodule update --init
Girish Gowdraddf9a162020-01-27 12:56:27 +0530123 mkdir -p $(HOME)/openolt-agent-test-lib/grpc/$(GRPC_VER)
Shad Ansari563ea822018-06-28 14:56:27 +0000124 make -C $(GRPC_DST)
Girish Gowdraddf9a162020-01-27 12:56:27 +0530125 make -C $(GRPC_DST) install prefix=$(HOME)/openolt-agent-test-lib/grpc/$(GRPC_VER)
Shad Ansaricb004c52018-05-30 18:07:23 +0000126
Shad Ansari2cddc552018-06-26 20:34:27 +0000127docker:
128 echo $(USER)
129 sudo groupadd -f docker
130ifneq "$(USER)" ""
131 sudo usermod -aG docker $(USER)
132endif
133
Shad Ansari01b0e652018-04-05 21:02:53 +0000134########################################################################
135##
136##
Luca Pretee75aaa52018-04-13 12:19:12 -0700137## ONL
Shad Ansari01b0e652018-04-05 21:02:53 +0000138##
139##
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000140ONL_REPO = onl
Shad Ansari01b0e652018-04-05 21:02:53 +0000141ONL_DIR = $(BUILD_DIR)/$(ONL_REPO)
Shad Ansari01b0e652018-04-05 21:02:53 +0000142onl:
143 if [ ! -d "$(ONL_DIR)/OpenNetworkLinux" ]; then \
144 mkdir -p $(ONL_DIR); \
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000145 git clone https://github.com/opencomputeproject/OpenNetworkLinux.git $(ONL_DIR)/OpenNetworkLinux; \
146 cp download/Makefile.onl $(ONL_DIR)/Makefile; \
147 install -m 755 download/build-onl.sh $(ONL_DIR)/OpenNetworkLinux; \
148 make -C $(ONL_DIR) onl-$(ONL_KERN_VER_MAJOR); \
Shad Ansari01b0e652018-04-05 21:02:53 +0000149 fi;
150onl-force:
Shad Ansari9acc9732018-10-30 18:01:44 +0000151 make -C $(ONL_DIR) $(OPENOLTDEVICE)-$(ONL_KERN_VER_MAJOR)
Shad Ansari01b0e652018-04-05 21:02:53 +0000152distclean-onl:
153 sudo rm -rf $(ONL_DIR)
154
155########################################################################
156##
157##
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000158## Broadcom LIBRARY APIs
159##
160##
161BAL_API_DIR = $(BUILD_DIR)/bal-api-$(BAL_API_VER)
162
163bal-api-$(BAL_API_VER):
164 if [ ! -d "$(BAL_API_DIR)" ]; then \
165 mkdir -p $(BAL_API_DIR); \
166 git clone https://github.com/balapi/bal-api-$(BAL_API_VER).git $(BAL_API_DIR); \
167 fi;
168bal-api-clean:
169 rm $(BAL_API_DIR)
170
171########################################################################
172##
173##
Luca Pretee75aaa52018-04-13 12:19:12 -0700174## BAL
Shad Ansari01b0e652018-04-05 21:02:53 +0000175##
176##
Jason Huang09b73ea2020-01-08 17:52:05 +0800177BAL_ZIP = SW-BCM686OLT_$(subst .,_,$(BAL_VER)).tgz
Shad Ansari01b0e652018-04-05 21:02:53 +0000178SDK_ZIP = sdk-all-$(SDK_VER).tar.gz
Craig Lutgenf040dba2018-09-27 11:21:43 -0500179ACCTON_PATCH = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER).patch
Shad Ansari9acc9732018-10-30 18:01:44 +0000180BAL_DIR = $(BUILD_DIR)/$(OPENOLTDEVICE)-bal
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000181BCM_SDK = $(BAL_DIR)/switch_sdk/$(SDK_VER)
182BALLIBDIR = $(BAL_DIR)/build/host_reference/host_api
183BALLIBNAME = bal_host_api
184BAL_INC = -I$(BAL_DIR)/host_driver/bal/bal_include \
185 -I$(BAL_DIR)/host_driver/topology \
186 -I$(BAL_DIR)/host_driver/utils \
187 -I$(BAL_DIR)/host_driver/api \
188 -I$(BAL_DIR)/host_customized/os_abstraction \
189 -I$(BAL_DIR)/host_customized/os_abstraction/posix \
190 -I$(BAL_DIR)/host_customized/config \
191 -I$(BAL_DIR)/host_driver/api_conn_mgr \
192 -I$(BAL_DIR)/host_driver/conn_mgr \
193 -I$(BAL_DIR)/host_driver/api/host/topology \
194 -I$(BAL_DIR)/host_reference/cli \
195 -I$(BAL_DIR)/host_reference/api_cli \
196 -I$(BAL_API_DIR)/include \
197 -I$(BAL_API_DIR)/include/object_model
Shad Ansari01b0e652018-04-05 21:02:53 +0000198CXXFLAGS += $(BAL_INC) -I $(BAL_DIR)/lib/cmdline
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000199CXXFLAGS += -DBCMOS_MSG_QUEUE_DOMAIN_SOCKET -DBCMOS_MSG_QUEUE_UDP_SOCKET -DBCMOS_MEM_CHECK -DBCMOS_SYS_UNITTEST -DENABLE_LOG -DENABLE_CLI
Shad Ansaricb004c52018-05-30 18:07:23 +0000200
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000201sdk: onl bal-api-$(BAL_API_VER)
Shad Ansari01b0e652018-04-05 21:02:53 +0000202ifeq ("$(wildcard $(BAL_DIR))","")
203 mkdir $(BAL_DIR)
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000204 tar zxvf download/$(BAL_ZIP) --strip 1 -C $(BAL_DIR)
Shad Ansari01b0e652018-04-05 21:02:53 +0000205 cp download/$(SDK_ZIP) $(BCM_SDK)
206 chmod -R 744 $(BAL_DIR)
207 cat download/$(ACCTON_PATCH) | patch -p1 -d $(BAL_DIR)
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000208 make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) ONL_DIR=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux OPEN_SOURCE=y
209 make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
Shad Ansari01b0e652018-04-05 21:02:53 +0000210endif
Shad Ansaricb004c52018-05-30 18:07:23 +0000211
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000212bal-release: sdk
213 make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
Shad Ansaricb004c52018-05-30 18:07:23 +0000214
215bal-clean:
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000216 make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) clean_all
Shad Ansari01b0e652018-04-05 21:02:53 +0000217
218########################################################################
219##
220##
Luca Pretee75aaa52018-04-13 12:19:12 -0700221## OpenOLT API
Shad Ansari01b0e652018-04-05 21:02:53 +0000222##
223##
Shad Ansari56c8ea42018-10-30 19:34:35 +0000224OPENOLT_PROTOS_DIR = ../protos
Shad Ansari19249582018-04-30 04:31:00 +0000225OPENOLT_API_LIB = $(OPENOLT_PROTOS_DIR)/libopenoltapi.a
Shad Ansari627b5782018-08-13 22:49:32 +0000226CXXFLAGS += -I$(OPENOLT_PROTOS_DIR) -I$(OPENOLT_PROTOS_DIR)/googleapis/gens
Shad Ansari19249582018-04-30 04:31:00 +0000227protos:
228 make -C $(OPENOLT_PROTOS_DIR) all
Shad Ansaricc01de12018-05-21 22:54:45 +0000229protos-clean:
Shad Ansari19249582018-04-30 04:31:00 +0000230 -make -C $(OPENOLT_PROTOS_DIR) clean
Shad Ansari01b0e652018-04-05 21:02:53 +0000231
232########################################################################
233##
234##
Shad Ansari627b5782018-08-13 22:49:32 +0000235## common
Shad Ansari7193ae22018-08-08 22:23:18 +0000236##
237##
Girish Gowdrafe649702019-10-30 12:49:58 +0530238
239# A hack to force a re-build of common/main.cc everytime.
240# This is needed to bake in the git VCS information in the openolt binary
241# at the time of building the openolt package.
242common/main.o: .FORCE
243.FORCE:
244 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -I./common -c common/main.cc -o common/main.o
245
Shad Ansari627b5782018-08-13 22:49:32 +0000246common/%.o: common/%.cc
Humera Kouser5ac56612019-07-25 20:23:01 -0400247 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -I./common -c $< -o $@
Shad Ansari7193ae22018-08-08 22:23:18 +0000248
249########################################################################
250##
251##
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500252## device
253##
254##
Shad Ansari9acc9732018-10-30 18:01:44 +0000255device/$(OPENOLTDEVICE)/%.o: device/$(OPENOLTDEVICE)/%.cc
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500256 $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -c $< -o $@
257
258device/generic/%.o: device/generic/%.cc
259 $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -c $< -o $@
260
261########################################################################
262##
263##
Shad Ansari627b5782018-08-13 22:49:32 +0000264## sim
Shad Ansari01b0e652018-04-05 21:02:53 +0000265##
266##
Shad Ansari627b5782018-08-13 22:49:32 +0000267SIM_SRCS = $(wildcard sim/*.cc) $(wildcard common/*.cc)
268SIM_OBJS = $(SIM_SRCS:.cc=.o)
269SIM_DEPS = $(SIM_SRCS:.cc=.d)
270sim: sim/openoltsim
271sim/openoltsim: protos $(SIM_OBJS)
272 $(CXX) -pthread -L/usr/local/lib $(SIM_OBJS) $(OPENOLT_API_LIB) /usr/local/lib/libprotobuf.a -o $@ -lgrpc++ -lgrpc -lpthread -ldl
273sim/%.o: sim/%.cc
274 $(CXX) -std=c++11 -fpermissive -Wno-literal-suffix -I./common -I$(OPENOLT_PROTOS_DIR) -I$(OPENOLT_PROTOS_DIR)/googleapis/gens -c $< -o $@
275clean-sim:
276 rm -f sim/openoltsim $(SIM_OBJS) $(SIM_DEPS)
277
278########################################################################
279##
280##
281## openolt
282##
283##
Shad Ansari9acc9732018-10-30 18:01:44 +0000284SRCS = $(wildcard src/*.cc) $(wildcard common/*.cc) $(wildcard device/$(OPENOLTDEVICE)/*.cc)
Shad Ansari01b0e652018-04-05 21:02:53 +0000285OBJS = $(SRCS:.cc=.o)
286DEPS = $(SRCS:.cc=.d)
287.DEFAULT_GOAL := all
Shad Ansari2ae27672019-05-09 00:26:34 +0000288all: $(BUILD_DIR)/openolt
Shad Ansaricb004c52018-05-30 18:07:23 +0000289$(BUILD_DIR)/openolt: sdk protos $(OBJS)
Shad Ansari06a13322018-09-29 01:55:33 +0000290 $(CXX) $(LDFLAGS) -L$(BALLIBDIR) $(OBJS) $(OPENOLT_API_LIB) $(LIBPROTOBUF_PATH)/libprotobuf.a -o $@ -l$(BALLIBNAME) $(shell pkg-config --libs protobuf grpc++ grpc)
Jason Huang09b73ea2020-01-08 17:52:05 +0800291 ln -sf $(TOP_DIR)/$(BAL_DIR)/build/fs/$(OPENOLTDEVICE)/release/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz $(BUILD_DIR)/.
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000292 ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_reference/host_api/strip/libbal_host_api.so $(BUILD_DIR)/.
293 ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_driver/dev_mgmt_daemon/dev_mgmt_daemon $(BUILD_DIR)/.
Craig Lutgenf040dba2018-09-27 11:21:43 -0500294 ln -sf $(LIBGRPC_PATH)/libgrpc.so.6 $(BUILD_DIR)/libgrpc.so.6
295 ln -sf $(LIBGRPC_PATH)/libgrpc++.so.1 $(BUILD_DIR)/libgrpc++.so.1
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000296 ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $(BUILD_DIR)/libstdc++.so.6
297 strip $(BUILD_DIR)/openolt
Shad Ansari627b5782018-08-13 22:49:32 +0000298src/%.o: src/%.cc
Humera Kouser5ac56612019-07-25 20:23:01 -0400299 $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) $(CPPFLAGS) -I./common -c $< -o $@
Shad Ansari01b0e652018-04-05 21:02:53 +0000300
Shad Ansari6cd46a62018-05-13 23:20:51 +0000301deb:
Jason Huang09b73ea2020-01-08 17:52:05 +0800302 cp $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz device/$(OPENOLTDEVICE)/mkdebian/debian
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000303 cp $(BUILD_DIR)/openolt device/$(OPENOLTDEVICE)/mkdebian/debian
304 cp $(BUILD_DIR)/libgrpc.so.6 device/$(OPENOLTDEVICE)/mkdebian/debian
305 cp $(BUILD_DIR)/libgrpc++.so.1 device/$(OPENOLTDEVICE)/mkdebian/debian
306 cp $(BUILD_DIR)/libstdc++.so.6 device/$(OPENOLTDEVICE)/mkdebian/debian
307 cp $(BUILD_DIR)/libbal_host_api.so device/$(OPENOLTDEVICE)/mkdebian/debian
308 cp -a scripts/init.d device/$(OPENOLTDEVICE)/mkdebian/debian
309 cd device/$(OPENOLTDEVICE)/mkdebian && ./build_$(OPENOLTDEVICE)_deb.sh
310 mv device/$(OPENOLTDEVICE)/*.deb $(BUILD_DIR)/openolt_$(OPENOLTDEVICE).deb
Shad Ansaricb004c52018-05-30 18:07:23 +0000311 make deb-cleanup
Shad Ansari6cd46a62018-05-13 23:20:51 +0000312
Shad Ansari01b0e652018-04-05 21:02:53 +0000313src/%.o: %.cpp
314 $(CXX) -MMD -c $< -o $@
315
Shad Ansaricb004c52018-05-30 18:07:23 +0000316deb-cleanup:
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000317 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).debhelper.log
318 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).postinst.debhelper
319 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).postrm.debhelper
320 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).substvars
321 @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE)/
322 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/debhelper-build-stamp
323 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libgrpc++.so.1
324 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libgrpc.so.6
325 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libstdc++.so.6
326 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libbal_host_api.so
327 @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/init.d/
328 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/openolt
Jason Huang09b73ea2020-01-08 17:52:05 +0800329 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000330 @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/tmp/
331 @rm -f device/$(OPENOLTDEVICE)/$(OPENOLTDEVICE)_$(BAL_VER)+edgecore-V$(DEV_VER)_amd64.changes
Shad Ansaricc01de12018-05-21 22:54:45 +0000332
Shad Ansaricb004c52018-05-30 18:07:23 +0000333clean: protos-clean deb-cleanup
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000334 @rm -f $(OBJS) $(DEPS)
335 @rm -rf $(OPENOLT_PROTOS_DIR)/googleapis
336 @rm -f $(BUILD_DIR)/libgrpc.so.6 $(BUILD_DIR)/libgrpc++.so.1
Girish Gowdraab7ea552020-01-07 13:25:15 +0530337 @rm -f $(BUILD_DIR)/libbal_host_api.so
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000338 @rm -f $(BUILD_DIR)/openolt
Girish Gowdraab7ea552020-01-07 13:25:15 +0530339 @rm -f $(BUILD_DIR)/dev_mgmt_daemon
Jason Huang09b73ea2020-01-08 17:52:05 +0800340 @rm -f $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz
Girish Gowdraab7ea552020-01-07 13:25:15 +0530341 @rm -f $(BUILD_DIR)/openolt_$(OPENOLTDEVICE).deb
Shad Ansari19249582018-04-30 04:31:00 +0000342
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000343clean-src: protos-clean
344 @rm -f $(OBJS) $(DEPS)
345
346distclean: clean-src clean
347 @rm -rf $(BUILD_DIR)
Shad Ansaricb004c52018-05-30 18:07:23 +0000348
Girish Gowdraddf9a162020-01-27 12:56:27 +0530349.PHONY: onl sdk bal protos prereqs-system prereqs-local sim .FORCE