Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 1 | # Copyright (C) 2018 Open Networking Foundation |
| 2 | # |
| 3 | # This program is free software: you can redistribute it and/or modify |
| 4 | # it under the terms of the GNU General Public License as published by |
| 5 | # the Free Software Foundation, either version 3 of the License, or |
| 6 | # (at your option) any later version. |
| 7 | # |
| 8 | # This program is distributed in the hope that it will be useful, |
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | # GNU General Public License for more details. |
| 12 | # |
| 13 | # You should have received a copy of the GNU General Public License |
| 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | |
| 16 | ######################################################################## |
| 17 | ## |
| 18 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 19 | ## Config |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 20 | ## |
| 21 | ## |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame^] | 22 | TOP_DIR=`pwd` |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 23 | OPENOLTDEVICE ?= generic |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 24 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 25 | # |
| 26 | # Three vendor proprietary source files are required to build BAL. |
| 27 | # SW-BCM68620_<VER>.zip - Broadcom BAL source and Maple SDK. |
| 28 | # sdk-all-<SDK_VER>.tar.gz - Broadcom Qumran SDK. |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 29 | # ACCTON_BAL_<BAL_VER>-<DEV_VER>.patch - Accton/Edgecore's patch. |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame^] | 30 | BAL_MAJOR_VER = 03.00 |
| 31 | BAL_VER = 3.0.3.3 |
| 32 | SDK_VER = 6.5.13 |
| 33 | DEV_VER ?= 201904171432 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 34 | # |
| 35 | # Version of Open Network Linux (ONL). |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame^] | 36 | ONL_KERN_VER_MAJOR = 4.14 |
| 37 | ONL_KERN_VER_MINOR = 49 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 38 | # |
| 39 | # Build directory |
| 40 | BUILD_DIR = build |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 41 | # |
| 42 | # GRPC installation |
| 43 | GRPC_ADDR = https://github.com/grpc/grpc |
| 44 | GRPC_DST = /tmp/grpc |
| 45 | GRPC_VER = v1.10.x |
Shad Ansari | 2cddc55 | 2018-06-26 20:34:27 +0000 | [diff] [blame] | 46 | |
| 47 | USER := $(shell echo $(USER)) |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 48 | # |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 49 | ######################################################################## |
| 50 | ## |
| 51 | ## |
Luca Prete | 08e6f80 | 2018-04-17 11:49:45 -0700 | [diff] [blame] | 52 | ## Install prerequisites |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 53 | ## |
| 54 | ## |
| 55 | HOST_SYSTEM = $(shell uname | cut -f 1 -d_) |
| 56 | SYSTEM ?= $(HOST_SYSTEM) |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 57 | |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 58 | LIBGRPC_PATH=$(shell pkg-config --libs-only-L grpc | sed s/-L// | sed s/\ //g) |
| 59 | LIBPROTOBUF_PATH=$(shell PKG_CONFIG_ALLOW_SYSTEM_LIBS=true pkg-config --libs-only-L protobuf | sed s/-L// | sed s/\ //g) |
| 60 | |
| 61 | CXX = @CXX@ |
| 62 | CXXFLAGS += @CXXFLAGS@ |
| 63 | CXXFLAGS += $(shell pkg-config --cflags-only-I grpc++) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 64 | CPPFLAGS += `pkg-config --cflags protobuf grpc` |
Craig Lutgen | 7ebee13 | 2018-11-16 15:31:11 -0600 | [diff] [blame] | 65 | CXXFLAGS += -std=c++11 -fpermissive -Wno-literal-suffix |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 66 | LDFLAGS += @LDFLAGS@ |
| 67 | LDFLAGS += `pkg-config --libs protobuf grpc++ grpc` -ldl -lgpr |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 68 | CXXFLAGSDEVICE = -I./device -I./device/$(OPENOLTDEVICE) -I./device/generic |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 69 | |
| 70 | export CXX CXXFLAGS |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 71 | |
Luca Prete | 08e6f80 | 2018-04-17 11:49:45 -0700 | [diff] [blame] | 72 | prereq: |
nick | 6fa8073 | 2018-05-22 14:47:10 -0400 | [diff] [blame] | 73 | sudo apt-get -q -y install git pkg-config build-essential autoconf libtool libgflags-dev libgtest-dev clang libc++-dev unzip docker.io |
| 74 | sudo apt-get install -y build-essential autoconf libssl-dev gawk debhelper dh-systemd init-system-helpers |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 75 | |
Shad Ansari | 563ea82 | 2018-06-28 14:56:27 +0000 | [diff] [blame] | 76 | # Install GRPC, libprotobuf and protoc |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 77 | rm -rf $(GRPC_DST) |
| 78 | git clone -b $(GRPC_VER) $(GRPC_ADDR) $(GRPC_DST) |
| 79 | cd $(GRPC_DST) && git submodule update --init |
Shad Ansari | 563ea82 | 2018-06-28 14:56:27 +0000 | [diff] [blame] | 80 | cd $(GRPC_DST)/third_party/protobuf && ./autogen.sh && ./configure |
Luca Prete | 08e6f80 | 2018-04-17 11:49:45 -0700 | [diff] [blame] | 81 | make -C $(GRPC_DST)/third_party/protobuf |
| 82 | sudo make -C $(GRPC_DST)/third_party/protobuf install |
| 83 | sudo ldconfig |
Shad Ansari | 563ea82 | 2018-06-28 14:56:27 +0000 | [diff] [blame] | 84 | make -C $(GRPC_DST) |
| 85 | sudo make -C $(GRPC_DST) install |
| 86 | sudo ldconfig |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 87 | |
Shad Ansari | 2cddc55 | 2018-06-26 20:34:27 +0000 | [diff] [blame] | 88 | docker: |
| 89 | echo $(USER) |
| 90 | sudo groupadd -f docker |
| 91 | ifneq "$(USER)" "" |
| 92 | sudo usermod -aG docker $(USER) |
| 93 | endif |
| 94 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 95 | ######################################################################## |
| 96 | ## |
| 97 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 98 | ## ONL |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 99 | ## |
| 100 | ## |
| 101 | ONL_KERN_VER = $(ONL_KERN_VER_MAJOR).$(ONL_KERN_VER_MINOR) |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 102 | ONL_REPO = $(OPENOLTDEVICE)-onl |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 103 | ONL_DIR = $(BUILD_DIR)/$(ONL_REPO) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 104 | onl: |
| 105 | if [ ! -d "$(ONL_DIR)/OpenNetworkLinux" ]; then \ |
| 106 | mkdir -p $(ONL_DIR); \ |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame^] | 107 | git clone https://github.com/opencomputeproject/OpenNetworkLinux.git $(ONL_DIR)/OpenNetworkLinux; \ |
| 108 | cp download/Makefile.onl $(ONL_DIR)/Makefile; \ |
| 109 | install -m 755 download/build-asfvolt16.sh $(ONL_DIR)/OpenNetworkLinux; \ |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 110 | make -C $(ONL_DIR) $(OPENOLTDEVICE)-$(ONL_KERN_VER_MAJOR); \ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 111 | fi; |
| 112 | onl-force: |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 113 | make -C $(ONL_DIR) $(OPENOLTDEVICE)-$(ONL_KERN_VER_MAJOR) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 114 | distclean-onl: |
| 115 | sudo rm -rf $(ONL_DIR) |
| 116 | |
| 117 | ######################################################################## |
| 118 | ## |
| 119 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 120 | ## BAL |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 121 | ## |
| 122 | ## |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame^] | 123 | BAL_ZIP = SW-BCM68620_$(subst .,_,$(BAL_VER)).tgz |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 124 | SDK_ZIP = sdk-all-$(SDK_VER).tar.gz |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 125 | ACCTON_PATCH = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER).patch |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 126 | OPENOLT_BAL_PATCH = OPENOLT_BAL_$(BAL_VER).patch |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 127 | BAL_DIR = $(BUILD_DIR)/$(OPENOLTDEVICE)-bal |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame^] | 128 | BCM_SDK = $(BAL_DIR)/switch_sdk/6.5.13 |
| 129 | BALLIBDIR = $(BAL_DIR)/build/asfvolt16-bal/build/lib/libbal_core.so |
| 130 | BALLIBNAME = bal_core.so |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 131 | BAL_INC = -I$(BAL_DIR)/bal_release/src/common/os_abstraction \ |
| 132 | -I$(BAL_DIR)/bal_release/src/common/os_abstraction/posix \ |
| 133 | -I$(BAL_DIR)/bal_release/src/common/config \ |
| 134 | -I$(BAL_DIR)/bal_release/src/core/platform \ |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 135 | -I$(BAL_DIR)/bal_release/src/core/main \ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 136 | -I$(BAL_DIR)/bal_release/src/common/include \ |
| 137 | -I$(BAL_DIR)/bal_release/src/lib/libbalapi \ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 138 | -I$(BAL_DIR)/bal_release/src/balapiend \ |
| 139 | -I$(BAL_DIR)/bal_release/src/common/dev_log \ |
| 140 | -I$(BAL_DIR)/bal_release/src/common/bal_dist_utils \ |
| 141 | -I$(BAL_DIR)/bal_release/src/lib/libtopology \ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 142 | -I$(BAL_DIR)/bal_release/src/lib/libcmdline \ |
| 143 | -I$(BAL_DIR)/bal_release/src/lib/libutils \ |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 144 | -I$(BAL_DIR)/bal_release/3rdparty/maple/sdk/host_driver/utils \ |
| 145 | -I$(BAL_DIR)/bal_release/3rdparty/maple/sdk/host_driver/model \ |
| 146 | -I$(BAL_DIR)/bal_release/3rdparty/maple/sdk/host_driver/api \ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 147 | -I$(BAL_DIR)/bal_release/3rdparty/maple/sdk/host_reference/cli |
| 148 | CXXFLAGS += $(BAL_INC) -I $(BAL_DIR)/lib/cmdline |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 149 | CXXFLAGS += -DBCMOS_MSG_QUEUE_DOMAIN_SOCKET -DBCMOS_MSG_QUEUE_UDP_SOCKET -DBCMOS_MEM_CHECK -DBCMOS_SYS_UNITTEST -DENABLE_LOG |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 150 | |
| 151 | sdk: onl |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 152 | ifeq ("$(wildcard $(BAL_DIR))","") |
| 153 | mkdir $(BAL_DIR) |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame^] | 154 | tar zxvf download/$(BAL_ZIP) --strip 1 -C $(BAL_DIR) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 155 | cp download/$(SDK_ZIP) $(BCM_SDK) |
| 156 | chmod -R 744 $(BAL_DIR) |
| 157 | cat download/$(ACCTON_PATCH) | patch -p1 -d $(BAL_DIR) |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame^] | 158 | make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) ONL_DIR=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux SW_UTIL_SHELL=y |
| 159 | echo 'auto_create_interface_tm=y' >> $(BAL_DIR)/build/fs/$(OPENOLTDEVICE)/board_files/broadcom/bal_config.ini |
| 160 | make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 161 | endif |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 162 | |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame^] | 163 | bal-release: sdk |
| 164 | echo 'auto_create_interface_tm=y' >> $(BAL_DIR)/build/fs/$(OPENOLTDEVICE)/board_files/broadcom/bal_config.ini |
| 165 | make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 166 | |
| 167 | bal-clean: |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame^] | 168 | make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) clean |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 169 | |
| 170 | ######################################################################## |
| 171 | ## |
| 172 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 173 | ## OpenOLT API |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 174 | ## |
| 175 | ## |
Shad Ansari | 56c8ea4 | 2018-10-30 19:34:35 +0000 | [diff] [blame] | 176 | OPENOLT_PROTOS_DIR = ../protos |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 177 | OPENOLT_API_LIB = $(OPENOLT_PROTOS_DIR)/libopenoltapi.a |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 178 | CXXFLAGS += -I$(OPENOLT_PROTOS_DIR) -I$(OPENOLT_PROTOS_DIR)/googleapis/gens |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 179 | protos: |
| 180 | make -C $(OPENOLT_PROTOS_DIR) all |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 181 | protos-clean: |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 182 | -make -C $(OPENOLT_PROTOS_DIR) clean |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 183 | |
| 184 | ######################################################################## |
| 185 | ## |
| 186 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 187 | ## common |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 188 | ## |
| 189 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 190 | common/%.o: common/%.cc |
| 191 | $(CXX) $(CXXFLAGS) -I./common -c $< -o $@ |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 192 | |
| 193 | ######################################################################## |
| 194 | ## |
| 195 | ## |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 196 | ## device |
| 197 | ## |
| 198 | ## |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 199 | device/$(OPENOLTDEVICE)/%.o: device/$(OPENOLTDEVICE)/%.cc |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 200 | $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -c $< -o $@ |
| 201 | |
| 202 | device/generic/%.o: device/generic/%.cc |
| 203 | $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -c $< -o $@ |
| 204 | |
| 205 | ######################################################################## |
| 206 | ## |
| 207 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 208 | ## sim |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 209 | ## |
| 210 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 211 | SIM_SRCS = $(wildcard sim/*.cc) $(wildcard common/*.cc) |
| 212 | SIM_OBJS = $(SIM_SRCS:.cc=.o) |
| 213 | SIM_DEPS = $(SIM_SRCS:.cc=.d) |
| 214 | sim: sim/openoltsim |
| 215 | sim/openoltsim: protos $(SIM_OBJS) |
| 216 | $(CXX) -pthread -L/usr/local/lib $(SIM_OBJS) $(OPENOLT_API_LIB) /usr/local/lib/libprotobuf.a -o $@ -lgrpc++ -lgrpc -lpthread -ldl |
| 217 | sim/%.o: sim/%.cc |
| 218 | $(CXX) -std=c++11 -fpermissive -Wno-literal-suffix -I./common -I$(OPENOLT_PROTOS_DIR) -I$(OPENOLT_PROTOS_DIR)/googleapis/gens -c $< -o $@ |
| 219 | clean-sim: |
| 220 | rm -f sim/openoltsim $(SIM_OBJS) $(SIM_DEPS) |
| 221 | |
| 222 | ######################################################################## |
| 223 | ## |
| 224 | ## |
| 225 | ## openolt |
| 226 | ## |
| 227 | ## |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 228 | SRCS = $(wildcard src/*.cc) $(wildcard common/*.cc) $(wildcard device/$(OPENOLTDEVICE)/*.cc) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 229 | OBJS = $(SRCS:.cc=.o) |
| 230 | DEPS = $(SRCS:.cc=.d) |
| 231 | .DEFAULT_GOAL := all |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame^] | 232 | #all: $(BUILD_DIR)/openolt |
| 233 | all: notes onl sdk |
| 234 | notes: |
| 235 | echo "\033[1;31m!!! The OpenOLT source codes is not yet support the BAL V3.0, so ignoring to build !!!\033[0m" |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 236 | $(BUILD_DIR)/openolt: sdk protos $(OBJS) |
Shad Ansari | 06a1332 | 2018-09-29 01:55:33 +0000 | [diff] [blame] | 237 | $(CXX) $(LDFLAGS) -L$(BALLIBDIR) $(OBJS) $(OPENOLT_API_LIB) $(LIBPROTOBUF_PATH)/libprotobuf.a -o $@ -l$(BALLIBNAME) $(shell pkg-config --libs protobuf grpc++ grpc) |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 238 | ln -sf $(PWD)/$(BAL_DIR)/bcm68620_release/$(OPENOLTDEVICE)/release/release_$(OPENOLTDEVICE)_V$(BAL_MAJOR_VER).$(DEV_VER).tar.gz $(BUILD_DIR)/. |
| 239 | ln -sf $(PWD)/$(BAL_DIR)/bcm68620_release/$(OPENOLTDEVICE)/release/broadcom/libbal_api_dist.so $(BUILD_DIR)/. |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 240 | ln -sf $(PWD)/$(BAL_DIR)/bal_release/build/core/src/apps/bal_core_dist/bal_core_dist $(BUILD_DIR)/. |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 241 | ln -sf $(LIBGRPC_PATH)/libgrpc.so.6 $(BUILD_DIR)/libgrpc.so.6 |
| 242 | ln -sf $(LIBGRPC_PATH)/libgrpc++.so.1 $(BUILD_DIR)/libgrpc++.so.1 |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 243 | src/%.o: src/%.cc |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 244 | $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -I./common -c $< -o $@ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 245 | |
Shad Ansari | 6cd46a6 | 2018-05-13 23:20:51 +0000 | [diff] [blame] | 246 | deb: |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 247 | cp $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_MAJOR_VER).$(DEV_VER).tar.gz mkdebian/debian |
Shad Ansari | 9fb007d | 2018-05-14 18:31:38 +0000 | [diff] [blame] | 248 | cp $(BUILD_DIR)/openolt mkdebian/debian |
| 249 | cp $(BUILD_DIR)/libgrpc.so.6 mkdebian/debian |
| 250 | cp $(BUILD_DIR)/libgrpc++.so.1 mkdebian/debian |
Shad Ansari | d0eaf75 | 2018-08-16 00:26:12 +0000 | [diff] [blame] | 251 | cp -a scripts/init.d mkdebian/debian |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 252 | cd mkdebian && ./build_$(OPENOLTDEVICE)_deb.sh |
Shad Ansari | 6cd46a6 | 2018-05-13 23:20:51 +0000 | [diff] [blame] | 253 | mv *.deb $(BUILD_DIR)/openolt.deb |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 254 | make deb-cleanup |
Shad Ansari | 6cd46a6 | 2018-05-13 23:20:51 +0000 | [diff] [blame] | 255 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 256 | src/%.o: %.cpp |
| 257 | $(CXX) -MMD -c $< -o $@ |
| 258 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 259 | deb-cleanup: |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 260 | rm -f mkdebian/debian/$(OPENOLTDEVICE).debhelper.log |
| 261 | rm -f mkdebian/debian/$(OPENOLTDEVICE).postinst.debhelper |
| 262 | rm -f mkdebian/debian/$(OPENOLTDEVICE).postrm.debhelper |
| 263 | rm -f mkdebian/debian/$(OPENOLTDEVICE).substvars |
| 264 | rm -rf mkdebian/debian/$(OPENOLTDEVICE)/ |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 265 | rm -f mkdebian/debian/libgrpc++.so.1 |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 266 | rm -f mkdebian/debian/libgrpc.so.6 |
| 267 | rm -f mkdebian/debian/openolt |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 268 | rm -f mkdebian/debian/release_$(OPENOLTDEVICE)_V$(BAL_MAJOR_VER).$(DEV_VER).tar.gz |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 269 | rm -rf mkdebian/debian/tmp/ |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 270 | rm -f $(OPENOLTDEVICE)_$(BAL_VER)+edgecore-V$(DEV_VER)_amd64.changes |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 271 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 272 | clean: protos-clean deb-cleanup |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 273 | rm -f $(OBJS) $(DEPS) |
Craig Lutgen | 1951231 | 2018-11-02 10:14:46 -0500 | [diff] [blame] | 274 | rm -rf $(OPENOLT_PROTOS_DIR)/googleapis |
Shad Ansari | 563ea82 | 2018-06-28 14:56:27 +0000 | [diff] [blame] | 275 | rm -f $(BUILD_DIR)/libgrpc.so.6 $(BUILD_DIR)/libgrpc++.so.1 |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 276 | rm -f $(BUILD_DIR)/libbal_api_dist.so |
| 277 | rm -f $(BUILD_DIR)/openolt |
| 278 | rm -f $(BUILD_DIR)/bal_core_dist |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 279 | rm -f $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_MAJOR_VER).$(DEV_VER).tar.gz |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 280 | rm -f $(BUILD_DIR)/openolt.deb |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 281 | |
| 282 | distclean: |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 283 | rm -rf $(BUILD_DIR) |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 284 | |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 285 | .PHONY: onl sdk bal protos prereq sim |