VOL-4840 - Makefile edits

VOL-4874, VOL-4877, VOL-4840

howto/edit_voltha_docs.rst
--------------------------
   * Also need to run "make docs" to generate html content.

Makefile
--------
   * (local use) fixed non-functional makefile targets.
   * Begin splitting monolithic makefile into reusable libs.
   * Extended help to document all targets (make help VERBOSE=1)
   * Extended lint to support more targets.
   * Replace wildcard target (%) with a list of sphinx-build named targets:
     + Amusing behavior but "make clean" should not initiate "gendocs".
     + Likewise "make lint" should not attempt to generate documentation.
   * Introduced simple patching logic for virtualenv.  Local users are
     now able to use make clean, lint, etc with a newer interpreter.
     Baby steps toward VOL-4874.
   * Conditional make vars added:
     + NO_PATCH=1
     + NO_OTHER_REPO_DOCS=1 (venv patching not yet supported by foreign repos).

makefiles/consts.mk
-------------------
   * basic values: space, dot, null, HIDE.

makefiles/help/include.mk
-------------------------
   * makefile target help with context.

makefiles/lint/*.mk
-------------------
   * lib makefiles capturing syntax checking logic.

makefiles/patches/include.mk
----------------------------
   * Targets for creation and applying python virtualenv patches.

patches/*/patch
patches/python_310_migration.sh
-------------------------------
   * Logic used to support dynamic python module pathching in a virtual env directory.
   * Module edits are trivial -- attempt to import new modules and fallback to existing import syntax.

Change-Id: I437289a751423217b4193b75b62c4a295db18ffd
diff --git a/makefiles/patches/include.mk b/makefiles/patches/include.mk
new file mode 100644
index 0000000..1c0c869
--- /dev/null
+++ b/makefiles/patches/include.mk
@@ -0,0 +1,65 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022 Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# 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.
+# -----------------------------------------------------------------------
+
+include $(MAKEDIR)/patches/help.mk
+
+patch-gather-args += --exclude=Makefile
+patch-gather-args += --exclude-dir=vault
+patch-gather-args += --exclude-dir=makefiles
+patch-gather-args += --exclude-dir=staging
+patch-gather-args += --exclude-dir=patches
+
+# patch-gather-args += -e 'from collections import'
+patch-gather-args += '-e' 'from collections import Mapping'
+patch-gather-args += '-e' 'from collections import MutableMapping'
+
+VENV_NAME   ?= $(error $(MAKE) VENV_NAME= is required)
+PATCH_PATH  ?= $(error $(MAKE) PATCH_PATH= is required)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+patch-gather:
+	grep -r $(patch-gather-args)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+patch-diff:
+	$(HIDE)diff -qr staging $(VENV_NAME) \
+	    | awk '{print "# diff -Naur "$$2" "$$4}' \
+	    | tee $@.log
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+patch-create:
+	mkdir -p patches/$(PATCH_PATH)
+	diff -Naur staging/$(PATCH_PATH) $(VENV_NAME)/$(PATCH_PATH) | tee patches/$(PATCH_PATH)/patch
+	exit 1
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+patch-init:
+	find "$(VENV_NAME)" -name '__pycache__' -type d -print0 \
+	    | xargs -I'{}' --null --no-run-if-empty $(RM) -r {}
+	mkdir -p staging
+	rsync -rv --checksum "$(VENV_NAME)/." "staging/."
+	@echo "Modify files beneath staging/ to create a patch source"
+
+# [SEE ALSO]
+# ---------------------------------------------------------------------------
+# https://bobbyhadz.com/blog/python-importerror-cannot-import-name-mapping-from-collections
+# ---------------------------------------------------------------------------
+# [EOF]