xref: /freebsd/share/mk/bsd.snmpmod.mk (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1
2INCSDIR=	${INCLUDEDIR}/bsnmp
3
4SHLIB_NAME=	snmp_${MOD}.so.${SHLIB_MAJOR}
5SRCS+=		${MOD}_oid.h ${MOD}_tree.c ${MOD}_tree.h
6CLEANFILES+=	${MOD}_oid.h ${MOD}_tree.c ${MOD}_tree.h
7CFLAGS+=	-I.
8GENSNMPTREEFLAGS+=	-I${SHAREDIR}/snmpdefs
9
10
11${MOD}_oid.h: ${MOD}_tree.def ${EXTRAMIBDEFS} ${EXTRAMIBSYMS}
12	cat ${.ALLSRC} | gensnmptree ${GENSNMPTREEFLAGS} -e ${XSYM} > ${.TARGET}
13
14# Multi-output targets both expect a .meta file and will fight over it. Only
15# allow it on the .c file instead.
16${MOD}_tree.h: ${MOD}_tree.c .NOMETA
17# Force rebuild the .c file if any of its other outputs are missing.
18.if !exists(${MOD}_tree.h)
19${MOD}_tree.c: .PHONY .META
20.endif
21${MOD}_tree.c: ${MOD}_tree.def ${EXTRAMIBDEFS}
22	cat ${.ALLSRC} | gensnmptree -f ${GENSNMPTREEFLAGS} -p ${MOD}_
23
24.if defined(DEFS)
25FILESGROUPS+=	DEFS
26DEFSDIR?=	${SHAREDIR}/snmp/defs
27.endif
28
29.if defined(BMIBS)
30FILESGROUPS+=	BMIBS
31BMIBSDIR?=	${SHAREDIR}/snmp/mibs
32.endif
33
34DEFSPACKAGE=	bsnmp
35BMIBSPACKAGE=	bsnmp
36
37.if !target(smilint) && !empty(BMIBS)
38LOCALBASE?=	/usr/local
39
40SMILINT?=	${LOCALBASE}/bin/smilint
41
42SMIPATH?=	${BMIBSDIR}:${LOCALBASE}/share/snmp/mibs
43
44SMILINT_FLAGS?=	-c /dev/null -l6 -i group-membership
45
46smilint: ${BMIBS}
47	SMIPATH=${SMIPATH} ${SMILINT} ${SMILINT_FLAGS} ${.ALLSRC}
48.endif
49smilint: .PHONY
50
51.include <bsd.lib.mk>
52