Add a make target (smilint) for running smilint tool against BMIBS

Running smilint against MIB definitions is useful in finding
functional problems with MIB definitions/descriptions.

This is inspired by the smilint targets defined in
usr.sbin/bsnmpd/modules/{snmp_hostres,snmp_mibII}/Makefile

Document all of the variables that are involved in running the
smilint target, as well as all of the prerequisites to running
it.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9099
This commit is contained in:
Enji Cooper 2017-01-17 03:38:49 +00:00
parent 5a88d9fd3b
commit c6bd67d9d0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=312328
2 changed files with 34 additions and 1 deletions

View file

@ -418,7 +418,15 @@ tree.
bsd.snmpmod.mk leverages bsd.lib.mk for building MIB modules and
bsd.files.mk for installing MIB description and definition files.
It has no additional targets.
It implements the following additional targets:
smilint:
execute smilint on the MIBs defined by BMIBS.
The net-mgmt/libsmi package must be installed before
executing this target. The net-mgmt/net-snmp package
should be installed as well to reduce false positives
from smilint.
It sets/uses the following variables:
@ -444,8 +452,19 @@ EXTRAMIBSYMS Extra MIB definition files used only for extracting
See ${MOD}_oid.h for more details.
LOCALBASE The package root where smilint and the net-snmp
definitions can be found
MOD The bsnmpd module name.
SMILINT smilint binary to use with the smilint make target.
SMILINT_FLAGS flags to pass to smilint.
SMIPATH A colon-separated directory path where MIBs definitions
can be found. See "SMIPATH" in smi_config for more
details.
XSYM MIB names to extract symbols for. See ${MOD}_oid.h for
more details.

View file

@ -25,4 +25,18 @@ FILESGROUPS+= BMIBS
BMIBSDIR?= ${SHAREDIR}/snmp/mibs
.endif
.if !target(smilint) && !empty(BMIBS)
LOCALBASE?= /usr/local
SMILINT?= ${LOCALBASE}/bin/smilint
SMIPATH?= ${BMIBSDIR}:${LOCALBASE}/share/snmp/mibs
SMILINT_FLAGS?= -c /dev/null -l6 -i group-membership
smilint: ${BMIBS}
SMIPATH=${SMIPATH} ${SMILINT} ${SMILINT_FLAGS} ${.ALLSRC}
.endif
smilint: .PHONY
.include <bsd.lib.mk>