# -*- makefile -*-
# -----------------------------------------------------------------------
# Copyright 2017-2024 Open Networking Foundation 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: 2017-2024 Open Networking Foundation Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
# Intent:
# -----------------------------------------------------------------------

##-------------------##
##---]  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]
