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 | ## |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 22 | OPENOLTDEVICE ?= generic |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 23 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 24 | # |
| 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 Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 28 | # ACCTON_BAL_<BAL_VER>-<DEV_VER>.patch - Accton/Edgecore's patch. |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 29 | BAL_MAJOR_VER = 02.06 |
| 30 | BAL_VER = 2.6.0.1 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 31 | SDK_VER = 6.5.7 |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 32 | DEV_VER ?= 201804301043 |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 33 | # |
| 34 | # Version of Open Network Linux (ONL). |
| 35 | ONL_KERN_VER_MAJOR = 3.7 |
| 36 | ONL_KERN_VER_MINOR = 10 |
| 37 | # |
| 38 | # Build directory |
| 39 | BUILD_DIR = build |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 40 | # |
| 41 | # GRPC installation |
| 42 | GRPC_ADDR = https://github.com/grpc/grpc |
| 43 | GRPC_DST = /tmp/grpc |
| 44 | GRPC_VER = v1.10.x |
Shad Ansari | 2cddc55 | 2018-06-26 20:34:27 +0000 | [diff] [blame] | 45 | |
| 46 | USER := $(shell echo $(USER)) |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 47 | # |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 48 | ######################################################################## |
| 49 | ## |
| 50 | ## |
Luca Prete | 08e6f80 | 2018-04-17 11:49:45 -0700 | [diff] [blame] | 51 | ## Install prerequisites |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 52 | ## |
| 53 | ## |
| 54 | HOST_SYSTEM = $(shell uname | cut -f 1 -d_) |
| 55 | SYSTEM ?= $(HOST_SYSTEM) |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 56 | |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 57 | LIBGRPC_PATH=$(shell pkg-config --libs-only-L grpc | sed s/-L// | sed s/\ //g) |
| 58 | LIBPROTOBUF_PATH=$(shell PKG_CONFIG_ALLOW_SYSTEM_LIBS=true pkg-config --libs-only-L protobuf | sed s/-L// | sed s/\ //g) |
| 59 | |
| 60 | CXX = @CXX@ |
| 61 | CXXFLAGS += @CXXFLAGS@ |
| 62 | CXXFLAGS += $(shell pkg-config --cflags-only-I grpc++) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 63 | CPPFLAGS += `pkg-config --cflags protobuf grpc` |
| 64 | CXXFLAGS += -std=c++11 -fpermissive -Wno-literal-suffix |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 65 | LDFLAGS += @LDFLAGS@ |
| 66 | LDFLAGS += `pkg-config --libs protobuf grpc++ grpc` -ldl -lgpr |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 67 | CXXFLAGSDEVICE = -I./device -I./device/$(OPENOLTDEVICE) -I./device/generic |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 68 | |
| 69 | export CXX CXXFLAGS |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 70 | |
Luca Prete | 08e6f80 | 2018-04-17 11:49:45 -0700 | [diff] [blame] | 71 | prereq: |
nick | 6fa8073 | 2018-05-22 14:47:10 -0400 | [diff] [blame] | 72 | sudo apt-get -q -y install git pkg-config build-essential autoconf libtool libgflags-dev libgtest-dev clang libc++-dev unzip docker.io |
| 73 | 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] | 74 | |
Shad Ansari | 563ea82 | 2018-06-28 14:56:27 +0000 | [diff] [blame] | 75 | # Install GRPC, libprotobuf and protoc |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 76 | rm -rf $(GRPC_DST) |
| 77 | git clone -b $(GRPC_VER) $(GRPC_ADDR) $(GRPC_DST) |
| 78 | cd $(GRPC_DST) && git submodule update --init |
Shad Ansari | 563ea82 | 2018-06-28 14:56:27 +0000 | [diff] [blame] | 79 | cd $(GRPC_DST)/third_party/protobuf && ./autogen.sh && ./configure |
Luca Prete | 08e6f80 | 2018-04-17 11:49:45 -0700 | [diff] [blame] | 80 | make -C $(GRPC_DST)/third_party/protobuf |
| 81 | sudo make -C $(GRPC_DST)/third_party/protobuf install |
| 82 | sudo ldconfig |
Shad Ansari | 563ea82 | 2018-06-28 14:56:27 +0000 | [diff] [blame] | 83 | make -C $(GRPC_DST) |
| 84 | sudo make -C $(GRPC_DST) install |
| 85 | sudo ldconfig |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 86 | |
Shad Ansari | 2cddc55 | 2018-06-26 20:34:27 +0000 | [diff] [blame] | 87 | docker: |
| 88 | echo $(USER) |
| 89 | sudo groupadd -f docker |
| 90 | ifneq "$(USER)" "" |
| 91 | sudo usermod -aG docker $(USER) |
| 92 | endif |
| 93 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 94 | ######################################################################## |
| 95 | ## |
| 96 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 97 | ## ONL |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 98 | ## |
| 99 | ## |
| 100 | ONL_KERN_VER = $(ONL_KERN_VER_MAJOR).$(ONL_KERN_VER_MINOR) |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 101 | ONL_REPO = $(OPENOLTDEVICE)-onl |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 102 | ONL_DIR = $(BUILD_DIR)/$(ONL_REPO) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 103 | onl: |
| 104 | if [ ! -d "$(ONL_DIR)/OpenNetworkLinux" ]; then \ |
| 105 | mkdir -p $(ONL_DIR); \ |
Luca Prete | b788628 | 2018-04-06 15:34:08 -0700 | [diff] [blame] | 106 | git clone https://gerrit.opencord.org/$(ONL_REPO) $(ONL_DIR); \ |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 107 | make -C $(ONL_DIR) $(OPENOLTDEVICE)-$(ONL_KERN_VER_MAJOR); \ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 108 | fi; |
| 109 | onl-force: |
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 | distclean-onl: |
| 112 | sudo rm -rf $(ONL_DIR) |
| 113 | |
| 114 | ######################################################################## |
| 115 | ## |
| 116 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 117 | ## BAL |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 118 | ## |
| 119 | ## |
| 120 | BAL_ZIP = SW-BCM68620_$(subst .,_,$(BAL_VER)).zip |
| 121 | SDK_ZIP = sdk-all-$(SDK_VER).tar.gz |
Craig Lutgen | f040dba | 2018-09-27 11:21:43 -0500 | [diff] [blame] | 122 | ACCTON_PATCH = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER).patch |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 123 | OPENOLT_BAL_PATCH = OPENOLT_BAL_$(BAL_VER).patch |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 124 | BAL_DIR = $(BUILD_DIR)/$(OPENOLTDEVICE)-bal |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 125 | ONL_KERNDIR = $(PWD)/$(ONL_DIR)/OpenNetworkLinux/packages/base/amd64/kernels/kernel-$(ONL_KERN_VER_MAJOR)-x86-64-all/builds |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 126 | MAPLE_KERNDIR = $(BAL_DIR)/bcm68620_release/$(OPENOLTDEVICE)/kernels |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 127 | BCM_SDK = $(BAL_DIR)/bal_release/3rdparty/bcm-sdk |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 128 | BALLIBDIR = $(BAL_DIR)/bal_release/build/core/src/apps/bal_api_dist_shared_lib |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 129 | BALLIBNAME = bal_api_dist |
| 130 | BAL_INC = -I$(BAL_DIR)/bal_release/src/common/os_abstraction \ |
| 131 | -I$(BAL_DIR)/bal_release/src/common/os_abstraction/posix \ |
| 132 | -I$(BAL_DIR)/bal_release/src/common/config \ |
| 133 | -I$(BAL_DIR)/bal_release/src/core/platform \ |
Nicolas Palpacuer | 0f19b1a | 2018-06-07 17:29:31 -0400 | [diff] [blame] | 134 | -I$(BAL_DIR)/bal_release/src/core/main \ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 135 | -I$(BAL_DIR)/bal_release/src/common/include \ |
| 136 | -I$(BAL_DIR)/bal_release/src/lib/libbalapi \ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 137 | -I$(BAL_DIR)/bal_release/src/balapiend \ |
| 138 | -I$(BAL_DIR)/bal_release/src/common/dev_log \ |
| 139 | -I$(BAL_DIR)/bal_release/src/common/bal_dist_utils \ |
| 140 | -I$(BAL_DIR)/bal_release/src/lib/libtopology \ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 141 | -I$(BAL_DIR)/bal_release/src/lib/libcmdline \ |
| 142 | -I$(BAL_DIR)/bal_release/src/lib/libutils \ |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 143 | -I$(BAL_DIR)/bal_release/3rdparty/maple/sdk/host_driver/utils \ |
| 144 | -I$(BAL_DIR)/bal_release/3rdparty/maple/sdk/host_driver/model \ |
| 145 | -I$(BAL_DIR)/bal_release/3rdparty/maple/sdk/host_driver/api \ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 146 | -I$(BAL_DIR)/bal_release/3rdparty/maple/sdk/host_reference/cli |
| 147 | CXXFLAGS += $(BAL_INC) -I $(BAL_DIR)/lib/cmdline |
Nicolas Palpacuer | 967438f | 2018-09-07 14:41:54 -0400 | [diff] [blame] | 148 | 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] | 149 | |
| 150 | sdk: onl |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 151 | ifeq ("$(wildcard $(BAL_DIR))","") |
| 152 | mkdir $(BAL_DIR) |
| 153 | unzip download/$(BAL_ZIP) -d $(BAL_DIR) |
| 154 | cp download/$(SDK_ZIP) $(BCM_SDK) |
| 155 | chmod -R 744 $(BAL_DIR) |
| 156 | cat download/$(ACCTON_PATCH) | patch -p1 -d $(BAL_DIR) |
| 157 | mkdir -p $(MAPLE_KERNDIR) |
| 158 | ln -s $(ONL_KERNDIR)/linux-$(ONL_KERN_VER) $(MAPLE_KERNDIR)/linux-$(ONL_KERN_VER) |
| 159 | ln -s $(ONL_DIR)/OpenNetworkLinux/packages/base/any/kernels/archives/linux-$(ONL_KERN_VER).tar.xz $(MAPLE_KERNDIR)/linux-$(ONL_KERN_VER).tar.xz |
| 160 | ln -s $(ONL_DIR)/OpenNetworkLinux/packages/base/any/kernels/$(ONL_KERN_VER_MAJOR)/configs/x86_64-all/x86_64-all.config $(MAPLE_KERNDIR)/x86_64-all.config |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 161 | make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) maple_sdk_dir |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 162 | cat download/$(OPENOLT_BAL_PATCH) | patch -p1 -d $(BAL_DIR) |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 163 | make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) maple_sdk |
| 164 | make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) switch_sdk_dir |
| 165 | make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) switch_sdk |
| 166 | KERNDIR=$(ONL_KERNDIR)/linux-$(ONL_KERN_VER) BOARD=$(OPENOLTDEVICE) ARCH=x86_64 SDKBUILD=build_bcm_user make -C $(BCM_SDK)/build-$(OPENOLTDEVICE)/sdk-all-$(SDK_VER)/systems/linux/user/x86-generic_64-2_6 |
| 167 | make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) bal |
| 168 | echo 'auto_create_interface_tm=y' >> $(BAL_DIR)/bal_release/3rdparty/maple/cur/$(OPENOLTDEVICE)/board_files/broadcom/bal_config.ini |
| 169 | make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) release_board |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 170 | endif |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 171 | |
| 172 | bal: sdk |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 173 | make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) bal |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 174 | echo 'auto_create_interface_tm=y' >> $(BAL_DIR)/bal_release/3rdparty/maple/cur/asfvolt16/board_files/broadcom/bal_config.ini |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 175 | make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) release_board |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 176 | |
| 177 | bal-clean: |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 178 | make -C $(BAL_DIR)/bal_release BOARD=$(OPENOLTDEVICE) clean_bal |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 179 | |
| 180 | ######################################################################## |
| 181 | ## |
| 182 | ## |
Luca Prete | e75aaa5 | 2018-04-13 12:19:12 -0700 | [diff] [blame] | 183 | ## OpenOLT API |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 184 | ## |
| 185 | ## |
Shad Ansari | c13de21 | 2018-10-24 06:11:27 +0000 | [diff] [blame] | 186 | OPENOLT_PROTOS_DIR = ./protos |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 187 | OPENOLT_API_LIB = $(OPENOLT_PROTOS_DIR)/libopenoltapi.a |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 188 | CXXFLAGS += -I$(OPENOLT_PROTOS_DIR) -I$(OPENOLT_PROTOS_DIR)/googleapis/gens |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 189 | protos: |
| 190 | make -C $(OPENOLT_PROTOS_DIR) all |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 191 | protos-clean: |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 192 | -make -C $(OPENOLT_PROTOS_DIR) clean |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 193 | |
| 194 | ######################################################################## |
| 195 | ## |
| 196 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 197 | ## common |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 198 | ## |
| 199 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 200 | common/%.o: common/%.cc |
| 201 | $(CXX) $(CXXFLAGS) -I./common -c $< -o $@ |
Shad Ansari | 7193ae2 | 2018-08-08 22:23:18 +0000 | [diff] [blame] | 202 | |
| 203 | ######################################################################## |
| 204 | ## |
| 205 | ## |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 206 | ## device |
| 207 | ## |
| 208 | ## |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 209 | device/$(OPENOLTDEVICE)/%.o: device/$(OPENOLTDEVICE)/%.cc |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 210 | $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -c $< -o $@ |
| 211 | |
| 212 | device/generic/%.o: device/generic/%.cc |
| 213 | $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -c $< -o $@ |
| 214 | |
| 215 | ######################################################################## |
| 216 | ## |
| 217 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 218 | ## sim |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 219 | ## |
| 220 | ## |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 221 | SIM_SRCS = $(wildcard sim/*.cc) $(wildcard common/*.cc) |
| 222 | SIM_OBJS = $(SIM_SRCS:.cc=.o) |
| 223 | SIM_DEPS = $(SIM_SRCS:.cc=.d) |
| 224 | sim: sim/openoltsim |
| 225 | sim/openoltsim: protos $(SIM_OBJS) |
| 226 | $(CXX) -pthread -L/usr/local/lib $(SIM_OBJS) $(OPENOLT_API_LIB) /usr/local/lib/libprotobuf.a -o $@ -lgrpc++ -lgrpc -lpthread -ldl |
| 227 | sim/%.o: sim/%.cc |
| 228 | $(CXX) -std=c++11 -fpermissive -Wno-literal-suffix -I./common -I$(OPENOLT_PROTOS_DIR) -I$(OPENOLT_PROTOS_DIR)/googleapis/gens -c $< -o $@ |
| 229 | clean-sim: |
| 230 | rm -f sim/openoltsim $(SIM_OBJS) $(SIM_DEPS) |
| 231 | |
| 232 | ######################################################################## |
| 233 | ## |
| 234 | ## |
| 235 | ## openolt |
| 236 | ## |
| 237 | ## |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 238 | SRCS = $(wildcard src/*.cc) $(wildcard common/*.cc) $(wildcard device/$(OPENOLTDEVICE)/*.cc) |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 239 | OBJS = $(SRCS:.cc=.o) |
| 240 | DEPS = $(SRCS:.cc=.d) |
| 241 | .DEFAULT_GOAL := all |
| 242 | all: $(BUILD_DIR)/openolt |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 243 | $(BUILD_DIR)/openolt: sdk protos $(OBJS) |
Shad Ansari | 06a1332 | 2018-09-29 01:55:33 +0000 | [diff] [blame] | 244 | $(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^] | 245 | ln -sf $(PWD)/$(BAL_DIR)/bcm68620_release/$(OPENOLTDEVICE)/release/release_$(OPENOLTDEVICE)_V$(BAL_MAJOR_VER).$(DEV_VER).tar.gz $(BUILD_DIR)/. |
| 246 | 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] | 247 | 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] | 248 | ln -sf $(LIBGRPC_PATH)/libgrpc.so.6 $(BUILD_DIR)/libgrpc.so.6 |
| 249 | ln -sf $(LIBGRPC_PATH)/libgrpc++.so.1 $(BUILD_DIR)/libgrpc++.so.1 |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 250 | src/%.o: src/%.cc |
Craig Lutgen | 88a22ad | 2018-10-04 12:30:46 -0500 | [diff] [blame] | 251 | $(CXX) $(CXXFLAGS) $(CXXFLAGSDEVICE) -I./common -c $< -o $@ |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 252 | |
Shad Ansari | 6cd46a6 | 2018-05-13 23:20:51 +0000 | [diff] [blame] | 253 | deb: |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 254 | 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] | 255 | cp $(BUILD_DIR)/openolt mkdebian/debian |
| 256 | cp $(BUILD_DIR)/libgrpc.so.6 mkdebian/debian |
| 257 | cp $(BUILD_DIR)/libgrpc++.so.1 mkdebian/debian |
Shad Ansari | d0eaf75 | 2018-08-16 00:26:12 +0000 | [diff] [blame] | 258 | cp -a scripts/init.d mkdebian/debian |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 259 | cd mkdebian && ./build_$(OPENOLTDEVICE)_deb.sh |
Shad Ansari | 6cd46a6 | 2018-05-13 23:20:51 +0000 | [diff] [blame] | 260 | mv *.deb $(BUILD_DIR)/openolt.deb |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 261 | make deb-cleanup |
Shad Ansari | 6cd46a6 | 2018-05-13 23:20:51 +0000 | [diff] [blame] | 262 | |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 263 | src/%.o: %.cpp |
| 264 | $(CXX) -MMD -c $< -o $@ |
| 265 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 266 | deb-cleanup: |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 267 | rm -f mkdebian/debian/$(OPENOLTDEVICE).debhelper.log |
| 268 | rm -f mkdebian/debian/$(OPENOLTDEVICE).postinst.debhelper |
| 269 | rm -f mkdebian/debian/$(OPENOLTDEVICE).postrm.debhelper |
| 270 | rm -f mkdebian/debian/$(OPENOLTDEVICE).substvars |
| 271 | rm -rf mkdebian/debian/$(OPENOLTDEVICE)/ |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 272 | rm -f mkdebian/debian/libgrpc++.so.1 |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 273 | rm -f mkdebian/debian/libgrpc.so.6 |
| 274 | rm -f mkdebian/debian/openolt |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 275 | 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] | 276 | rm -rf mkdebian/debian/tmp/ |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 277 | rm -f $(OPENOLTDEVICE)_$(BAL_VER)+edgecore-V$(DEV_VER)_amd64.changes |
Shad Ansari | cc01de1 | 2018-05-21 22:54:45 +0000 | [diff] [blame] | 278 | |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 279 | clean: protos-clean deb-cleanup |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 280 | rm -f $(OBJS) $(DEPS) |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 281 | rm -rf protos/googleapis |
Shad Ansari | 563ea82 | 2018-06-28 14:56:27 +0000 | [diff] [blame] | 282 | rm -f $(BUILD_DIR)/libgrpc.so.6 $(BUILD_DIR)/libgrpc++.so.1 |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 283 | rm -f $(BUILD_DIR)/libbal_api_dist.so |
| 284 | rm -f $(BUILD_DIR)/openolt |
| 285 | rm -f $(BUILD_DIR)/bal_core_dist |
Shad Ansari | 9acc973 | 2018-10-30 18:01:44 +0000 | [diff] [blame^] | 286 | 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] | 287 | rm -f $(BUILD_DIR)/openolt.deb |
Shad Ansari | 1924958 | 2018-04-30 04:31:00 +0000 | [diff] [blame] | 288 | |
| 289 | distclean: |
Shad Ansari | 01b0e65 | 2018-04-05 21:02:53 +0000 | [diff] [blame] | 290 | rm -rf $(BUILD_DIR) |
Shad Ansari | cb004c5 | 2018-05-30 18:07:23 +0000 | [diff] [blame] | 291 | |
Shad Ansari | 627b578 | 2018-08-13 22:49:32 +0000 | [diff] [blame] | 292 | .PHONY: onl sdk bal protos prereq sim |