blob: 1ea495eb2a9877f475d956bef76c22514d8e6e3d [file] [log] [blame]
Joey Armstrong761579c2023-05-08 11:59:57 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
Joey Armstrong25589d82024-01-02 22:31:35 -05003# Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors
Joey Armstrong761579c2023-05-08 11:59:57 -04004#
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.d
16# -----------------------------------------------------------------------
17
18$(if $(DEBUG),$(warning ENTER))
19
20# tool containers
21VOLTHA_TOOLS_VERSION ?= 2.4.0
22
Joey Armstrong670d40c2023-05-11 20:49:26 -040023docker-run := docker
24ifdef DOCKER_DEBUG
25 docker-run += --debug
26endif
27docker-run += run --rm --user $$(id -u):$$(id -g)# # Docker command stem
Joey Armstrong0ce49d32023-12-12 16:46:28 -050028docker-run-app = $(docker-run) -v ${CURDIR}:/app# # w/filesystem mount
Joey Armstrong670d40c2023-05-11 20:49:26 -040029
Joey Armstrong0ce49d32023-12-12 16:46:28 -050030# -----------------------------------------------------------------------
31# --interactive: Attach streams when stdout (fh==0) defined
32# --tty : Always create a pseudo-tty else jenkins:docker is silent
33# -----------------------------------------------------------------------
34is-stdin = $(shell test -t 0 && { echo '--interactive'; })
35is-stdin += --tty
Joey Armstrong761579c2023-05-08 11:59:57 -040036
37# Docker volume mounts: container:/app/release <=> localhost:{pwd}/release
38vee-golang = -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg
39vee-citools = voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}
40
41# Tool Containers
42PROTOC = $(docker-run) -v ${CURDIR}:/app $(is-stdin) $(vee-citools)-protoc protoc
Joey Armstrong0ce49d32023-12-12 16:46:28 -050043
44PROTOC_SH := $(docker-run)
45PROTOC_SH += -v ${CURDIR}:/go/src/github.com/opencord/voltha-protos/v5
46PROTOC_SH += $(is-stdin) --workdir=/go/src/github.com/opencord/voltha-protos/v5
47PROTOC_SH += $(vee-citools)-protoc sh -c
48
Joey Armstrong761579c2023-05-08 11:59:57 -040049GO = $(docker-run) -v ${CURDIR}:/app $(is-stdin) -v gocache:/.cache $(vee-golang) $(vee-citools)-golang go
50
Joey Armstrong56b36782023-05-30 17:30:11 -040051docker-sh = $(PROTOC_SH)
52
Joey Armstrong761579c2023-05-08 11:59:57 -040053$(if $(DEBUG),$(warning LEAVE))
54
55# [EOF]