blob: 769352d21f6f58b570eb570548ac257f12ed1681 [file] [log] [blame]
#
# Makefile for snmpget, snmpwalk, snmpbulkwalk, snmptest, snmptranslate,
# snmptrapd, snmptable, snmpset, snmpgetnext, and other utilities.
#
top_builddir=..
# use GNU vpath, if available, to only set a path for source and headers
# VPATH will pick up objects too, which is bad if you are sharing a
# source dir...
@GNU_vpath@ %.h $(srcdir)
@GNU_vpath@ %.c $(srcdir)
# fallback to regular VPATH for non-gnu...
@NON_GNU_VPATH@ $(srcdir)
#
# Things to install
#
@NETSNMP_BUILD_SSH_PROG_TRUE@SSHINSTALLBINPROG = sshtosnmp$(EXEEXT)
@NETSNMP_BUILD_SSH_PROG_FALSE@SSHINSTALLBINPROG =
@NETSNMP_BUILD_TLS_PROG_TRUE@TLSINSTALLBINPROG = snmptls$(EXEEXT)
@NETSNMP_BUILD_TLS_PROG_FALSE@TLSINSTALLBINPROG =
@NETSNMP_HAVE_AGENTX_LIBS_TRUE@AGENTXTRAP = agentxtrap$(EXEEXT)
@NETSNMP_HAVE_AGENTX_LIBS_FALSE@AGENTXTRAP =
INSTALLBINPROGS = snmpget$(EXEEXT) \
snmpgetnext$(EXEEXT) \
snmpset$(EXEEXT) \
snmpusm$(EXEEXT) \
snmpwalk$(EXEEXT) \
snmpbulkwalk$(EXEEXT) \
snmptable$(EXEEXT) \
snmptrap$(EXEEXT) \
snmpbulkget$(EXEEXT) \
snmptranslate$(EXEEXT) \
snmpstatus$(EXEEXT) \
snmpdelta$(EXEEXT) \
snmptest$(EXEEXT) \
encode_keychange$(EXEEXT) \
snmpdf$(EXEEXT) \
$(AGENTXTRAP) \
snmpvacm$(EXEEXT) \
$(SSHINSTALLBINPROG) $(TLSINSTALLBINPROG)
INSTALLSBINPROGS = snmptrapd$(EXEEXT)
INSTALLLIBS = libnetsnmptrapd.$(LIB_EXTENSION)$(LIB_VERSION)
SUBDIRS = snmpnetstat
#
# build variables.
#
# USELIBS/USEAGENTLIBS are for dependencies
USELIBS = ../snmplib/libnetsnmp.$(LIB_EXTENSION)$(LIB_VERSION)
AGENTLIB = ../agent/libnetsnmpagent.$(LIB_EXTENSION)$(LIB_VERSION)
MIBLIB = ../agent/libnetsnmpmibs.$(LIB_EXTENSION)$(LIB_VERSION)
USEAGENTLIBS = $(MIBLIB) $(AGENTLIB) $(USELIBS)
MYSQL_LIBS = @MYSQL_LIBS@
MYSQL_INCLUDES = @MYSQL_INCLUDES@
LIBS = $(USELIBS) @LIBS@
PERLLDOPTS_FOR_APPS = @PERLLDOPTS_FOR_APPS@
PERLLDOPTS_FOR_LIBS = @PERLLDOPTS_FOR_LIBS@
#
# hack for compiling trapd when agent is disabled
TRAPDWITHAGENT = $(USETRAPLIBS) $(MYSQL_LIBS) @AGENTLIBS@
TRAPDWITHOUTAGENT = $(LIBS) $(MYSQL_LIBS)
# these will be set by configure to one of the above 2 lines
TRAPLIBS = @TRAPLIBS@ $(PERLLDOPTS_FOR_APPS)
USETRAPLIBS = @USETRAPLIBS@
CPPFLAGS = $(TOP_INCLUDES) -I. $(AGENT_INCLUDES) $(HELPER_INCLUDES) \
$(MIBGROUP_INCLUDES) \
$(SNMPLIB_INCLUDES) $(MYSQL_INCLUDES) @CPPFLAGS@
OSUFFIX = lo
TRAPD_OBJECTS = snmptrapd.$(OSUFFIX) @other_trapd_objects@
LIBTRAPD_OBJS = snmptrapd_handlers.o snmptrapd_log.o \
snmptrapd_auth.o snmptrapd_sql.o
LLIBTRAPD_OBJS = snmptrapd_handlers.lo snmptrapd_log.lo \
snmptrapd_auth.lo snmptrapd_sql.lo
OBJS = *.o
LOBJS = *.lo
all: standardall
OTHERINSTALL=snmpinforminstall snmptrapdperlinstall
OTHERUNINSTALL=snmpinformuninstall snmptrapdperluninstall
#
# build rules
#
snmpwalk$(EXEEXT): snmpwalk.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmpwalk.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmpbulkwalk$(EXEEXT): snmpbulkwalk.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmpbulkwalk.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmpbulkget$(EXEEXT): snmpbulkget.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmpbulkget.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmptranslate$(EXEEXT): snmptranslate.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmptranslate.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmpstatus$(EXEEXT): snmpstatus.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmpstatus.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmpget$(EXEEXT): snmpget.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmpget.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmpdelta$(EXEEXT): snmpdelta.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmpdelta.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmptable$(EXEEXT): snmptable.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmptable.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmptest$(EXEEXT): snmptest.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmptest.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmptrapd$(EXEEXT): $(TRAPD_OBJECTS) $(USETRAPLIBS) $(INSTALLLIBS)
$(LINK) ${CFLAGS} -o $@ $(TRAPD_OBJECTS) $(INSTALLLIBS) ${LDFLAGS} ${TRAPLIBS}
snmptrap$(EXEEXT): snmptrap.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmptrap.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmpinform$(EXEEXT): snmptrap$(EXEEXT)
rm -f snmpinform
$(LN_S) snmptrap$(EXEEXT) snmpinform$(EXEEXT)
snmpset$(EXEEXT): snmpset.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmpset.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmpusm$(EXEEXT): snmpusm.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmpusm.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmpvacm$(EXEEXT): snmpvacm.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmpvacm.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmptls$(EXEEXT): snmptls.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmptls.$(OSUFFIX) ${LDFLAGS} ${LIBS}
agentxtrap$(EXEEXT): agentxtrap.$(OSUFFIX) $(USEAGENTLIBS)
$(LINK) ${CFLAGS} -o $@ agentxtrap.$(OSUFFIX) ${LDFLAGS} $(USEAGENTLIBS) $(PERLLDOPTS_FOR_APPS) ${LIBS}
snmpgetnext$(EXEEXT): snmpgetnext.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmpgetnext.$(OSUFFIX) ${LDFLAGS} ${LIBS}
encode_keychange$(EXEEXT): encode_keychange.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ encode_keychange.$(OSUFFIX) ${LDFLAGS} ${LIBS}
snmpdf$(EXEEXT): snmpdf.$(OSUFFIX) $(USELIBS)
$(LINK) ${CFLAGS} -o $@ snmpdf.$(OSUFFIX) ${LDFLAGS} ${LIBS}
libnetsnmptrapd.$(LIB_EXTENSION)$(LIB_VERSION): $(LLIBTRAPD_OBJS)
$(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS)
$(RANLIB) $@
snmpinforminstall:
rm -f $(INSTALL_PREFIX)$(bindir)/snmpinform$(EXEEXT)
$(LN_S) snmptrap$(EXEEXT) $(INSTALL_PREFIX)$(bindir)/snmpinform$(EXEEXT)
snmpinformuninstall:
rm -f $(INSTALL_PREFIX)$(bindir)/snmpinform$(EXEEXT)
snmptrapdperlinstall: installdirs
@$(INSTALL_DATA) $(srcdir)/snmp_perl_trapd.pl $(INSTALL_PREFIX)$(snmplibdir)/snmp_perl_trapd.pl
@echo "install: installed snmp_perl_trapd.pl in $(INSTALL_PREFIX)$(snmplibdir)"
snmptrapdperluninstall: installdirs
@rm -f $(INSTALL_PREFIX)$(snmplibdir)/snmp_perl_trapd.pl
@echo "removed snmp_perl_trapd.pl from $(INSTALL_PREFIX)$(snmplibdir)"
sshtosnmp$(EXEEXT): sshtosnmp.$(OSUFFIX)
$(LINK) ${CFLAGS} -o $@ sshtosnmp.$(OSUFFIX)
installdirs:
@$(SHELL) $(srcdir)/../mkinstalldirs $(INSTALL_PREFIX)$(snmplibdir)