Added make lint support, make test non-functional.
VOL-4863
Makefile
========
o Initial cleanup and pre work for VOL-4863.
o Add makefile logic to support yaml syntax checking.
o Cleanup and document makefile, make test not working.
o Use make builtin $(RM) for file removal.
o Added/updated copyright notices.
o Note: makefile duplication across repos will be refactored
into a standalone repo at some point.
Change-Id: I7941dc51d6b19a479f1bf6c4241943687ef22797
diff --git a/makefiles/lint/yaml.mk b/makefiles/lint/yaml.mk
new file mode 100644
index 0000000..8a9367b
--- /dev/null
+++ b/makefiles/lint/yaml.mk
@@ -0,0 +1,39 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+env-clean = /usr/bin/env --ignore-environment
+xargs-n1 := xargs -0 -t -n1 --no-run-if-empty
+
+yamllint := $(env-clean) $(YAMLLINT)
+yamllint-args := -c .yamllint
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+lint : lint-yaml
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+lint-yaml:
+ $(HIDE)$(env-clean) find . -name '*.yaml' -type f -print0 \
+ | $(xargs-n1) $(yamllint) $(yamllint-args)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help:
+ @echo
+ @echo "USAGE: $(MAKE)"
+ @echo " lint perform syntax checks on source"
+ @echo " test perform syntax checks on source"
+ @echo " pre-check Verify tools and deps are available for testing"
+ @echo
+ @echo "[LINT]"
+ @echo " lint-json Syntax check .json sources"
+ @echo " lint-yaml Syntax check .yaml sources"
+ @echo
+# [EOF]