Bulk filter undef vars to support makefile target lint-make

makefiles/include.mk
makefiles/lint/make/include.mk
makefiles/lint/make/makefile.mk
-------------------------------
  o Move lint-make target logic into makefiles/lint/make/

makefiles/lint/make/warn-undef-vars.mk
--------------------------------------
  o Volume undef warnings plague makefile linting.
  o Makefile logic cleanup needed but in the interim valid-but-undef
    vars are defined as "var := $(null)".  This helps shorten the
    error log so lint-make can be used as a default lint target.

Change-Id: I48a0c6b2c71cf1dd5a6554cc5823502ed88482d0
diff --git a/makefiles/lint/make/warn-undef-vars.mk b/makefiles/lint/make/warn-undef-vars.mk
new file mode 100644
index 0000000..048d56d
--- /dev/null
+++ b/makefiles/lint/make/warn-undef-vars.mk
@@ -0,0 +1,71 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 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.
+# 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.
+# -----------------------------------------------------------------------
+# SPDX-FileCopyrightText: 2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Intent: Target lint-make* undef var warnings:
+##   o This helper makefile defines var := $(null) for known variables.
+##   o Definitions only exist for lint target use.
+##   o Decrease warning volume until undef sources can be cleaned up.
+## -----------------------------------------------------------------------
+$(if $(findstring --warn-undefined-variables,$(MAKEFLAGS)),\
+	$(eval IS-WARN-UNDEFINED-VARIABLES := true))
+
+ifdef IS-WARN-UNDEFINED-VARIABLES
+  export null :=#
+
+  # ----------------------------------------
+  # Helper macro
+  # Usage: $(call define-if-undef,{varname})
+  # ----------------------------------------
+  define-if-undef =\
+    $(if $(findstring undef,$(flavor $(1))),\
+      $(if $(DEBUG),$(info ** $$(eval export $(1) := $$(null))))\
+      $(eval export $(1) := $(null))\
+    )
+
+  # ----------------------------------------------
+  # Faux defines used to shorten lint error volume
+  # ----------------------------------------------
+  $(call define-if-undef,WORKSPACE)#   Jenkins: yes, interactive: no
+  $(call define-if-undef,NULL)#        s/NULL/null
+  $(call define-if-undef,UNSTABLE)#    enable raw bulk warnings for pylint
+  $(call define-if-undef,JJB_DEBUG)
+
+  # Helpers for transition of local makefiles to repo:onf-make
+  $(call define-if-undef,USE-ONF-DOCKER-MK)
+  $(call define-if-undef,USE-ONF-GERRIT-MK)
+  $(call define-if-undef,USE-VOLTHA-RELEASE-MK)
+
+  # ------------------------------------------------------------------
+  # Future make:
+  #   o detect available sources
+  #   o enable features based on source detection
+  #   o conditional makefile library loading based on source detection
+  # ------------------------------------------------------------------
+  $(call define-if-undef,DOC8_SOURCE)
+  $(call define-if-undef,have-python-files)
+
+endif # IS-WARN-UNDEFINED-VARIABLES
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]