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/include.mk b/makefiles/include.mk
index 1dba95f..48de1e9 100644
--- a/makefiles/include.mk
+++ b/makefiles/include.mk
@@ -45,6 +45,8 @@
 ##--------------------##
 ##---]  INCLUDES  [---##
 ##--------------------##
+include $(ONF_MAKEDIR)/lint/make/warn-undef-vars.mk  # target lint-make helper
+
 include $(ONF_MAKEDIR)/consts.mk
 include $(ONF_MAKEDIR)/help/include.mk       # render target help
 include $(ONF_MAKEDIR)/utils/include.mk      # dependency-less helper macros
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
index 2a004af..68f84cc 100644
--- a/makefiles/lint/include.mk
+++ b/makefiles/lint/include.mk
@@ -38,7 +38,7 @@
 include $(ONF_MAKEDIR)/lint/jjb.mk
 include $(ONF_MAKEDIR)/lint/json.mk
 include $(ONF_MAKEDIR)/lint/license/include.mk
-include $(ONF_MAKEDIR)/lint/makefile.mk
+include $(ONF_MAKEDIR)/lint/make/include.mk
 include $(ONF_MAKEDIR)/lint/python/include.mk
 include $(ONF_MAKEDIR)/lint/shell/include.mk
 include $(ONF_MAKEDIR)/lint/tox/include.mk
diff --git a/makefiles/lint/make/include.mk b/makefiles/lint/make/include.mk
new file mode 100644
index 0000000..2f49e88
--- /dev/null
+++ b/makefiles/lint/make/include.mk
@@ -0,0 +1,33 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-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: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.2
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## Bleeding early import handled by makefiles/include.mk
+# include $(ONF_MAKEDIR)/lint/make/warn-undef-vars.mk
+
+include $(ONF_MAKEDIR)/lint/make/makefile.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/makefile.mk b/makefiles/lint/make/makefile.mk
similarity index 100%
rename from makefiles/lint/makefile.mk
rename to makefiles/lint/make/makefile.mk
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]