#
# Makefile for snmplib
#

TARG=	libsnmp.$(SHLIB_EXTENSION)$(SHLIB_VERSION)
CSRCS=	snmp_client.c mib.c parse.c snmp_api.c snmp.c \
	snmp_auth.c asn1.c md5.c \
	party.c context.c acl.c view.c \
	party_parse.c context_parse.c acl_parse.c \
	system.c vacm.c int64.c read_config.c snmp_debug.c
OBJS=	snmp_client.o mib.o parse.o snmp_api.o snmp.o \
	snmp_auth.o asn1.o md5.o \
	party.o context.o acl.o view.o \
	party_parse.o context_parse.o acl_parse.o \
	system.o vacm.o int64.o read_config.o snmp_debug.o

#all but md5.h, vacm.h, libsnmp.h, and read_config.h are copied to the installed
#include directory
INSTALLHEADERS=\
	acl.h \
	asn1.h \
	context.h \
	int64.h \
	mib.h \
	parse.h \
	party.h \
	snmp.h \
	snmp_api.h \
	snmp_client.h \
	snmp_debug.h \
	snmp_impl.h \
	system.h \
	ucd-snmp-includes.h \
	view.h

CFLAGS=@CFLAGS@ @SHLIB_CFLAGS@
CPPFLAGS=@CPPFLAGS@ -I. -I.. -I$(srcdir) -I$(srcdir)/..
CC = @CC@ $(CPPFLAGS)

all: $(TARG)

libsnmp.$(SHLIB_EXTENSION)$(SHLIB_VERSION):    ${OBJS}
	$(SHLIB_LD_CMD) libsnmp.$(SHLIB_EXTENSION)$(SHLIB_VERSION) ${OBJS}
	$(RANLIB) libsnmp.$(SHLIB_EXTENSION)$(SHLIB_VERSION)

installdirs:
	@$(SHELL) $(srcdir)/../mkinstalldirs $(libdir) $(includedir)

install:	$(TARG) installdirs
	@for i in $(TARG) ; do $(INSTALL) $$i $(libdir) ; $(RANLIB) $(libdir)/$$i ; echo "install:  installed $$i in $(libdir)" ; done
	@for i in $(INSTALLHEADERS) ; do $(INSTALL) $(srcdir)/$$i $(includedir) ; echo "install:  installed $$i in $(includedir)" ; done
	$(SHLIB_LDCONFIG_CMD)

../lib/libsnmp.$(SHLIB_EXTENSION)$(SHLIB_VERSION):	libsnmp.$(SHLIB_EXTENSION)$(SHLIB_VERSION)
	cp libsnmp.$(SHLIB_EXTENSION)$(SHLIB_VERSION) ../lib
	@RANLIB@ ../lib/libsnmp.$(SHLIB_EXTENSION)$(SHLIB_VERSION)

parse:  mib.o parse.c
	$(CC) $(CFLAGS) -DTEST parse.c mib.o -o parse

lint:
	lint -nhx $(CSRCS)

clean:
	rm -f ${OBJS} ${TARG}
	rm -f ../lib/${TARG}

