Joey Armstrong | 0205d33 | 2023-04-11 17:29:23 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 3 | # Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | 0205d33 | 2023-04-11 17:29:23 -0400 | [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 |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 15 | # limitations under the License.d |
Joey Armstrong | 0205d33 | 2023-04-11 17:29:23 -0400 | [diff] [blame] | 16 | # ----------------------------------------------------------------------- |
Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 17 | |
Joey Armstrong | 0205d33 | 2023-04-11 17:29:23 -0400 | [diff] [blame] | 18 | $(if $(DEBUG),$(warning ENTER)) |
| 19 | |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 20 | VOLTHA_TOOLS_VERSION ?= 2.4.0 |
Joey Armstrong | 0205d33 | 2023-04-11 17:29:23 -0400 | [diff] [blame] | 21 | |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 22 | # --------------------------- |
| 23 | # Macros: command refactoring |
| 24 | # --------------------------- |
| 25 | docker-iam ?= --user $$(id -u):$$(id -g)# # override for local use |
| 26 | docker-run = docker run --rm $(docker-iam)# # Docker command stem |
| 27 | docker-run-is = $(docker-run) $(is-stdin) # Attach streams when interactive |
| 28 | docker-run-app = $(docker-run-is) -v ${CURDIR}:/app# # w/filesystem mount |
| 29 | is-stdin = $(shell test -t 0 && echo "-it") |
Joey Armstrong | 0205d33 | 2023-04-11 17:29:23 -0400 | [diff] [blame] | 30 | |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 31 | voltha-protos-v5 ?= /go/src/github.com/opencord/voltha-protos/v5 |
Joey Armstrong | 42f4ce6 | 2023-06-09 12:56:48 -0400 | [diff] [blame] | 32 | |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 33 | # Docker volume mounts: container:/app/release <=> localhost:{pwd}/release |
| 34 | vee-golang = -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg |
| 35 | vee-citools = voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION} |
Joey Armstrong | 0205d33 | 2023-04-11 17:29:23 -0400 | [diff] [blame] | 36 | |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 37 | # --------------- |
| 38 | # Tool Containers |
| 39 | # --------------- |
| 40 | docker-go-stem = $(docker-run-app) -v gocache:/.cache $(vee-golang) $(vee-citools)-golang |
Joey Armstrong | 0205d33 | 2023-04-11 17:29:23 -0400 | [diff] [blame] | 41 | |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 42 | # Usage: GO := $(call get-docker-go,./my.env.temp) |
| 43 | get-docker-go = $(docker-go-stem) go |
| 44 | GO ?= $(call get-docker-go) |
Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 45 | |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 46 | # Usage: GO_SH := $(call get-docker-go-sh,./my.env.temp) |
| 47 | get-docker-go-sh = $(docker-go-stem) $(if $(1),--env-file $(1)) sh -c |
| 48 | GO_SH ?= $(call get-docker-go-sh,./my.env.temp) |
| 49 | |
| 50 | # Usage: PROTOC := $(call get-docker-protoc) |
| 51 | get-docker-protoc = $(docker-run-app) $(vee-citools)-protoc protoc |
| 52 | PROTOC ?= $(call get-docker-protoc) |
| 53 | |
| 54 | # get-docker-protoc-sh = $(strip ) |
| 55 | PROTOC_SH = $(docker-run-is) |
| 56 | ifdef voltha-protos-v5 |
| 57 | PROTOC_SH += -v ${CURDIR}:$(voltha-protos-v5) |
| 58 | PROTOC_SH += --workdir=$(voltha-protos-v5) |
| 59 | endif |
| 60 | PROTOC_SH += $(vee-citools)-protoc sh -c |
Joey Armstrong | 0205d33 | 2023-04-11 17:29:23 -0400 | [diff] [blame] | 61 | |
| 62 | $(if $(DEBUG),$(warning LEAVE)) |
| 63 | |
Joey Armstrong | 0205d33 | 2023-04-11 17:29:23 -0400 | [diff] [blame] | 64 | # [EOF] |