From owner-svn-src-stable-11@freebsd.org Sat Feb 4 17:10:21 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90479CD0E26; Sat, 4 Feb 2017 17:10:21 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6819A132; Sat, 4 Feb 2017 17:10:21 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v14HAKQk084221; Sat, 4 Feb 2017 17:10:20 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v14HAKDN084216; Sat, 4 Feb 2017 17:10:20 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702041710.v14HAKDN084216@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 4 Feb 2017 17:10:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313239 - in stable/11: share/mk usr.sbin/bsnmpd/modules usr.sbin/bsnmpd/modules/snmp_hostres usr.sbin/bsnmpd/modules/snmp_mibII X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Feb 2017 17:10:21 -0000 Author: ngie Date: Sat Feb 4 17:10:19 2017 New Revision: 313239 URL: https://svnweb.freebsd.org/changeset/base/313239 Log: 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 Modified: stable/11/share/mk/bsd.README stable/11/share/mk/bsd.snmpmod.mk stable/11/usr.sbin/bsnmpd/modules/Makefile stable/11/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile stable/11/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/bsd.README ============================================================================== --- stable/11/share/mk/bsd.README Sat Feb 4 17:08:21 2017 (r313238) +++ stable/11/share/mk/bsd.README Sat Feb 4 17:10:19 2017 (r313239) @@ -410,6 +410,82 @@ If foo has multiple source files, add th =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +The include file, , 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 contains the default targets for building subdirectories. It has the same seven targets as : all, clean, cleandir, depend, install, lint, and tags. For all of the directories Modified: stable/11/share/mk/bsd.snmpmod.mk ============================================================================== --- stable/11/share/mk/bsd.snmpmod.mk Sat Feb 4 17:08:21 2017 (r313238) +++ stable/11/share/mk/bsd.snmpmod.mk Sat Feb 4 17:10:19 2017 (r313239) @@ -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 Modified: stable/11/usr.sbin/bsnmpd/modules/Makefile ============================================================================== --- stable/11/usr.sbin/bsnmpd/modules/Makefile Sat Feb 4 17:08:21 2017 (r313238) +++ stable/11/usr.sbin/bsnmpd/modules/Makefile Sat Feb 4 17:10:19 2017 (r313239) @@ -2,7 +2,7 @@ .include -.PATH: ${.CURDIR}/../../../contrib/bsnmp/snmpd +.PATH: ${SRCTOP}/contrib/bsnmp/snmpd .if ${MK_ATM} != "no" _snmp_atm= snmp_atm @@ -36,4 +36,6 @@ SUBDIR+=snmp_wlan INCS= snmpmod.h INCSDIR= ${INCLUDEDIR}/bsnmp +SUBDIR_TARGETS+= smilint + .include Modified: stable/11/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile ============================================================================== --- stable/11/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile Sat Feb 4 17:08:21 2017 (r313238) +++ stable/11/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile Sat Feb 4 17:10:19 2017 (r313239) @@ -75,8 +75,3 @@ LIBADD= kvm devinfo m geom memstat printcap.pico: printcap.c ${CC} ${PICFLAG} -DPIC ${CFLAGS:C/^-W.*//} -c ${.IMPSRC} -o ${.TARGET} - -smilint: .PHONY -smilint: ${BMIBS} - env SMIPATH=.:/usr/share/snmp/mibs:/usr/local/share/snmp/mibs \ - smilint -c /dev/null -l6 -i group-membership ${.ALLSRC} Modified: stable/11/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile ============================================================================== --- stable/11/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile Sat Feb 4 17:08:21 2017 (r313238) +++ stable/11/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile Sat Feb 4 17:10:19 2017 (r313239) @@ -21,8 +21,3 @@ INCS= snmp_${MOD}.h BMIBS= BEGEMOT-IP-MIB.txt BEGEMOT-MIB2-MIB.txt .include - -smilint: .PHONY -smilint: ${BMIBS} - env SMIPATH=/usr/share/snmp/mibs:/usr/local/share/snmp/mibs \ - smilint -c /dev/null -l6 -i group-membership ${.ALLSRC}