summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2017-02-04 16:40:28 +0000
committerngie <ngie@FreeBSD.org>2017-02-04 16:40:28 +0000
commitc6147e84beea95ea82174c8fc842756632f104aa (patch)
tree72504f57f7ce0ccd48c68145c78ea22ae36b48ae /share
parent6192a1f1dadc7eb4e1c6486b36c916b13ba9c60d (diff)
downloadFreeBSD-src-c6147e84beea95ea82174c8fc842756632f104aa.zip
FreeBSD-src-c6147e84beea95ea82174c8fc842756632f104aa.tar.gz
MFC r311744,r312328,r312329,r312330:
r311744: Document bsd.snmpmod.mk from a high-level r312328: 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. r312329: Remove ad hoc smilint targets made standard in bsd.snmpmod.mk in r312328 r312330: Add smilint target to subdir targets so "make smilint" here will run the smilint target in subdirs While here, convert a path that's .CURDIR relative to SRCTOP
Diffstat (limited to 'share')
-rw-r--r--share/mk/bsd.README76
-rw-r--r--share/mk/bsd.snmpmod.mk14
2 files changed, 90 insertions, 0 deletions
diff --git a/share/mk/bsd.README b/share/mk/bsd.README
index df973d5..ea46202 100644
--- a/share/mk/bsd.README
+++ b/share/mk/bsd.README
@@ -350,6 +350,82 @@ If foo has multiple source files, add the line:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+The include file, <bsd.snmpmod.mk>, handles building MIB modules for bsnmpd
+from one or more source files, along with their manual pages. It has a
+limited number of suffixes, consistent with the current needs of the BSD
+tree.
+
+bsd.snmpmod.mk leverages bsd.lib.mk for building MIB modules and
+bsd.files.mk for installing MIB description and definition files.
+
+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:
+
+BMIBS The MIB definitions to install.
+
+BMIBSDIR The directory where the MIB definitions are installed.
+ This defaults to `${SHAREDIR}/snmp/mibs`.
+
+DEFS The MIB description files to install.
+
+DEFSDIR The directory where MIB description files are installed.
+ This defaults to `${SHAREDIR}/snmp/defs`.
+
+EXTRAMIBDEFS Extra MIB description files to use as input when
+ generating ${MOD}_oid.h and ${MOD}_tree.[ch].
+
+EXTRAMIBSYMS Extra MIB definition files used only for extracting
+ symbols.
+
+ EXTRAMIBSYMS are useful when resolving inter-module
+ dependencies and are useful with files containing only
+ enum-definitions.
+
+ 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.
+
+It generates the following files:
+
+${MOD}_tree.c A source file and header which programmatically describes
+${MOD}_tree.h the MIB (type, OID name, ACCESS attributes, etc).
+
+ The files are generated via "gensnmptree -p".
+
+ See gensnmptree(1) for more details.
+
+${MOD}_oid.h A header which programmatically describes the MIB root and
+ MIB tables.
+
+ The files are generated via "gensnmptree -e".
+
+ See gensnmptree(1) for more details.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
The include file <bsd.subdir.mk> contains the default targets for building
subdirectories. It has the same seven targets as <bsd.prog.mk>: all, clean,
cleandir, depend, install, lint, and tags. For all of the directories
diff --git a/share/mk/bsd.snmpmod.mk b/share/mk/bsd.snmpmod.mk
index 552f936..2814da9 100644
--- a/share/mk/bsd.snmpmod.mk
+++ b/share/mk/bsd.snmpmod.mk
@@ -24,4 +24,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>
OpenPOWER on IntegriCloud