blob: 6068c4e0cc4d63ebff673a6173943a286d15b245 [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 Huangc6362792020-03-04 16:33:19 +080030BAL_MINOR_VER = 4
Jason Huang09b73ea2020-01-08 17:52:05 +080031BAL_REV_A_VER = 3
Jason Huangc6362792020-03-04 16:33:19 +080032BAL_REV_B_VER = 3
Jason Huang09b73ea2020-01-08 17:52:05 +080033BAL_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 Huangc6362792020-03-04 16:33:19 +080036DEV_VER ?= 202002100101
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 Gurdag30222452020-04-23 20:00:52 +000045OPENOLT_PROTO_VER ?= v3.3.4
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
Girish Gowdra489425a2020-02-22 13:07:42 +053052PROTOBUF_VER ?= 3.5.0
Girish Gowdraddf9a162020-01-27 12:56:27 +053053PROTOBUF_ADDR = https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOBUF_VER)/protobuf-cpp-$(PROTOBUF_VER).tar.gz
54PROTOBUF_DST = /tmp/protobuf-$(PROTOBUF_VER)
Girish Gowdra489425a2020-02-22 13:07:42 +053055protoc-bin = $(shell which protoc)
Girish Gowdraddf9a162020-01-27 12:56:27 +053056
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 Gowdra489425a2020-02-22 13:07:42 +053062grpc-cpp-plugin-bin = $(shell which 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
Girish Gowdra489425a2020-02-22 13:07:42 +0530113 cd $(PROTOBUF_DST) && ./configure
Girish Gowdraddf9a162020-01-27 12:56:27 +0530114 make -C $(PROTOBUF_DST)
Girish Gowdra489425a2020-02-22 13:07:42 +0530115 sudo make -C $(PROTOBUF_DST) install
Girish Gowdraddf9a162020-01-27 12:56:27 +0530116
117$(grpc-cpp-plugin-bin):
118 # Install GRPC, protoc
Luca Pretee75aaa52018-04-13 12:19:12 -0700119 rm -rf $(GRPC_DST)
Girish Gowdraddf9a162020-01-27 12:56:27 +0530120 cd /tmp && git clone -b $(GRPC_VER) $(GRPC_ADDR) $(GRPC_DST)
Luca Pretee75aaa52018-04-13 12:19:12 -0700121 cd $(GRPC_DST) && git submodule update --init
Shad Ansari563ea822018-06-28 14:56:27 +0000122 make -C $(GRPC_DST)
Girish Gowdra489425a2020-02-22 13:07:42 +0530123 sudo make -C $(GRPC_DST) install
Shad Ansaricb004c52018-05-30 18:07:23 +0000124
Shad Ansari2cddc552018-06-26 20:34:27 +0000125docker:
126 echo $(USER)
127 sudo groupadd -f docker
128ifneq "$(USER)" ""
129 sudo usermod -aG docker $(USER)
130endif
131
Shad Ansari01b0e652018-04-05 21:02:53 +0000132########################################################################
133##
134##
Luca Pretee75aaa52018-04-13 12:19:12 -0700135## ONL
Shad Ansari01b0e652018-04-05 21:02:53 +0000136##
137##
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000138ONL_REPO = onl
Shad Ansari01b0e652018-04-05 21:02:53 +0000139ONL_DIR = $(BUILD_DIR)/$(ONL_REPO)
Shad Ansari01b0e652018-04-05 21:02:53 +0000140onl:
141 if [ ! -d "$(ONL_DIR)/OpenNetworkLinux" ]; then \
142 mkdir -p $(ONL_DIR); \
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000143 git clone https://github.com/opencomputeproject/OpenNetworkLinux.git $(ONL_DIR)/OpenNetworkLinux; \
144 cp download/Makefile.onl $(ONL_DIR)/Makefile; \
145 install -m 755 download/build-onl.sh $(ONL_DIR)/OpenNetworkLinux; \
146 make -C $(ONL_DIR) onl-$(ONL_KERN_VER_MAJOR); \
Shad Ansari01b0e652018-04-05 21:02:53 +0000147 fi;
148onl-force:
Shad Ansari9acc9732018-10-30 18:01:44 +0000149 make -C $(ONL_DIR) $(OPENOLTDEVICE)-$(ONL_KERN_VER_MAJOR)
Shad Ansari01b0e652018-04-05 21:02:53 +0000150distclean-onl:
151 sudo rm -rf $(ONL_DIR)
152
153########################################################################
154##
155##
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000156## Broadcom LIBRARY APIs
157##
158##
159BAL_API_DIR = $(BUILD_DIR)/bal-api-$(BAL_API_VER)
160
161bal-api-$(BAL_API_VER):
162 if [ ! -d "$(BAL_API_DIR)" ]; then \
163 mkdir -p $(BAL_API_DIR); \
164 git clone https://github.com/balapi/bal-api-$(BAL_API_VER).git $(BAL_API_DIR); \
165 fi;
166bal-api-clean:
167 rm $(BAL_API_DIR)
168
169########################################################################
170##
171##
Luca Pretee75aaa52018-04-13 12:19:12 -0700172## BAL
Shad Ansari01b0e652018-04-05 21:02:53 +0000173##
174##
Jason Huang09b73ea2020-01-08 17:52:05 +0800175BAL_ZIP = SW-BCM686OLT_$(subst .,_,$(BAL_VER)).tgz
Shad Ansari01b0e652018-04-05 21:02:53 +0000176SDK_ZIP = sdk-all-$(SDK_VER).tar.gz
Craig Lutgenf040dba2018-09-27 11:21:43 -0500177ACCTON_PATCH = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER).patch
Shad Ansari9acc9732018-10-30 18:01:44 +0000178BAL_DIR = $(BUILD_DIR)/$(OPENOLTDEVICE)-bal
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000179BCM_SDK = $(BAL_DIR)/switch_sdk/$(SDK_VER)
180BALLIBDIR = $(BAL_DIR)/build/host_reference/host_api
181BALLIBNAME = bal_host_api
182BAL_INC = -I$(BAL_DIR)/host_driver/bal/bal_include \
183 -I$(BAL_DIR)/host_driver/topology \
184 -I$(BAL_DIR)/host_driver/utils \
185 -I$(BAL_DIR)/host_driver/api \
Jason Huangc6362792020-03-04 16:33:19 +0800186 -I$(BAL_DIR)/host_driver/metadata \
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000187 -I$(BAL_DIR)/host_customized/os_abstraction \
188 -I$(BAL_DIR)/host_customized/os_abstraction/posix \
189 -I$(BAL_DIR)/host_customized/config \
190 -I$(BAL_DIR)/host_driver/api_conn_mgr \
191 -I$(BAL_DIR)/host_driver/conn_mgr \
192 -I$(BAL_DIR)/host_driver/api/host/topology \
193 -I$(BAL_DIR)/host_reference/cli \
194 -I$(BAL_DIR)/host_reference/api_cli \
195 -I$(BAL_API_DIR)/include \
196 -I$(BAL_API_DIR)/include/object_model
Shad Ansari01b0e652018-04-05 21:02:53 +0000197CXXFLAGS += $(BAL_INC) -I $(BAL_DIR)/lib/cmdline
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000198CXXFLAGS += -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 +0000199
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000200sdk: onl bal-api-$(BAL_API_VER)
Shad Ansari01b0e652018-04-05 21:02:53 +0000201ifeq ("$(wildcard $(BAL_DIR))","")
202 mkdir $(BAL_DIR)
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000203 tar zxvf download/$(BAL_ZIP) --strip 1 -C $(BAL_DIR)
Shad Ansari01b0e652018-04-05 21:02:53 +0000204 cp download/$(SDK_ZIP) $(BCM_SDK)
205 chmod -R 744 $(BAL_DIR)
206 cat download/$(ACCTON_PATCH) | patch -p1 -d $(BAL_DIR)
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000207 make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) ONL_DIR=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux OPEN_SOURCE=y
208 make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
Shad Ansari01b0e652018-04-05 21:02:53 +0000209endif
Shad Ansaricb004c52018-05-30 18:07:23 +0000210
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000211bal-release: sdk
212 make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
Shad Ansaricb004c52018-05-30 18:07:23 +0000213
214bal-clean:
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000215 make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) clean_all
Shad Ansari01b0e652018-04-05 21:02:53 +0000216
217########################################################################
218##
219##
Luca Pretee75aaa52018-04-13 12:19:12 -0700220## OpenOLT API
Shad Ansari01b0e652018-04-05 21:02:53 +0000221##
222##
Shad Ansari56c8ea42018-10-30 19:34:35 +0000223OPENOLT_PROTOS_DIR = ../protos
Shad Ansari19249582018-04-30 04:31:00 +0000224OPENOLT_API_LIB = $(OPENOLT_PROTOS_DIR)/libopenoltapi.a
Shad Ansari627b5782018-08-13 22:49:32 +0000225CXXFLAGS += -I$(OPENOLT_PROTOS_DIR) -I$(OPENOLT_PROTOS_DIR)/googleapis/gens
Shad Ansari19249582018-04-30 04:31:00 +0000226protos:
227 make -C $(OPENOLT_PROTOS_DIR) all
Shad Ansaricc01de12018-05-21 22:54:45 +0000228protos-clean:
Shad Ansari19249582018-04-30 04:31:00 +0000229 -make -C $(OPENOLT_PROTOS_DIR) clean
Shad Ansari01b0e652018-04-05 21:02:53 +0000230
231########################################################################
232##
233##
Shad Ansari627b5782018-08-13 22:49:32 +0000234## common
Shad Ansari7193ae22018-08-08 22:23:18 +0000235##
236##
Girish Gowdrafe649702019-10-30 12:49:58 +0530237
238# A hack to force a re-build of common/main.cc everytime.
239# This is needed to bake in the git VCS information in the openolt binary
240# at the time of building the openolt package.
241common/main.o: .FORCE
242.FORCE:
243 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -I./common -c common/main.cc -o common/main.o
244
Shad Ansari627b5782018-08-13 22:49:32 +0000245common/%.o: common/%.cc
Humera Kouser5ac56612019-07-25 20:23:01 -0400246 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -I./common -c $< -o $@
Shad Ansari7193ae22018-08-08 22:23:18 +0000247
248########################################################################
249##
250##
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500251## device
252##
253##
Shad Ansari9acc9732018-10-30 18:01:44 +0000254device/$(OPENOLTDEVICE)/%.o: device/$(OPENOLTDEVICE)/%.cc
Craig Lutgen88a22ad2018-10-04 12:30:46 -0500255 $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -c $< -o $@
256
257device/generic/%.o: device/generic/%.cc
258 $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -c $< -o $@
259
260########################################################################
261##
262##
Shad Ansari627b5782018-08-13 22:49:32 +0000263## sim
Shad Ansari01b0e652018-04-05 21:02:53 +0000264##
265##
Shad Ansari627b5782018-08-13 22:49:32 +0000266SIM_SRCS = $(wildcard sim/*.cc) $(wildcard common/*.cc)
267SIM_OBJS = $(SIM_SRCS:.cc=.o)
268SIM_DEPS = $(SIM_SRCS:.cc=.d)
269sim: sim/openoltsim
270sim/openoltsim: protos $(SIM_OBJS)
271 $(CXX) -pthread -L/usr/local/lib $(SIM_OBJS) $(OPENOLT_API_LIB) /usr/local/lib/libprotobuf.a -o $@ -lgrpc++ -lgrpc -lpthread -ldl
272sim/%.o: sim/%.cc
273 $(CXX) -std=c++11 -fpermissive -Wno-literal-suffix -I./common -I$(OPENOLT_PROTOS_DIR) -I$(OPENOLT_PROTOS_DIR)/googleapis/gens -c $< -o $@
274clean-sim:
275 rm -f sim/openoltsim $(SIM_OBJS) $(SIM_DEPS)
276
277########################################################################
278##
279##
280## openolt
281##
282##
Shad Ansari9acc9732018-10-30 18:01:44 +0000283SRCS = $(wildcard src/*.cc) $(wildcard common/*.cc) $(wildcard device/$(OPENOLTDEVICE)/*.cc)
Shad Ansari01b0e652018-04-05 21:02:53 +0000284OBJS = $(SRCS:.cc=.o)
285DEPS = $(SRCS:.cc=.d)
286.DEFAULT_GOAL := all
Shad Ansari2ae27672019-05-09 00:26:34 +0000287all: $(BUILD_DIR)/openolt
Shad Ansaricb004c52018-05-30 18:07:23 +0000288$(BUILD_DIR)/openolt: sdk protos $(OBJS)
Shad Ansari06a13322018-09-29 01:55:33 +0000289 $(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 +0800290 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 +0000291 ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_reference/host_api/strip/libbal_host_api.so $(BUILD_DIR)/.
292 ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_driver/dev_mgmt_daemon/dev_mgmt_daemon $(BUILD_DIR)/.
Craig Lutgenf040dba2018-09-27 11:21:43 -0500293 ln -sf $(LIBGRPC_PATH)/libgrpc.so.6 $(BUILD_DIR)/libgrpc.so.6
294 ln -sf $(LIBGRPC_PATH)/libgrpc++.so.1 $(BUILD_DIR)/libgrpc++.so.1
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000295 ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $(BUILD_DIR)/libstdc++.so.6
296 strip $(BUILD_DIR)/openolt
Shad Ansari627b5782018-08-13 22:49:32 +0000297src/%.o: src/%.cc
Humera Kouser5ac56612019-07-25 20:23:01 -0400298 $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) $(CPPFLAGS) -I./common -c $< -o $@
Shad Ansari01b0e652018-04-05 21:02:53 +0000299
Shad Ansari6cd46a62018-05-13 23:20:51 +0000300deb:
Jason Huang09b73ea2020-01-08 17:52:05 +0800301 cp $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz device/$(OPENOLTDEVICE)/mkdebian/debian
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000302 cp $(BUILD_DIR)/openolt device/$(OPENOLTDEVICE)/mkdebian/debian
303 cp $(BUILD_DIR)/libgrpc.so.6 device/$(OPENOLTDEVICE)/mkdebian/debian
304 cp $(BUILD_DIR)/libgrpc++.so.1 device/$(OPENOLTDEVICE)/mkdebian/debian
305 cp $(BUILD_DIR)/libstdc++.so.6 device/$(OPENOLTDEVICE)/mkdebian/debian
306 cp $(BUILD_DIR)/libbal_host_api.so device/$(OPENOLTDEVICE)/mkdebian/debian
307 cp -a scripts/init.d device/$(OPENOLTDEVICE)/mkdebian/debian
308 cd device/$(OPENOLTDEVICE)/mkdebian && ./build_$(OPENOLTDEVICE)_deb.sh
Girish Gowdrabc6e0852020-03-26 11:36:12 -0700309 mv device/$(OPENOLTDEVICE)/*.deb $(BUILD_DIR)/openolt_$(OPENOLTDEVICE)-$(VERSION)-$(LABEL_VCS_REF).deb
Shad Ansaricb004c52018-05-30 18:07:23 +0000310 make deb-cleanup
Shad Ansari6cd46a62018-05-13 23:20:51 +0000311
Shad Ansari01b0e652018-04-05 21:02:53 +0000312src/%.o: %.cpp
313 $(CXX) -MMD -c $< -o $@
314
Shad Ansaricb004c52018-05-30 18:07:23 +0000315deb-cleanup:
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000316 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).debhelper.log
317 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).postinst.debhelper
318 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).postrm.debhelper
319 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).substvars
320 @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE)/
321 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/debhelper-build-stamp
322 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libgrpc++.so.1
323 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libgrpc.so.6
324 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libstdc++.so.6
325 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libbal_host_api.so
326 @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/init.d/
327 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/openolt
Jason Huang09b73ea2020-01-08 17:52:05 +0800328 @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000329 @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/tmp/
330 @rm -f device/$(OPENOLTDEVICE)/$(OPENOLTDEVICE)_$(BAL_VER)+edgecore-V$(DEV_VER)_amd64.changes
Shad Ansaricc01de12018-05-21 22:54:45 +0000331
Shad Ansaricb004c52018-05-30 18:07:23 +0000332clean: protos-clean deb-cleanup
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000333 @rm -f $(OBJS) $(DEPS)
334 @rm -rf $(OPENOLT_PROTOS_DIR)/googleapis
335 @rm -f $(BUILD_DIR)/libgrpc.so.6 $(BUILD_DIR)/libgrpc++.so.1
Girish Gowdraab7ea552020-01-07 13:25:15 +0530336 @rm -f $(BUILD_DIR)/libbal_host_api.so
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000337 @rm -f $(BUILD_DIR)/openolt
Girish Gowdraab7ea552020-01-07 13:25:15 +0530338 @rm -f $(BUILD_DIR)/dev_mgmt_daemon
Jason Huang09b73ea2020-01-08 17:52:05 +0800339 @rm -f $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz
Girish Gowdrabc6e0852020-03-26 11:36:12 -0700340 @rm -f $(BUILD_DIR)/openolt_$(OPENOLTDEVICE)-$(VERSION)-$(LABEL_VCS_REF).deb
Shad Ansari19249582018-04-30 04:31:00 +0000341
Thiyagarajan Subramani89fffc02019-05-13 21:33:20 +0000342clean-src: protos-clean
343 @rm -f $(OBJS) $(DEPS)
344
345distclean: clean-src clean
346 @rm -rf $(BUILD_DIR)
Shad Ansaricb004c52018-05-30 18:07:23 +0000347
Girish Gowdraddf9a162020-01-27 12:56:27 +0530348.PHONY: onl sdk bal protos prereqs-system prereqs-local sim .FORCE