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