Copy in repo:onf-make library logic for lint targets.
Makefile
--------
o Copy in mod-update, mod-tidy and mod-vendor targets from voltha-lib-go.
o Add LOCAL_FIX_PERMS=1 conditional to adjust perms for docker use which
will allow 'make lint' to be used in a local sandbox.
makefiles/include.mk
makefiles/etc/include.mk
makefiles/etc/features.mk
-------------------------
o Copy in library macros used to dispolay a banner message and
{ENTER,LEAVE} target markers into the build log stream.
Change-Id: I6d7e09a8100dd1554c846ba0ab8794af7215e23d
diff --git a/Makefile b/Makefile
index 57f948f..d4549c7 100755
--- a/Makefile
+++ b/Makefile
@@ -165,9 +165,10 @@
$(HIDE)git status > /dev/null
$(HIDE)git diff-index --quiet HEAD -- go.mod go.sum vendor || (echo "ERROR: Staged or modified files must be committed before running this test" && echo "`git status`" && exit 1)
- $(MAKE) --no-print-directory detect-local-edits
- ${GO} mod tidy
- ${GO} mod vendor
+ $(HIDE)$(MAKE) --no-print-directory detect-local-edits
+
+ $(HIDE)$(MAKE) --no-print-directory mod-update
+
$(HIDE)git status > /dev/null
$(HIDE)git diff-index --quiet HEAD -- go.mod go.sum vendor || (echo "ERROR: Modified files detected after running go mod tidy / go mod vendor" && echo "`git status`" && exit 1)
@@ -214,9 +215,27 @@
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
-mod-update: ## Update go mod files
+.PHONY: mod-update
+mod-update: mod-tidy mod-vendor
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+.PHONY: mod-tidy
+mod-tidy :
+ $(call banner-enter,Target $@)
${GO} mod tidy
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+.PHONY: mod-vendor
+mod-vendor : mod-tidy
+mod-vendor :
+ $(call banner-enter,Target $@)
+ $(if $(LOCAL_FIX_PERMS),chmod o+w $(CURDIR))
${GO} mod vendor
+ $(if $(LOCAL_FIX_PERMS),chmod o-w $(CURDIR))
+ $(call banner-leave,Target $@)
# For each makefile target, add ## <description> on the target line and it will be listed by 'make help'
help :: ## Print help for each Makefile target
diff --git a/makefiles/etc/features.mk b/makefiles/etc/features.mk
new file mode 100644
index 0000000..a48b42c
--- /dev/null
+++ b/makefiles/etc/features.mk
@@ -0,0 +1,48 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 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.
+#
+# SPDX-FileCopyrightText: 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Usage:
+#
+# mytarget:
+# $(call banner-enter,target $@)
+# @echo "Hello World"
+# $(call banner-leave,target $@)
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+target-banner = ** ---------------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Return a command line able to display a banner hilighting
+## make target processing within a logfile.
+## -----------------------------------------------------------------------
+banner-enter=\
+ @echo -e \
+ "\n"\
+ "$(target-banner)\n"\
+ "** $(MAKE) ENTER: $(1)\n"\
+ "$(target-banner)"\
+
+banner-leave=\
+ @echo -e "** $(MAKE) LEAVE: $(1)"
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/etc/include.mk b/makefiles/etc/include.mk
new file mode 100644
index 0000000..cc17c2e
--- /dev/null
+++ b/makefiles/etc/include.mk
@@ -0,0 +1,27 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 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.
+#
+# SPDX-FileCopyrightText: 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+include $(ONF_MAKEDIR)/etc/features.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/include.mk b/makefiles/include.mk
index 27fb6b6..5b8d193 100644
--- a/makefiles/include.mk
+++ b/makefiles/include.mk
@@ -28,7 +28,9 @@
@echo "USAGE: $(MAKE) [options] [target] ..."
# @echo " test Sanity check chart versions"
+ONF_MAKEDIR := $(MAKEDIR)
include $(MAKEDIR)/consts.mk
+include $(ONF_MAKEDIR)/etc/include.mk # banner macros
include $(MAKEDIR)/todo.mk
include $(MAKEDIR)/lint/include.mk