Blame snmp/Makefile

Packit Service 5befb9
###############################################################################
Packit Service 5befb9
# Makefile script for RDT SNMP Subagent Perl script
Packit Service 5befb9
#
Packit Service 5befb9
# @par
Packit Service 5befb9
# BSD LICENSE
Packit Service 5befb9
#
Packit Service 8a4b7a
# Copyright(c) 2016-2020 Intel Corporation. All rights reserved.
Packit Service 5befb9
# All rights reserved.
Packit Service 5befb9
#
Packit Service 5befb9
# Redistribution and use in source and binary forms, with or without
Packit Service 5befb9
# modification, are permitted provided that the following conditions
Packit Service 5befb9
# are met:
Packit Service 5befb9
#
Packit Service 5befb9
#   * Redistributions of source code must retain the above copyright
Packit Service 5befb9
#     notice, this list of conditions and the following disclaimer.
Packit Service 5befb9
#   * Redistributions in binary form must reproduce the above copyright
Packit Service 5befb9
#     notice, this list of conditions and the following disclaimer in
Packit Service 5befb9
#     the documentation and/or other materials provided with the
Packit Service 5befb9
#     distribution.
Packit Service 5befb9
#   * Neither the name of Intel Corporation nor the names of its
Packit Service 5befb9
#     contributors may be used to endorse or promote products derived
Packit Service 5befb9
#     from this software without specific prior written permission.
Packit Service 5befb9
#
Packit Service 5befb9
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit Service 5befb9
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit Service 5befb9
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit Service 5befb9
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit Service 5befb9
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit Service 5befb9
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit Service 5befb9
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit Service 5befb9
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit Service 5befb9
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit Service 5befb9
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit Service 5befb9
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit Service 5befb9
###############################################################################
Packit Service 5befb9
Packit Service 5befb9
PERLTIDY?=perltidy
Packit Service 5befb9
Packit Service 5befb9
PERLTIDY_STYLE=-bar -ce -pt=2 -sbt=2 -bt=2 -bbt=2 -et=4 -baao -nsfs -vtc=1 -ci=4
Packit Service 5befb9
# http://perltidy.sourceforge.net/stylekey.html
Packit Service 5befb9
# http://perltidy.sourceforge.net/perltidy.html
Packit Service 5befb9
# -bar - keep the brace on the right even for multiple-line test expressions
Packit Service 5befb9
# -ce - cuddled else
Packit Service 5befb9
# -pt=2 - parentheses horizontal tightness - space is never used
Packit Service 5befb9
# -sbt=2 - square brackets horizontal tightness - space is never used
Packit Service 5befb9
# -bbt=2 - code block curly braces horizontal tightness - space is never used
Packit Service 5befb9
# -et=4 - entab leading whitespace with one tab character for each 4 spaces
Packit Service 5befb9
# -baao - "break after all operators"
Packit Service 5befb9
# -nsfs - no space before a semicolon in a for statement
Packit Service 5befb9
# -vtc=1 - do not break before a closing token which is followed by a semicolon
Packit Service 5befb9
#          or another closing token, and is not in a list environment
Packit Service 5befb9
# -ci=4 - continuation indentation - extra indentation spaces applied when
Packit Service 5befb9
#         a long line is broken, 4 spaces
Packit Service 5befb9
Packit Service 5befb9
# List of Perl scripts to be processed, space separated list
Packit Service 5befb9
PERL_SCRIPTS_LIST=rdt-agentx.pl
Packit Service 5befb9
Packit Service 5befb9
# To check if required style is followed, perltidy is called and
Packit Service 5befb9
# formatted output is compared to actual file,
Packit Service 5befb9
# if there are no differences, it means that file meets the requirements
Packit Service 5befb9
.PHONY: style
Packit Service 5befb9
style:
Packit Service 5befb9
	@bash -c 'for i in $(PERL_SCRIPTS_LIST); do \
Packit Service 5befb9
		$(PERLTIDY) $(PERLTIDY_STYLE) ./$${i} -st |\
Packit Service 5befb9
		diff - ./$${i} && echo "$${i} style OK" ||\
Packit Service 5befb9
		{ echo "$${i} style check failed!"; exit 1; }; \
Packit Service 5befb9
	done'
Packit Service 5befb9
Packit Service 5befb9
.PHONY: style-fix
Packit Service 5befb9
style-fix:
Packit Service 5befb9
	@bash -c 'for i in $(PERL_SCRIPTS_LIST); do \
Packit Service 5befb9
		$(PERLTIDY) $(PERLTIDY_STYLE) -b ./$${i}; \
Packit Service 5befb9
	done'