depend: 
	makedepend $(CPPFLAGS) $(srcdir)/*.c

nosysdepend:
	makedepend $(CPPFLAGS) *.c
	perl -n -i.bak -e ' if (/^# DO NOT DELETE THIS LINE/) {$$doit=1;} if ($$doit == 1) {s#/usr/(include|lib)/[^\s]+##g ; print if (! /^[\w]+\.o:\s*$$/);} else {print;}' Makefile

makefileindepend: nosysdepend
	perl -e ' rename("Makefile.in","Makefile.in.bak"); open(F,"Makefile.in.bak"); open(G,"Makefile"); open(O,">Makefile.in"); $$_ = <F>; while(!/^# DO NOT DELETE THIS LINE/) { print O $$_; $$_ = <F>; } print O $$_; $$_ = <G>; while(!/^# DO NOT DELETE THIS LINE/) { $$_ = <G>; } while (<G>) {print O $$_;} '

# DO NOT DELETE THIS LINE -- make depend depends on it.

acl.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
acl.o: ../s/generic.h ../m/generic.h 
acl.o:  asn1.h acl.h
acl_parse.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
acl_parse.o: ../s/generic.h ../m/generic.h 
acl_parse.o:   asn1.h acl.h
acl_parse.o: party.h context.h snmp_api.h snmp_impl.h snmp.h mib.h
asn1.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
asn1.o: ../s/generic.h ../m/generic.h 
asn1.o:   asn1.h
asn1.o: snmp_api.h snmp_impl.h 
context.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
context.o: ../s/generic.h ../m/generic.h 
context.o:   asn1.h context.h
context_parse.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
context_parse.o: ../s/generic.h ../m/generic.h 
context_parse.o:   asn1.h
context_parse.o: context.h system.h snmp_api.h snmp_impl.h snmp.h mib.h
int64.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
int64.o: ../s/generic.h ../m/generic.h 
int64.o:  asn1.h int64.h
md5.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
md5.o: ../s/generic.h ../m/generic.h 
md5.o:  md5.h
mib.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
mib.o: ../s/generic.h ../m/generic.h 
mib.o:  asn1.h snmp_api.h mib.h snmp.h snmp_impl.h
mib.o: parse.h int64.h system.h read_config.h snmp_debug.h
parse.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
parse.o: ../s/generic.h ../m/generic.h 
parse.o:  system.h parse.h asn1.h mib.h snmp_api.h
parse.o: snmp_debug.h
party.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
party.o: ../s/generic.h ../m/generic.h 
party.o:   asn1.h party.h
party_parse.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
party_parse.o: ../s/generic.h ../m/generic.h 
party_parse.o:  asn1.h mib.h party.h system.h
party_parse.o: snmp_api.h snmp_impl.h snmp.h
read_config.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
read_config.o: ../s/generic.h ../m/generic.h 
read_config.o:   asn1.h mib.h
read_config.o: parse.h system.h snmp_api.h snmp_debug.h snmp_impl.h
read_config.o: read_config.h
snmp.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
snmp.o: ../s/generic.h ../m/generic.h 
snmp.o:  asn1.h snmp.h snmp_api.h snmp_impl.h mib.h
snmp_api.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
snmp_api.o: ../s/generic.h ../m/generic.h 
snmp_api.o:   asn1.h snmp.h
snmp_api.o: snmp_api.h snmp_impl.h party.h mib.h context.h system.h int64.h
snmp_api.o: read_config.h snmp_debug.h
snmp_auth.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
snmp_auth.o: ../s/generic.h ../m/generic.h 
snmp_auth.o:  asn1.h snmp.h snmp_api.h snmp_impl.h
snmp_auth.o: party.h context.h mib.h md5.h acl.h system.h
snmp_client.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
snmp_client.o: ../s/generic.h ../m/generic.h 
snmp_client.o:  asn1.h snmp.h snmp_api.h snmp_impl.h
snmp_client.o: snmp_client.h party.h context.h view.h acl.h mib.h
snmp_debug.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
snmp_debug.o: ../s/generic.h ../m/generic.h 
snmp_debug.o:   asn1.h mib.h
snmp_debug.o: snmp_api.h snmp_debug.h snmp_impl.h
snmp_log.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
snmp_log.o: ../s/generic.h ../m/generic.h 
snmp_log.o:   snmp_log.h
system.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
system.o: ../s/generic.h ../m/generic.h 
system.o:  asn1.h snmp_api.h system.h
vacm.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
vacm.o: ../s/generic.h ../m/generic.h 
vacm.o:  asn1.h snmp.h snmp_api.h vacm.h
vacm.o: snmp_debug.h
view.o: ../config.h ../mib_module_config.h ../s/hpux.h ../s/sysv.h
view.o: ../s/generic.h ../m/generic.h 
view.o:   asn1.h view.h
