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 | d33b4d8 | 2019-05-15 18:22:57 +0800 | [diff] [blame] | 30 | BAL_MAJOR_VER = 3 |
Thiyagarajan Subramani | 1f1280b | 2019-08-13 18:41:19 +0800 | [diff] [blame] | 31 | BAL_MINOR_VER = 1 |
| 32 | BAL_REV_A_VER = 1 |
| 33 | BAL_REV_B_VER = 1 |
| 34 | BAL_API_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER) |
Jason Huang | d33b4d8 | 2019-05-15 18:22:57 +0800 | [diff] [blame] | 35 | BAL_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER).$(BAL_REV_B_VER) |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame] | 36 | SDK_VER = 6.5.13 |
Thiyagarajan Subramani | 1f1280b | 2019-08-13 18:41:19 +0800 | [diff] [blame] | 37 | DEV_VER ?= 201908010203 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 38 | # |
| 39 | # Version of Open Network Linux (ONL). |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame] | 40 | ONL_KERN_VER_MAJOR = 4.14 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 41 | # |
| 42 | # Build directory |
| 43 | BUILD_DIR = build |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 44 | # |
| 45 | # GRPC installation |
| 46 | GRPC_ADDR = https://github.com/grpc/grpc |
| 47 | GRPC_DST = /tmp/grpc |
| 48 | GRPC_VER = v1.10.x |
Shad Ansari | 2cddc55 | 2018-06-26 20:34:27 +0000 | [diff] [blame] | 49 | |
| 50 | USER := $(shell echo $(USER)) |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 51 | # |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 52 | ######################################################################## |
| 53 | ## |
| 54 | ## |
Luca Prete | 08e6f80 | 2018-04-17 11:49:45 -0700 | [diff] [blame] | 55 | ## Install prerequisites |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 56 | ## |
| 57 | ## |
| 58 | HOST_SYSTEM = $(shell uname | cut -f 1 -d_) |
| 59 | SYSTEM ?= $(HOST_SYSTEM) |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 60 | |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 61 | LIBGRPC_PATH=$(shell pkg-config --libs-only-L grpc | sed s/-L// | sed s/\ //g) |
| 62 | LIBPROTOBUF_PATH=$(shell PKG_CONFIG_ALLOW_SYSTEM_LIBS=true pkg-config --libs-only-L protobuf | sed s/-L// | sed s/\ //g) |
| 63 | |
Jason Huang | 313ae31 | 2019-06-18 17:54:15 +0800 | [diff] [blame] | 64 | CXX = @CXX@-4.9 |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 65 | CXXFLAGS += @CXXFLAGS@ |
| 66 | CXXFLAGS += $(shell pkg-config --cflags-only-I grpc++) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 67 | CPPFLAGS += `pkg-config --cflags protobuf grpc` |
Craig Lutgen | 7ebee13 | 2018-11-16 15:31:11 -0600 | [diff] [blame] | 68 | CXXFLAGS += -std=c++11 -fpermissive -Wno-literal-suffix |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 69 | LDFLAGS += @LDFLAGS@ |
| 70 | LDFLAGS += `pkg-config --libs protobuf grpc++ grpc` -ldl -lgpr |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 71 | CXXFLAGSDEVICE = -I./device -I./device/$(OPENOLTDEVICE) -I./device/generic |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 72 | |
| 73 | export CXX CXXFLAGS |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 74 | |
Luca Prete | 08e6f80 | 2018-04-17 11:49:45 -0700 | [diff] [blame] | 75 | prereq: |
nick | 6fa8073 | 2018-05-22 14:47:10 -0400 | [diff] [blame] | 76 | sudo apt-get -q -y install git pkg-config build-essential autoconf libtool libgflags-dev libgtest-dev clang libc++-dev unzip docker.io |
Jason Huang | 313ae31 | 2019-06-18 17:54:15 +0800 | [diff] [blame] | 77 | sudo apt-get install -y build-essential autoconf libssl-dev gawk debhelper dh-systemd init-system-helpers curl cmake ccache g++-4.9 |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 78 | |
Shad Ansari | 563ea82 | 2018-06-28 14:56:27 +0000 | [diff] [blame] | 79 | # Install GRPC, libprotobuf and protoc |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 80 | rm -rf $(GRPC_DST) |
| 81 | git clone -b $(GRPC_VER) $(GRPC_ADDR) $(GRPC_DST) |
| 82 | cd $(GRPC_DST) && git submodule update --init |
Shad Ansari | 563ea82 | 2018-06-28 14:56:27 +0000 | [diff] [blame] | 83 | cd $(GRPC_DST)/third_party/protobuf && ./autogen.sh && ./configure |
Luca Prete | 08e6f80 | 2018-04-17 11:49:45 -0700 | [diff] [blame] | 84 | make -C $(GRPC_DST)/third_party/protobuf |
| 85 | sudo make -C $(GRPC_DST)/third_party/protobuf install |
| 86 | sudo ldconfig |
Shad Ansari | 563ea82 | 2018-06-28 14:56:27 +0000 | [diff] [blame] | 87 | make -C $(GRPC_DST) |
| 88 | sudo make -C $(GRPC_DST) install |
| 89 | sudo ldconfig |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 90 | |
Shad Ansari | 2cddc55 | 2018-06-26 20:34:27 +0000 | [diff] [blame] | 91 | docker: |
| 92 | echo $(USER) |
| 93 | sudo groupadd -f docker |
| 94 | ifneq "$(USER)" "" |
| 95 | sudo usermod -aG docker $(USER) |
| 96 | endif |
| 97 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 98 | ######################################################################## |
| 99 | ## |
| 100 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 101 | ## ONL |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 102 | ## |
| 103 | ## |
Thiyagarajan Subramani | 1f1280b | 2019-08-13 18:41:19 +0800 | [diff] [blame] | 104 | ONL_REPO = onl |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 105 | ONL_DIR = $(BUILD_DIR)/$(ONL_REPO) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 106 | onl: |
| 107 | if [ ! -d "$(ONL_DIR)/OpenNetworkLinux" ]; then \ |
| 108 | mkdir -p $(ONL_DIR); \ |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame] | 109 | git clone https://github.com/opencomputeproject/OpenNetworkLinux.git $(ONL_DIR)/OpenNetworkLinux; \ |
| 110 | cp download/Makefile.onl $(ONL_DIR)/Makefile; \ |
Thiyagarajan Subramani | 1f1280b | 2019-08-13 18:41:19 +0800 | [diff] [blame] | 111 | install -m 755 download/build-onl.sh $(ONL_DIR)/OpenNetworkLinux; \ |
| 112 | make -C $(ONL_DIR) onl-$(ONL_KERN_VER_MAJOR); \ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 113 | fi; |
| 114 | onl-force: |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 115 | make -C $(ONL_DIR) $(OPENOLTDEVICE)-$(ONL_KERN_VER_MAJOR) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 116 | distclean-onl: |
| 117 | sudo rm -rf $(ONL_DIR) |
| 118 | |
| 119 | ######################################################################## |
| 120 | ## |
| 121 | ## |
Jason Huang | d33b4d8 | 2019-05-15 18:22:57 +0800 | [diff] [blame] | 122 | ## Broadcom LIBRARY APIs |
| 123 | ## |
| 124 | ## |
| 125 | BAL_API_DIR = $(BUILD_DIR)/bal-api-$(BAL_API_VER) |
| 126 | |
| 127 | bal-api-$(BAL_API_VER): |
| 128 | if [ ! -d "$(BAL_API_DIR)" ]; then \ |
| 129 | mkdir -p $(BAL_API_DIR); \ |
Thiyagarajan Subramani | 1f1280b | 2019-08-13 18:41:19 +0800 | [diff] [blame] | 130 | git clone https://github.com/balapi/bal-api-$(BAL_API_VER).git $(BAL_API_DIR); \ |
Jason Huang | d33b4d8 | 2019-05-15 18:22:57 +0800 | [diff] [blame] | 131 | fi; |
| 132 | bal-api-clean: |
| 133 | rm $(BAL_API_DIR) |
| 134 | |
| 135 | ######################################################################## |
| 136 | ## |
| 137 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 138 | ## BAL |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 139 | ## |
| 140 | ## |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame] | 141 | BAL_ZIP = SW-BCM68620_$(subst .,_,$(BAL_VER)).tgz |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 142 | SDK_ZIP = sdk-all-$(SDK_VER).tar.gz |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 143 | ACCTON_PATCH = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER).patch |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 144 | BAL_DIR = $(BUILD_DIR)/$(OPENOLTDEVICE)-bal |
Jason Huang | d33b4d8 | 2019-05-15 18:22:57 +0800 | [diff] [blame] | 145 | BCM_SDK = $(BAL_DIR)/switch_sdk/$(SDK_VER) |
| 146 | BALLIBDIR = $(BAL_DIR)/build/host_reference/host_api |
| 147 | BALLIBNAME = bal_host_api |
| 148 | BAL_INC = -I$(BAL_DIR)/host_driver/bal/bal_include \ |
| 149 | -I$(BAL_DIR)/host_driver/topology \ |
| 150 | -I$(BAL_DIR)/host_driver/utils \ |
| 151 | -I$(BAL_DIR)/host_driver/api \ |
| 152 | -I$(BAL_DIR)/host_customized/os_abstraction \ |
| 153 | -I$(BAL_DIR)/host_customized/os_abstraction/posix \ |
| 154 | -I$(BAL_DIR)/host_customized/config \ |
| 155 | -I$(BAL_DIR)/host_driver/api_conn_mgr \ |
| 156 | -I$(BAL_DIR)/host_driver/conn_mgr \ |
| 157 | -I$(BAL_DIR)/host_driver/api/host/topology \ |
| 158 | -I$(BAL_DIR)/host_reference/cli \ |
| 159 | -I$(BAL_DIR)/host_reference/api_cli \ |
| 160 | -I$(BAL_API_DIR)/include \ |
| 161 | -I$(BAL_API_DIR)/include/object_model |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 162 | CXXFLAGS += $(BAL_INC) -I $(BAL_DIR)/lib/cmdline |
Jason Huang | d33b4d8 | 2019-05-15 18:22:57 +0800 | [diff] [blame] | 163 | CXXFLAGS += -DBCMOS_MSG_QUEUE_DOMAIN_SOCKET -DBCMOS_MSG_QUEUE_UDP_SOCKET -DBCMOS_MEM_CHECK -DBCMOS_SYS_UNITTEST -DENABLE_LOG -DENABLE_CLI |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 164 | |
Jason Huang | d33b4d8 | 2019-05-15 18:22:57 +0800 | [diff] [blame] | 165 | sdk: onl bal-api-$(BAL_API_VER) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 166 | ifeq ("$(wildcard $(BAL_DIR))","") |
| 167 | mkdir $(BAL_DIR) |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame] | 168 | tar zxvf download/$(BAL_ZIP) --strip 1 -C $(BAL_DIR) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 169 | cp download/$(SDK_ZIP) $(BCM_SDK) |
| 170 | chmod -R 744 $(BAL_DIR) |
| 171 | cat download/$(ACCTON_PATCH) | patch -p1 -d $(BAL_DIR) |
Jason Huang | b6843dc | 2019-07-22 17:46:06 +0800 | [diff] [blame] | 172 | make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) ONL_DIR=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux OPEN_SOURCE=y |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame] | 173 | make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 174 | endif |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 175 | |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame] | 176 | bal-release: sdk |
Jason Huang | af7f647 | 2019-05-04 03:19:07 +0800 | [diff] [blame] | 177 | make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 178 | |
| 179 | bal-clean: |
Thiyagarajan Subramani | 1f1280b | 2019-08-13 18:41:19 +0800 | [diff] [blame] | 180 | make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) clean_all |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 181 | |
| 182 | ######################################################################## |
| 183 | ## |
| 184 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 185 | ## OpenOLT API |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 186 | ## |
| 187 | ## |
Shad Ansari | 56c8ea4 | 2018-10-30 19:34:35 +0000 | [diff] [blame] | 188 | OPENOLT_PROTOS_DIR = ../protos |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 189 | OPENOLT_API_LIB = $(OPENOLT_PROTOS_DIR)/libopenoltapi.a |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 190 | CXXFLAGS += -I$(OPENOLT_PROTOS_DIR) -I$(OPENOLT_PROTOS_DIR)/googleapis/gens |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 191 | protos: |
| 192 | make -C $(OPENOLT_PROTOS_DIR) all |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 193 | protos-clean: |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 194 | -make -C $(OPENOLT_PROTOS_DIR) clean |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 195 | |
| 196 | ######################################################################## |
| 197 | ## |
| 198 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 199 | ## common |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 200 | ## |
| 201 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 202 | common/%.o: common/%.cc |
| 203 | $(CXX) $(CXXFLAGS) -I./common -c $< -o $@ |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 204 | |
| 205 | ######################################################################## |
| 206 | ## |
| 207 | ## |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 208 | ## device |
| 209 | ## |
| 210 | ## |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 211 | device/$(OPENOLTDEVICE)/%.o: device/$(OPENOLTDEVICE)/%.cc |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 212 | $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -c $< -o $@ |
| 213 | |
| 214 | device/generic/%.o: device/generic/%.cc |
| 215 | $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -c $< -o $@ |
| 216 | |
| 217 | ######################################################################## |
| 218 | ## |
| 219 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 220 | ## sim |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 221 | ## |
| 222 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 223 | SIM_SRCS = $(wildcard sim/*.cc) $(wildcard common/*.cc) |
| 224 | SIM_OBJS = $(SIM_SRCS:.cc=.o) |
| 225 | SIM_DEPS = $(SIM_SRCS:.cc=.d) |
| 226 | sim: sim/openoltsim |
| 227 | sim/openoltsim: protos $(SIM_OBJS) |
| 228 | $(CXX) -pthread -L/usr/local/lib $(SIM_OBJS) $(OPENOLT_API_LIB) /usr/local/lib/libprotobuf.a -o $@ -lgrpc++ -lgrpc -lpthread -ldl |
| 229 | sim/%.o: sim/%.cc |
| 230 | $(CXX) -std=c++11 -fpermissive -Wno-literal-suffix -I./common -I$(OPENOLT_PROTOS_DIR) -I$(OPENOLT_PROTOS_DIR)/googleapis/gens -c $< -o $@ |
| 231 | clean-sim: |
| 232 | rm -f sim/openoltsim $(SIM_OBJS) $(SIM_DEPS) |
| 233 | |
| 234 | ######################################################################## |
| 235 | ## |
| 236 | ## |
| 237 | ## openolt |
| 238 | ## |
| 239 | ## |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame] | 240 | SRCS = $(wildcard src/*.cc) $(wildcard common/*.cc) $(wildcard device/$(OPENOLTDEVICE)/*.cc) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 241 | OBJS = $(SRCS:.cc=.o) |
| 242 | DEPS = $(SRCS:.cc=.d) |
| 243 | .DEFAULT_GOAL := all |
Jason Huang | d33b4d8 | 2019-05-15 18:22:57 +0800 | [diff] [blame] | 244 | all: $(BUILD_DIR)/openolt |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 245 | $(BUILD_DIR)/openolt: sdk protos $(OBJS) |
Shad Ansari | 06a1332 | 2018-09-29 01:55:33 +0000 | [diff] [blame] | 246 | $(CXX) $(LDFLAGS) -L$(BALLIBDIR) $(OBJS) $(OPENOLT_API_LIB) $(LIBPROTOBUF_PATH)/libprotobuf.a -o $@ -l$(BALLIBNAME) $(shell pkg-config --libs protobuf grpc++ grpc) |
Jason Huang | d33b4d8 | 2019-05-15 18:22:57 +0800 | [diff] [blame] | 247 | ln -sf $(TOP_DIR)/$(BAL_DIR)/build/fs/$(OPENOLTDEVICE)/release/release_$(OPENOLTDEVICE)_V$(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER).$(DEV_VER).tar.gz $(BUILD_DIR)/. |
| 248 | ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_reference/host_api/strip/libbal_host_api.so $(BUILD_DIR)/. |
| 249 | ln -sf $(TOP_DIR)/$(BAL_DIR)/build/host_driver/dev_mgmt_daemon/dev_mgmt_daemon $(BUILD_DIR)/. |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 250 | ln -sf $(LIBGRPC_PATH)/libgrpc.so.6 $(BUILD_DIR)/libgrpc.so.6 |
| 251 | ln -sf $(LIBGRPC_PATH)/libgrpc++.so.1 $(BUILD_DIR)/libgrpc++.so.1 |
Jason Huang | d33b4d8 | 2019-05-15 18:22:57 +0800 | [diff] [blame] | 252 | ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $(BUILD_DIR)/libstdc++.so.6 |
Jason Huang | fd78f66 | 2019-06-05 20:25:01 +0800 | [diff] [blame] | 253 | strip $(BUILD_DIR)/openolt |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 254 | src/%.o: src/%.cc |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 255 | $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -I./common -c $< -o $@ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 256 | |
Shad Ansari | 6cd46a6 | 2018-05-13 23:20:51 +0000 | [diff] [blame] | 257 | deb: |
Thiyagarajan Subramani | 1f1280b | 2019-08-13 18:41:19 +0800 | [diff] [blame] | 258 | cp $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER).$(DEV_VER).tar.gz device/$(OPENOLTDEVICE)/mkdebian/debian |
| 259 | cp $(BUILD_DIR)/openolt device/$(OPENOLTDEVICE)/mkdebian/debian |
| 260 | cp $(BUILD_DIR)/libgrpc.so.6 device/$(OPENOLTDEVICE)/mkdebian/debian |
| 261 | cp $(BUILD_DIR)/libgrpc++.so.1 device/$(OPENOLTDEVICE)/mkdebian/debian |
| 262 | cp $(BUILD_DIR)/libstdc++.so.6 device/$(OPENOLTDEVICE)/mkdebian/debian |
| 263 | cp $(BUILD_DIR)/libbal_host_api.so device/$(OPENOLTDEVICE)/mkdebian/debian |
| 264 | cp -a scripts/init.d device/$(OPENOLTDEVICE)/mkdebian/debian |
| 265 | cd device/$(OPENOLTDEVICE)/mkdebian && ./build_$(OPENOLTDEVICE)_deb.sh |
| 266 | mv device/$(OPENOLTDEVICE)/*.deb $(BUILD_DIR)/openolt_$(OPENOLTDEVICE).deb |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 267 | make deb-cleanup |
Shad Ansari | 6cd46a6 | 2018-05-13 23:20:51 +0000 | [diff] [blame] | 268 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 269 | src/%.o: %.cpp |
| 270 | $(CXX) -MMD -c $< -o $@ |
| 271 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 272 | deb-cleanup: |
Thiyagarajan Subramani | 1f1280b | 2019-08-13 18:41:19 +0800 | [diff] [blame] | 273 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).debhelper.log |
| 274 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).postinst.debhelper |
| 275 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).postrm.debhelper |
| 276 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE).substvars |
| 277 | @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/$(OPENOLTDEVICE)/ |
| 278 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/debhelper-build-stamp |
| 279 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libgrpc++.so.1 |
| 280 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libgrpc.so.6 |
| 281 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libstdc++.so.6 |
| 282 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/libbal_host_api.so |
| 283 | @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/init.d/ |
| 284 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/openolt |
| 285 | @rm -f device/$(OPENOLTDEVICE)/mkdebian/debian/release_$(OPENOLTDEVICE)_V$(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER).$(DEV_VER).tar.gz |
| 286 | @rm -rf device/$(OPENOLTDEVICE)/mkdebian/debian/tmp/ |
| 287 | @rm -f device/$(OPENOLTDEVICE)/$(OPENOLTDEVICE)_$(BAL_VER)+edgecore-V$(DEV_VER)_amd64.changes |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 288 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 289 | clean: protos-clean deb-cleanup |
Thiyagarajan Subramani | 1f1280b | 2019-08-13 18:41:19 +0800 | [diff] [blame] | 290 | @rm -f $(OBJS) $(DEPS) |
| 291 | @rm -rf $(OPENOLT_PROTOS_DIR)/googleapis |
| 292 | @rm -f $(BUILD_DIR)/libgrpc.so.6 $(BUILD_DIR)/libgrpc++.so.1 |
| 293 | @rm -f $(BUILD_DIR)/libbal_api_dist.so |
| 294 | @rm -f $(BUILD_DIR)/openolt |
| 295 | @rm -f $(BUILD_DIR)/bal_core_dist |
| 296 | @rm -f $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_MAJOR_VER).$(DEV_VER).tar.gz |
| 297 | @rm -f $(BUILD_DIR)/openolt.deb |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 298 | |
Thiyagarajan Subramani | 1f1280b | 2019-08-13 18:41:19 +0800 | [diff] [blame] | 299 | clean-src: protos-clean |
| 300 | @rm -f $(OBJS) $(DEPS) |
| 301 | |
| 302 | distclean: clean-src clean |
| 303 | @rm -rf $(BUILD_DIR) |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 304 | |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 305 | .PHONY: onl sdk bal protos prereq sim |