Normalize MAKEDIR, ONF_MAKEDIR and ONF_MAKE
Change-Id: I3908c0738dbbed180d62dc0f4ba656226035ba5a
diff --git a/makefiles/bootstrap.mk b/makefiles/bootstrap.mk
index eec469b..d8264a1 100644
--- a/makefiles/bootstrap.mk
+++ b/makefiles/bootstrap.mk
@@ -16,25 +16,7 @@
##---] LIBRARY MACROS [---##
##--------------------------##
is-null = $(if $(1),$(null),$(error $(1)= is undef))
-# is-null-var = $(if $($(1)),$(null),$(error $(1)= is undef))
-
-## [origin]
-## foreach: var=automatic, origin=undef
-is-null-var-orig = $(strip \
- $(foreach varname,$(1),\
- $(warning ** is-null-var: varname=$(varname), origin=$(origin 1), origin=$(origin var))\
- )\
-)
-# $(if $(1),$(call is-null-var-indirect,$($(1))),$(error $(1)= is undef)))\
-
-is-null-var-indirect = $(if $(1),$(null),$(error $(1)= is undef))
-
-# origin - undefned
-# default
-# environment
-# environment override
-# automatic
-# null(blah) ? - true
+is-null-var = $(if $$(1),$(null),$(error $(1)= is undef))
## -----------------------------------------------------------------------
## Intent: Given an indirect var containing varname of a makefile *_ROOT
@@ -47,24 +29,15 @@
## o OPT_MKDIR=$(OPT_ROOT)/makefiles
## o If exists include $(OPT_MKDIR)/include.mk
## -----------------------------------------------------------------------
-# library-include := $(call mk-library-include,blah)
-
mk-library-include=$(strip \
- $(warning mk-library-include: $$1[$(1)] = [$($(1))]))\
+ $(warning mk-library-include: $(1) = $($(1)))\
$(call is-null-var,1)\
- $(foreach var,$($(1)),\
+ $(foreach var,$$(1),\
$(info var=$(var) is-null=$(call is-null-var,var))\
$(foreach val,$$(var),\
- $(info val=$(val))\
+ $(info val=$(val))\
$(foreach makedir,$(subst _ROOT,_MKDIR,$(var)),\
$(warning makedir=$(makedir))\
-)\
-)\
-)\
-)
-
-
-# $(warning makedir=$(makedir))\
$(if $($(makedir)),$(null),\
$(eval $(makedir)=$$$$($(var))/makefiles)\
$(warning $(makedir) = $($($(makedir))))\
@@ -72,7 +45,6 @@
$(foreach mf,$(wildcard $(wildcard $(val)/makefiles/include.mk)),\
$(warning $$(eval include $(mf)))\
$(eval include $(mf)))\
-))))\
)
$(if $(DEBUG-bootstrap_mk),$(warning LEAVE))
diff --git a/makefiles/consts.mk b/makefiles/consts.mk
index 8961b3a..c1306ac 100644
--- a/makefiles/consts.mk
+++ b/makefiles/consts.mk
@@ -31,21 +31,13 @@
export quote-double := $(null)"$(null)#"
# [DEBUG] make {target} HIDE=
-HIDE ?= @
+HIDE ?= @
env-clean ?= /usr/bin/env --ignore-environment
xargs-n1 := xargs -0 -t -n1 --no-run-if-empty
xargs-n1-clean := $(env-clean) $(xargs-n1)
## -----------------------------------------------------------------------
-## Intent: NOP command for targets whose dependencies do all heavy lifting
-## -----------------------------------------------------------------------
-## usage: foo bar tans
-## <tab>$(nop-command)
-## -----------------------------------------------------------------------
-nop-cmd := :
-
-## -----------------------------------------------------------------------
## Default shell:
## o set -e enable error checking
## o set -u report undefined errors
diff --git a/makefiles/docker/include.mk b/makefiles/docker/include.mk
index 0e53629..48e20ca 100644
--- a/makefiles/docker/include.mk
+++ b/makefiles/docker/include.mk
@@ -26,13 +26,7 @@
docker-run = docker run --rm $(docker-iam)# # Docker command stem
docker-run-is = $(docker-run) $(is-stdin) # Attach streams when interactive
docker-run-app = $(docker-run-is) -v ${CURDIR}:/app# # w/filesystem mount
-
-# -----------------------------------------------------------------------
-# --interactive: Attach streams when stdout (fh==0) defined
-# --tty : Always create a pseudo-tty else jenkins:docker is silent
-# -----------------------------------------------------------------------
-is-stdin = $(shell test -t 0 && { echo '--interactive'; })
-is-stdin += --tty
+is-stdin = $(shell test -t 0 && echo "-it")
voltha-protos-v5 ?= /go/src/github.com/opencord/voltha-protos/v5
diff --git a/makefiles/gerrit/include.mk b/makefiles/gerrit/include.mk
index 54e5895..5ae76a4 100644
--- a/makefiles/gerrit/include.mk
+++ b/makefiles/gerrit/include.mk
@@ -18,7 +18,7 @@
##--------------------##
##---] INCLUDES [---##
##--------------------##
-include $(MAKEDIR)/gerrit/help.mk
+include $(ONF_MAKEDIR)/gerrit/help.mk
# -----------------------------------------------------------------------
# -----------------------------------------------------------------------
diff --git a/makefiles/include.mk b/makefiles/include.mk
index b2d6d3b..48e20ca 100644
--- a/makefiles/include.mk
+++ b/makefiles/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,67 +12,53 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
-# SPDX-License-Identifier: Apache-2.0
+# limitations under the License.d
# -----------------------------------------------------------------------
-# https://gerrit.opencord.org/plugins/gitiles/onf-make
-# ONF.makefile.version = 1.0
-# -----------------------------------------------------------------------
-
-ifndef mk-include--onf-make # single-include guard macor
$(if $(DEBUG),$(warning ENTER))
-## -----------------------------------------------------------------------
-## Define vars based on relative import (normalize symlinks)
-## Usage: include makefiles/onf/include.mk
-## -----------------------------------------------------------------------
-onf-mk-abs ?= $(abspath $(lastword $(MAKEFILE_LIST)))
-onf-mk-top := $(subst /include.mk,$(null),$(onf-mk-abs))
-ONF_MAKEDIR := $(onf-mk-top)
+VOLTHA_TOOLS_VERSION ?= 2.4.0
-include $(ONF_MAKEDIR)/consts.mk
-include $(ONF_MAKEDIR)/help/include.mk # render target help
-include $(ONF_MAKEDIR)/utils/include.mk # dependency-less helper macros
-include $(ONF_MAKEDIR)/etc/include.mk # banner macros
+# ---------------------------
+# Macros: command refactoring
+# ---------------------------
+docker-iam ?= --user $$(id -u):$$(id -g)# # override for local use
+docker-run = docker run --rm $(docker-iam)# # Docker command stem
+docker-run-is = $(docker-run) $(is-stdin) # Attach streams when interactive
+docker-run-app = $(docker-run-is) -v ${CURDIR}:/app# # w/filesystem mount
+is-stdin = $(shell test -t 0 && echo "-it")
-include $(ONF_MAKEDIR)/etc/commands.mk # Tools and local installers
+voltha-protos-v5 ?= /go/src/github.com/opencord/voltha-protos/v5
-include $(ONF_MAKEDIR)/virtualenv.mk# # lint-{jjb,python} depends on venv
-include $(ONF_MAKEDIR)/lint/include.mk
-# include $(ONF_MAKEDIR)/git-submodules.mk
-# include $(ONF_MAKEDIR)/gerrit/include.mk
+# Docker volume mounts: container:/app/release <=> localhost:{pwd}/release
+vee-golang = -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg
+vee-citools = voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}
-include $(ONF_MAKEDIR)/todo.mk
-include $(ONF_MAKEDIR)/help/variables.mk
+# ---------------
+# Tool Containers
+# ---------------
+docker-go-stem = $(docker-run-app) -v gocache:/.cache $(vee-golang) $(vee-citools)-golang
-##---------------------##
-##---] ON_DEMAND [---##
-##---------------------##
-$(if $(USE_DOCKER_MK),$(eval $(ONF_MAKEDIR)/docker/include.mk))
+# Usage: GO := $(call get-docker-go,./my.env.temp)
+get-docker-go = $(docker-go-stem) go
+GO ?= $(call get-docker-go)
-##-------------------##
-##---] TARGETS [---##
-##-------------------##
-include $(ONF_MAKEDIR)/targets/clean.mk
-# include $(ONF_MAKEDIR)/targets/check.mk
-include $(ONF_MAKEDIR)/targets/sterile.mk
-# include $(ONF_MAKEDIR)/targets/test.mk
+# Usage: GO_SH := $(call get-docker-go-sh,./my.env.temp)
+get-docker-go-sh = $(docker-go-stem) $(if $(1),--env-file $(1)) sh -c
+GO_SH ?= $(call get-docker-go-sh,./my.env.temp)
+
+# Usage: PROTOC := $(call get-docker-protoc)
+get-docker-protoc = $(docker-run-app) $(vee-citools)-protoc protoc
+PROTOC ?= $(call get-docker-protoc)
+
+# get-docker-protoc-sh = $(strip )
+PROTOC_SH = $(docker-run-is)
+ifdef voltha-protos-v5
+ PROTOC_SH += -v ${CURDIR}:$(voltha-protos-v5)
+ PROTOC_SH += --workdir=$(voltha-protos-v5)
+endif
+PROTOC_SH += $(vee-citools)-protoc sh -c
$(if $(DEBUG),$(warning LEAVE))
-## --------------------------------------------------------------------------
-## structure to support pre/post target handling w/o inlining in Makefile (?)
-## --------------------------------------------------------------------------
-## include makefiles/include.mk
-## include makefiles/main/enter.mk
-## [... include *.mk ...]
-## include makefiles/main/leave.mk
-
-mk-include--onf-make := true
-
-endif # mk-include--onf-make
-
# [EOF]
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
index 17c4083..787e146 100644
--- a/makefiles/lint/include.mk
+++ b/makefiles/lint/include.mk
@@ -1,9 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
-# -----------------------------------------------------------------------
-# https://gerrit.opencord.org/plugins/gitiles/onf-make
-# ONF.makefile.version = 1.1
+# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
# -----------------------------------------------------------------------
$(if $(DEBUG),$(warning ENTER))
diff --git a/makefiles/lint/shell.mk b/makefiles/lint/shell.mk
index 704038c..a02da31 100644
--- a/makefiles/lint/shell.mk
+++ b/makefiles/lint/shell.mk
@@ -34,7 +34,7 @@
shell-check := shellcheck
shell-check-args += --check-sourced
-shell-check-args += --external-sources
+shell-check-args += --extenal-sources
##-------------------##
##---] TARGETS [---##
diff --git a/makefiles/python/include.mk b/makefiles/python/include.mk
index f46aea0..70b5ca1 100644
--- a/makefiles/python/include.mk
+++ b/makefiles/python/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
diff --git a/makefiles/python/test/include.mk b/makefiles/python/test/include.mk
index 026fe68..12afc3e 100644
--- a/makefiles/python/test/include.mk
+++ b/makefiles/python/test/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
diff --git a/makefiles/targets/check.mk b/makefiles/targets/check.mk
index aa1b0d0..2145343 100644
--- a/makefiles/targets/check.mk
+++ b/makefiles/targets/check.mk
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
diff --git a/makefiles/targets/clean.mk b/makefiles/targets/clean.mk
index f787e5c..f504dec 100644
--- a/makefiles/targets/clean.mk
+++ b/makefiles/targets/clean.mk
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
diff --git a/makefiles/targets/sterile.mk b/makefiles/targets/sterile.mk
index c661f53..1eb7035 100644
--- a/makefiles/targets/sterile.mk
+++ b/makefiles/targets/sterile.mk
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
diff --git a/makefiles/targets/test.mk b/makefiles/targets/test.mk
index 2f68086..d70fa4a 100644
--- a/makefiles/targets/test.mk
+++ b/makefiles/targets/test.mk
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
diff --git a/makefiles/targets/tox.mk b/makefiles/targets/tox.mk
index 44da921..b3a638b 100644
--- a/makefiles/targets/tox.mk
+++ b/makefiles/targets/tox.mk
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
diff --git a/makefiles/virtualenv.mk b/makefiles/virtualenv.mk
index c6904da..93eb29d 100644
--- a/makefiles/virtualenv.mk
+++ b/makefiles/virtualenv.mk
@@ -13,7 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-# -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
# https://gerrit.opencord.org/plugins/gitiles/onf-make
# ONF.makefile.version = 1.0
# -----------------------------------------------------------------------