Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | 14628cd | 2023-01-10 08:38:31 -0500 | [diff] [blame] | 3 | # Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 16 | # ----------------------------------------------------------------------- |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 17 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 18 | $(if $(DEBUG),$(warning ENTER)) |
| 19 | |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 20 | .DEFAULT_GOAL := help |
| 21 | MAKECMDGOALS ?= help |
| 22 | |
| 23 | TOP ?= . |
| 24 | MAKEDIR ?= $(TOP)/makefiles |
| 25 | |
| 26 | ##--------------------## |
| 27 | ##---] INCLUDES [---## |
| 28 | ##--------------------## |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 29 | include $(MAKEDIR)/include.mk |
| 30 | include $(MAKEDIR)/release/include.mk |
| 31 | |
| 32 | ##--------------------## |
| 33 | ##---] INCLUDES [---## |
| 34 | ##--------------------## |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 35 | help-targets := help-all help HELP |
| 36 | $(if $(filter $(help-targets),$(MAKECMDGOALS))\ |
| 37 | ,$(eval include $(MAKEDIR)/help.mk)) |
| 38 | |
| 39 | ##-------------------## |
| 40 | ##---] GLOBALS [---## |
| 41 | ##-------------------## |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 42 | VERSION ?= $(shell cat ./VERSION) |
Matteo Scandolo | 84f7d48 | 2019-08-08 19:00:47 -0700 | [diff] [blame] | 43 | DIFF ?= $(git diff --shortstat 2> /dev/null | tail -n1) |
Zdravko Bozakov | 2da7634 | 2019-10-21 09:47:35 +0200 | [diff] [blame] | 44 | GIT_STATUS ?= $(shell [ -z "$DIFF" ] && echo "Dirty" || echo "Clean") |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 45 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 46 | include $(MAKEDIR)/tools.mk # Command macros for DOCKER_*, GO_* |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 47 | |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 48 | ## use local vars to shorten paths |
| 49 | bbsim-tag = ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}bbsim:${DOCKER_TAG} |
| 50 | |
Joey Armstrong | 5c61077 | 2023-01-23 16:03:32 -0500 | [diff] [blame] | 51 | ## ----------------------------------------------------------------------- |
| 52 | ## ----------------------------------------------------------------------- |
| 53 | |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 54 | # Public targets |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 55 | all: help |
| 56 | |
hkouser | 24361d4 | 2020-12-14 19:21:47 +0530 | [diff] [blame] | 57 | protos: api/bbsim/bbsim.pb.go api/bbsim/bbsim.pb.gw.go api/legacy/bbsim.pb.go api/legacy/bbsim.pb.gw.go api/bbsim/bbsim_dmi.pb.go # @HELP Build proto files |
Matteo Scandolo | 01d41ce | 2019-10-28 15:42:47 -0700 | [diff] [blame] | 58 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 59 | ## ----------------------------------------------------------------------- |
| 60 | ## Intent: Build tools for use on localhost |
| 61 | ## ----------------------------------------------------------------------- |
| 62 | build-target-deps += build-bbsim |
| 63 | build-target-deps += build-bbsimctl |
| 64 | build-target-deps += build-bbr |
| 65 | |
| 66 | .PHONY: build $(build-target-deps) |
| 67 | build: protos $(build-target-deps) |
| 68 | |
| 69 | ## ----------------------------------------------------------------------- |
| 70 | ## Intent: Cross-compile binaries for release |
| 71 | ## ----------------------------------------------------------------------- |
| 72 | release-target-deps += release-bbr |
| 73 | release-target-deps += release-bbsim |
| 74 | release-target-deps += release-bbsimctl |
| 75 | |
| 76 | .PHONY: release $(release-target-deps) |
| 77 | release: $(release-target-deps) |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 78 | |
| 79 | ## lint and unit tests |
| 80 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 81 | ## ----------------------------------------------------------------------- |
| 82 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 83 | lint-dockerfile: |
| 84 | @echo "Running Dockerfile lint check..." |
| 85 | @${HADOLINT} $$(find ./build -name "Dockerfile*") |
| 86 | @echo "Dockerfile lint check OK" |
| 87 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 88 | ## ----------------------------------------------------------------------- |
| 89 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 90 | lint-mod: |
| 91 | @echo "Running dependency check..." |
| 92 | @${GO} mod verify |
| 93 | @echo "Dependency check OK. Running vendor check..." |
| 94 | @git status > /dev/null |
| 95 | @git diff-index --quiet HEAD -- go.mod go.sum vendor || (echo "ERROR: Staged or modified files must be committed before running this test" && git status -- go.mod go.sum vendor && exit 1) |
| 96 | @[[ `git ls-files --exclude-standard --others go.mod go.sum vendor` == "" ]] || (echo "ERROR: Untracked files must be cleaned up before running this test" && git status -- go.mod go.sum vendor && exit 1) |
| 97 | ${GO} mod tidy |
| 98 | ${GO} mod vendor |
| 99 | @git status > /dev/null |
| 100 | @git diff-index --quiet HEAD -- go.mod go.sum vendor || (echo "ERROR: Modified files detected after running go mod tidy / go mod vendor" && git status -- go.mod go.sum vendor && git checkout -- go.mod go.sum vendor && exit 1) |
| 101 | @[[ `git ls-files --exclude-standard --others go.mod go.sum vendor` == "" ]] || (echo "ERROR: Untracked files detected after running go mod tidy / go mod vendor" && git status -- go.mod go.sum vendor && git checkout -- go.mod go.sum vendor && exit 1) |
| 102 | @echo "Vendor check OK." |
| 103 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 104 | ## ----------------------------------------------------------------------- |
| 105 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 106 | lint: lint-mod lint-dockerfile |
| 107 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 108 | ## ----------------------------------------------------------------------- |
| 109 | ## ----------------------------------------------------------------------- |
Matteo Scandolo | 90d08f6 | 2020-10-29 12:06:55 -0700 | [diff] [blame] | 110 | sca: |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 111 | @$(RM) -r ./sca-report |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 112 | @mkdir -p ./sca-report |
| 113 | @echo "Running static code analysis..." |
Matteo Scandolo | 96f8919 | 2021-03-12 13:17:26 -0800 | [diff] [blame] | 114 | @${GOLANGCI_LINT} run -vv --deadline=6m --out-format junit-xml ./... | tee ./sca-report/sca-report.xml |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 115 | @echo "" |
| 116 | @echo "Static code analysis OK" |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 117 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 118 | ## ----------------------------------------------------------------------- |
| 119 | ## ----------------------------------------------------------------------- |
Matteo Scandolo | 0e9fabf | 2020-09-30 17:19:27 -0700 | [diff] [blame] | 120 | test: docs-lint test-unit test-bbr |
Matteo Scandolo | 569e717 | 2019-12-20 11:51:51 -0800 | [diff] [blame] | 121 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 122 | ## ----------------------------------------------------------------------- |
| 123 | ## ----------------------------------------------------------------------- |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 124 | test-unit: clean local-omci-lib-go # @HELP Execute unit tests |
Matteo Scandolo | 90d08f6 | 2020-10-29 12:06:55 -0700 | [diff] [blame] | 125 | @echo "Running unit tests..." |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 126 | @mkdir -p ./tests/results |
Matteo Scandolo | 4b077aa | 2021-02-16 17:33:37 -0800 | [diff] [blame] | 127 | @${GO} test -mod=vendor -bench=. -v -coverprofile ./tests/results/go-test-coverage.out -covermode count ./... 2>&1 | tee ./tests/results/go-test-results.out ;\ |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 128 | RETURN=$$? ;\ |
| 129 | ${GO_JUNIT_REPORT} < ./tests/results/go-test-results.out > ./tests/results/go-test-results.xml ;\ |
| 130 | ${GOCOVER_COBERTURA} < ./tests/results/go-test-coverage.out > ./tests/results/go-test-coverage.xml ;\ |
| 131 | exit $$RETURN |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 132 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 133 | ## ----------------------------------------------------------------------- |
| 134 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 135 | test-bbr: release-bbr docker-build # @HELP Validate that BBSim and BBR are working together |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 136 | DOCKER_RUN_ARGS="-pon 2 -onu 2" $(MAKE) docker-run |
Matteo Scandolo | 569e717 | 2019-12-20 11:51:51 -0800 | [diff] [blame] | 137 | sleep 5 |
Matteo Scandolo | c11074d | 2020-09-14 14:59:24 -0700 | [diff] [blame] | 138 | ./$(RELEASE_DIR)/$(RELEASE_BBR_NAME)-linux-amd64 -pon 2 -onu 2 -logfile tmp.logs |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 139 | docker $(RM) -f bbsim |
Matteo Scandolo | 569e717 | 2019-12-20 11:51:51 -0800 | [diff] [blame] | 140 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 141 | ## ----------------------------------------------------------------------- |
| 142 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 143 | mod-update: # @HELP Download the dependencies to the vendor folder |
| 144 | ${GO} mod tidy |
| 145 | ${GO} mod vendor |
Matteo Scandolo | 3830549 | 2019-10-11 11:36:00 -0700 | [diff] [blame] | 146 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 147 | ## ----------------------------------------------------------------------- |
| 148 | ## ----------------------------------------------------------------------- |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 149 | docker-build: local-omci-lib-go local-protos# @HELP Build the BBSim docker container (contains BBSimCtl too) |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 150 | docker build \ |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 151 | -t "$(bbsim-tag)" \ |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 152 | -f build/package/Dockerfile . |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 153 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 154 | ## ----------------------------------------------------------------------- |
| 155 | ## ----------------------------------------------------------------------- |
Matteo Scandolo | 01d41ce | 2019-10-28 15:42:47 -0700 | [diff] [blame] | 156 | docker-push: # @HELP Push the docker container to a registry |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 157 | docker push "$(bbsim-tag)" |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 158 | |
| 159 | ## ----------------------------------------------------------------------- |
| 160 | ## ----------------------------------------------------------------------- |
Andrea Campanella | 64dffd5 | 2019-12-17 17:29:57 -0800 | [diff] [blame] | 161 | docker-kind-load: |
| 162 | @if [ "`kind get clusters | grep voltha-$(TYPE)`" = '' ]; then echo "no voltha-$(TYPE) cluster found" && exit 1; fi |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 163 | kind load docker-image "$(bbsim-tag)" --name=voltha-$(TYPE) --nodes $(shell kubectl get nodes --template='{{range .items}}{{.metadata.name}},{{end}}' | sed 's/,$$//') |
| 164 | |
| 165 | ## ----------------------------------------------------------------------- |
| 166 | ## docker-run |
| 167 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 72558cb | 2022-11-30 06:35:52 -0500 | [diff] [blame] | 168 | |
| 169 | # % docker run --detach unless dev-mode |
| 170 | is-docker-run := $(filter-out %-dev,$(MAKECMDGOALS)) |
| 171 | is-docker-run := $(findstring docker-run,$(is-docker-run)) |
| 172 | |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 173 | docker-run-cmd = docker run |
Joey Armstrong | 72558cb | 2022-11-30 06:35:52 -0500 | [diff] [blame] | 174 | $(if $(is-docker-run),$(eval docker-run-cmd += --detach)) |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 175 | docker-run-cmd += ${DOCKER_PORTS} |
| 176 | docker-run-cmd += --privileged |
| 177 | docker-run-cmd += --rm |
| 178 | docker-run-cmd += --name bbsim |
| 179 | docker-run-cmd += "$(bbsim-tag)" /app/bbsim |
| 180 | docker-run-cmd += ${DOCKER_RUN_ARGS} |
Andrea Campanella | 64dffd5 | 2019-12-17 17:29:57 -0800 | [diff] [blame] | 181 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 182 | ## ----------------------------------------------------------------------- |
| 183 | ## ----------------------------------------------------------------------- |
Matteo Scandolo | e383d5d | 2019-10-25 14:47:27 -0700 | [diff] [blame] | 184 | docker-run: # @HELP Runs the container locally (available options: DOCKER_RUN_ARGS="-pon 2 -onu 2" make docker-run) |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 185 | docker ps |
Joey Armstrong | 72558cb | 2022-11-30 06:35:52 -0500 | [diff] [blame] | 186 | $(docker-run-cmd) |
Matteo Scandolo | 4b3fc7e | 2019-09-17 16:49:54 -0700 | [diff] [blame] | 187 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 188 | ## ----------------------------------------------------------------------- |
| 189 | ## ----------------------------------------------------------------------- |
Matteo Scandolo | e383d5d | 2019-10-25 14:47:27 -0700 | [diff] [blame] | 190 | docker-run-dev: # @HELP Runs the container locally (intended for development purposes, not in detached mode) |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 191 | $(docker-run-cmd) |
Matteo Scandolo | e383d5d | 2019-10-25 14:47:27 -0700 | [diff] [blame] | 192 | |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 193 | ## ----------------------------------------------------------------------- |
| 194 | ## docker-run |
| 195 | ## ----------------------------------------------------------------------- |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 196 | .PHONY: docs docs-lint |
Zdravko Bozakov | 2da7634 | 2019-10-21 09:47:35 +0200 | [diff] [blame] | 197 | docs: swagger # @HELP Generate docs and opens them in the browser |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 198 | $(MAKE) -C docs html |
Zdravko Bozakov | 2da7634 | 2019-10-21 09:47:35 +0200 | [diff] [blame] | 199 | @echo -e "\nBBSim documentation generated in file://${PWD}/docs/build/html/index.html" |
Matteo Scandolo | 40e067f | 2019-10-16 16:59:41 -0700 | [diff] [blame] | 200 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 201 | ## ----------------------------------------------------------------------- |
| 202 | ## ----------------------------------------------------------------------- |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 203 | docs-lint: |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 204 | $(MAKE) -C docs lint |
Zack Williams | 4b0ef4d | 2019-12-18 14:25:20 -0700 | [diff] [blame] | 205 | |
Joey Armstrong | 5c61077 | 2023-01-23 16:03:32 -0500 | [diff] [blame] | 206 | ## ----------------------------------------------------------------------- |
| 207 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 208 | swagger-deps += docs/swagger/bbsim/bbsim.swagger.json |
| 209 | swagger-deps += docs/swagger/leagacy/bbsim.swagger.json |
| 210 | .PHONY: $(swagger-deps) |
| 211 | swagger: $(swagger-deps) # @HELP Generate swagger documentation for BBSim API |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 212 | |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 213 | ## ----------------------------------------------------------------------- |
Matteo Scandolo | ca08fc7 | 2019-12-04 14:17:39 -0800 | [diff] [blame] | 214 | ## Local Development Helpers |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 215 | ## ----------------------------------------------------------------------- |
Matteo Scandolo | cedde46 | 2021-03-09 17:37:16 -0800 | [diff] [blame] | 216 | local-omci-lib-go: |
| 217 | ifdef LOCAL_OMCI_LIB_GO |
| 218 | mkdir -p vendor/github.com/opencord/omci-lib-go |
| 219 | cp -r ${LOCAL_OMCI_LIB_GO}/* vendor/github.com/opencord/omci-lib-go |
Matteo Scandolo | ca08fc7 | 2019-12-04 14:17:39 -0800 | [diff] [blame] | 220 | endif |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 221 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 222 | ## ----------------------------------------------------------------------- |
| 223 | ## ----------------------------------------------------------------------- |
Matteo Scandolo | 4f4ac79 | 2020-10-01 16:33:21 -0700 | [diff] [blame] | 224 | local-protos: ## Copies a local version of the voltha-protos dependency into the vendor directory |
| 225 | ifdef LOCAL_PROTOS |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 226 | $(RM) -r vendor/github.com/opencord/voltha-protos/v5/go |
David K. Bainbridge | c415efe | 2021-08-19 13:05:21 +0000 | [diff] [blame] | 227 | mkdir -p vendor/github.com/opencord/voltha-protos/v5/go |
| 228 | cp -r ${LOCAL_PROTOS}/go/* vendor/github.com/opencord/voltha-protos/v5/go |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 229 | $(RM) -r vendor/github.com/opencord/voltha-protos/v5/go/vendor |
Matteo Scandolo | 4f4ac79 | 2020-10-01 16:33:21 -0700 | [diff] [blame] | 230 | endif |
| 231 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 232 | ## ----------------------------------------------------------------------- |
| 233 | ## ----------------------------------------------------------------------- |
| 234 | clean :: |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 235 | @$(RM) -f bbsim |
| 236 | @$(RM) -f bbsimctl |
| 237 | @$(RM) -f bbr |
| 238 | @$(RM) -r tools/bin |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 239 | @$(RM) -r release |
Matteo Scandolo | 3de9de0 | 2019-11-14 13:40:03 -0800 | [diff] [blame] | 240 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 241 | sterile :: clean |
Matteo Scandolo | 40e067f | 2019-10-16 16:59:41 -0700 | [diff] [blame] | 242 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 243 | ## ----------------------------------------------------------------------- |
| 244 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 245 | setup_tools: |
| 246 | @echo "Downloading dependencies..." |
David K. Bainbridge | c415efe | 2021-08-19 13:05:21 +0000 | [diff] [blame] | 247 | @${GO} mod download github.com/grpc-ecosystem/grpc-gateway github.com/opencord/voltha-protos/v5 |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 248 | @echo "Dependencies downloaded OK" |
Matteo Scandolo | 84f7d48 | 2019-08-08 19:00:47 -0700 | [diff] [blame] | 249 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 250 | ## ----------------------------------------------------------------------- |
| 251 | ## ----------------------------------------------------------------------- |
David K. Bainbridge | c415efe | 2021-08-19 13:05:21 +0000 | [diff] [blame] | 252 | VOLTHA_PROTOS ?= $(shell ${GO} list -f '{{ .Dir }}' -m github.com/opencord/voltha-protos/v5) |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 253 | GOOGLEAPI ?= $(shell ${GO} list -f '{{ .Dir }}' -m github.com/grpc-ecosystem/grpc-gateway) |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 254 | |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 255 | .PHONY: api/openolt/openolt.pb.go api/bbsim/bbsim.pb.go api/bbsim/bbsim.pb.gw.go api/legacy/bbsim.pb.go api/legacy/bbsim.pb.gw.go |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 256 | api/openolt/openolt.pb.go: api/openolt/openolt.proto setup_tools |
| 257 | @echo $@ |
| 258 | @${PROTOC} -I. \ |
| 259 | -I${GOOGLEAPI}/third_party/googleapis \ |
amit.ghosh | ee17c00 | 2021-06-10 12:14:38 +0200 | [diff] [blame] | 260 | --go_out=plugins=grpc:./ --go_opt=paths=source_relative \ |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 261 | $< |
Zdravko Bozakov | 2da7634 | 2019-10-21 09:47:35 +0200 | [diff] [blame] | 262 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 263 | ## ----------------------------------------------------------------------- |
| 264 | ## ----------------------------------------------------------------------- |
hkouser | 24361d4 | 2020-12-14 19:21:47 +0530 | [diff] [blame] | 265 | api/bbsim/bbsim_dmi.pb.go: api/bbsim/bbsim_dmi.proto setup_tools |
| 266 | @echo $@ |
| 267 | @${PROTOC} -I. \ |
| 268 | -I${GOOGLEAPI}/third_party/googleapis \ |
amit.ghosh | ee17c00 | 2021-06-10 12:14:38 +0200 | [diff] [blame] | 269 | --go_out=plugins=grpc:./ --go_opt=paths=source_relative \ |
hkouser | 24361d4 | 2020-12-14 19:21:47 +0530 | [diff] [blame] | 270 | $< |
| 271 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 272 | ## ----------------------------------------------------------------------- |
| 273 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 274 | api/bbsim/bbsim.pb.go api/bbsim/bbsim.pb.gw.go: api/bbsim/bbsim.proto api/bbsim/bbsim.yaml setup_tools |
| 275 | @echo $@ |
| 276 | @${PROTOC} -I. \ |
| 277 | -I${GOOGLEAPI}/third_party/googleapis \ |
| 278 | -I${VOLTHA_PROTOS}/protos/ \ |
amit.ghosh | ee17c00 | 2021-06-10 12:14:38 +0200 | [diff] [blame] | 279 | --go_out=plugins=grpc:./ --go_opt=paths=source_relative \ |
| 280 | --grpc-gateway_out=logtostderr=true,paths=source_relative,grpc_api_configuration=api/bbsim/bbsim.yaml,allow_delete_body=true:./ \ |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 281 | $< |
Zdravko Bozakov | 2da7634 | 2019-10-21 09:47:35 +0200 | [diff] [blame] | 282 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 283 | ## ----------------------------------------------------------------------- |
| 284 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 285 | api/legacy/bbsim.pb.go api/legacy/bbsim.pb.gw.go: api/legacy/bbsim.proto setup_tools |
| 286 | @echo $@ |
| 287 | @${PROTOC} -I. \ |
| 288 | -I${GOOGLEAPI}/third_party/googleapis/ \ |
| 289 | -I${GOOGLEAPI}/ \ |
| 290 | -I${VOLTHA_PROTOS}/protos/ \ |
| 291 | --go_out=plugins=grpc:./ \ |
amit.ghosh | ee17c00 | 2021-06-10 12:14:38 +0200 | [diff] [blame] | 292 | --grpc-gateway_out=logtostderr=true,paths=source_relative,allow_delete_body=true:./ \ |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 293 | $< |
| 294 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 295 | ## ----------------------------------------------------------------------- |
| 296 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 297 | docs/swagger/bbsim/bbsim.swagger.json: api/bbsim/bbsim.yaml setup_tools |
| 298 | @echo $@ |
| 299 | @${PROTOC} -I ./api \ |
| 300 | -I${GOOGLEAPI}/ \ |
| 301 | -I${VOLTHA_PROTOS}/protos/ \ |
Zack Williams | d2907e6 | 2020-04-03 10:23:02 -0700 | [diff] [blame] | 302 | --swagger_out=logtostderr=true,allow_delete_body=true,disable_default_errors=true,grpc_api_configuration=$<:docs/swagger/ \ |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 303 | api/bbsim/bbsim.proto |
| 304 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 305 | ## ----------------------------------------------------------------------- |
| 306 | ## ----------------------------------------------------------------------- |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 307 | docs/swagger/leagacy/bbsim.swagger.json: api/legacy/bbsim.proto setup_tools |
| 308 | @echo $@ |
| 309 | @${PROTOC} -I ./api \ |
| 310 | -I${GOOGLEAPI}/ \ |
| 311 | -I${VOLTHA_PROTOS}/protos/ \ |
Zack Williams | d2907e6 | 2020-04-03 10:23:02 -0700 | [diff] [blame] | 312 | --swagger_out=logtostderr=true,allow_delete_body=true,disable_default_errors=true:docs/swagger/ \ |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 313 | $< |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 314 | |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 315 | ## ----------------------------------------------------------------------- |
| 316 | ## Intent: Helper target used to exercise release script changes |
| 317 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 2c850cc | 2023-04-17 16:30:00 -0400 | [diff] [blame] | 318 | include $(MAKEDIR)/release/onf-publish.mk |
Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 319 | |
| 320 | $(if $(DEBUG),$(warning LEAVE)) |
| 321 | |
Joey Armstrong | 73d3579 | 2022-11-25 08:46:46 -0500 | [diff] [blame] | 322 | # [EOF] |