#
# Minimum environment and virtual path setup
#
SHELL		= /bin/bash
srcdir		= .
top_srcdir	= ..
top_builddir	= ..
VERSION		= 5.9.3


#
# Paths
#
prefix		= /usr
exec_prefix	= /usr
bindir		= /usr/bin
sbindir		= /usr/sbin
libdir		= /usr/lib
datarootdir	= ${prefix}/share
datadir		= /usr/share
includedir	= /usr/include/net-snmp
ucdincludedir	= /usr/include/ucd-snmp
mandir		= /usr/share/man
man1dir		= $(mandir)/man1
man3dir		= $(mandir)/man3
man5dir		= $(mandir)/man5
man8dir		= $(mandir)/man8
snmplibdir	= $(datadir)/snmp
mibdir		= $(snmplibdir)/mibs
persistentdir	= /var/lib/net-snmp
DESTDIR         = image
INSTALL_PREFIX  = $(DESTDIR)

#
# Programs
#
INSTALL		= $(LIBTOOL) --mode=install install -c
UNINSTALL	= $(LIBTOOL) --mode=uninstall rm -f
LIBTOOLCLEAN	= $(LIBTOOL) --mode=clean rm -f
FEATURECHECK	= $(top_srcdir)/local/minimalist/feature-check
FEATUREPROCESS	= $(top_srcdir)/local/minimalist/feature-remove
INSTALL_DATA    = ${INSTALL} -m 644
SED		= sed
LN_S		= ln -s
AUTOCONF	= recipe-sysroot-native/usr/bin/autoconf
AUTOHEADER	= recipe-sysroot-native/usr/bin/autoheader
PERL            = /usr/bin/env perl
PYTHON          = python3
FIND            = find
EGREP           = grep -E

#
# Compiler arguments
#
CFLAGS		=  -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fdebug-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fmacro-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fdebug-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fdebug-prefix-map=recipe-sysroot=  -fmacro-prefix-map=recipe-sysroot=  -fdebug-prefix-map=recipe-sysroot-native=  -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -DNETSNMP_REMOVE_U64 -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0 -fdebug-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0 -fmacro-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0 -fdebug-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0 -fdebug-prefix-map=recipe-sysroot= -fmacro-prefix-map=recipe-sysroot= -fdebug-prefix-map=recipe-sysroot-native= -Ulinux -Dlinux=linux 
EXTRACPPFLAGS	= 
LDFLAGS		= -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fdebug-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fmacro-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fdebug-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fdebug-prefix-map=recipe-sysroot=  -fmacro-prefix-map=recipe-sysroot=  -fdebug-prefix-map=recipe-sysroot-native=  -Wl,-z,relro,-z,now 
LIBTOOL		= $(SHELL) $(top_builddir)/libtool 
EXEEXT		= 

# Misc Compiling Stuff
CC	        = arm-xilinx-linux-gnueabi-gcc  -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fdebug-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fmacro-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fdebug-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fdebug-prefix-map=recipe-sysroot=  -fmacro-prefix-map=recipe-sysroot=  -fdebug-prefix-map=recipe-sysroot-native=  -Wl,-z,relro,-z,now -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=recipe-sysroot
LINKCC	        = arm-xilinx-linux-gnueabi-gcc  -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fdebug-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fmacro-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fdebug-prefix-map=net-snmp-5.9.3=/usr/src/debug/net-snmp/5.9.3-r0  -fdebug-prefix-map=recipe-sysroot=  -fmacro-prefix-map=recipe-sysroot=  -fdebug-prefix-map=recipe-sysroot-native=  -Wl,-z,relro,-z,now -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=recipe-sysroot

# use libtool versioning the way they recommend.
# The (slightly clarified) rules:
#
# - If any interfaces/structures have been removed or changed since the
#   last update, increment current (+5), and set age and revision to 0. Stop.
#
# - If any interfaces have been added since the last public release, then
#   increment current AND age, and set revision to 0. Stop.
# 
# - If the source code has changed at all since the last update,
#   then increment revision (c:r:a becomes c:r+1:a). 
#
# Note: maintenance releases (eg 5.2.x) should never have changes
#       that would require a current to be incremented.
#
# policy: we increment major releases of LIBCURRENT by 5 starting at
# 5.3 was at 10, 5.4 is at 15, ...  This leaves some room for needed
# changes for past releases if absolutely necessary.
#
# Most recent change: 40 for the v5.8.1 release.
LIBCURRENT  = 42
LIBAGE      = 2
LIBREVISION = 0

LIB_LD_CMD      = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) -Wl,-no-undefined -o
LIB_EXTENSION   = la
LIB_VERSION     =
LIB_LDCONFIG_CMD = echo "do not ldconfig\n"
LINK		= $(LIBTOOL) --mode=link $(LINKCC)
# RANLIB 	= arm-xilinx-linux-gnueabi-gcc-ranlib
RANLIB		= :

# libtool definitions
.SUFFIXES: .c .o .lo .rc
.c.lo:
	$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
.rc.lo:
	$(LIBTOOL) --mode=compile --tag=RC  -o $@ -i $<

# include paths
#
SRC_TOP_INCLUDES            = -I$(top_srcdir)/include
SRC_SNMPLIB_INCLUDES        = -I$(top_srcdir)/snmplib
SRC_AGENT_INCLUDES          = -I$(top_srcdir)/agent
SRC_HELPER_INCLUDES         = -I$(top_srcdir)/agent/helpers
SRC_MIBGROUP_INCLUDES       = -I$(top_srcdir)/agent/mibgroup

BLD_TOP_INCLUDES            = -I$(top_builddir)/include $(SRC_TOP_INCLUDES)
BLD_SNMPLIB_INCLUDES        = -I$(top_builddir)/snmplib $(SRC_SNMPLIB_INCLUDES)
BLD_AGENT_INCLUDES          = -I$(top_builddir)/agent $(SRC_AGENT_INCLUDES)
BLD_HELPER_INCLUDES         = -I$(top_builddir)/agent/helpers $(SRC_HELPER_INCLUDES)
BLD_MIBGROUP_INCLUDES       = -I$(top_builddir)/agent/mibgroup $(SRC_MIBGROUP_INCLUDES)

TOP_INCLUDES            = $(SRC_TOP_INCLUDES)
SNMPLIB_INCLUDES        = $(SRC_SNMPLIB_INCLUDES)
AGENT_INCLUDES          = $(SRC_AGENT_INCLUDES)
HELPER_INCLUDES         = $(SRC_HELPER_INCLUDES)
MIBGROUP_INCLUDES       = $(SRC_MIBGROUP_INCLUDES) 

#
# Makefile to install mib files.
#



#
# Stuff here
#
OTHERINSTALL=mibsinstall
OTHERUNINSTALL=mibsuninstall


V1MIBS	= RFC1155-SMI.txt RFC1213-MIB.txt RFC-1215.txt

V2MIBS = SNMPv2-CONF.txt SNMPv2-SMI.txt SNMPv2-TC.txt SNMPv2-TM.txt \
	SNMPv2-MIB.txt

V3MIBS	= SNMP-FRAMEWORK-MIB.txt SNMP-MPD-MIB.txt SNMP-TARGET-MIB.txt \
	SNMP-NOTIFICATION-MIB.txt SNMP-PROXY-MIB.txt \
	SNMP-USER-BASED-SM-MIB.txt SNMP-VIEW-BASED-ACM-MIB.txt \
	SNMP-COMMUNITY-MIB.txt TRANSPORT-ADDRESS-MIB.txt

AGENTMIBS = AGENTX-MIB.txt SMUX-MIB.txt

IANAMIBS = IANAifType-MIB.txt IANA-LANGUAGE-MIB.txt \
	IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt

RFCMIBS	= IF-MIB.txt IF-INVERTED-STACK-MIB.txt \
	EtherLike-MIB.txt \
	IP-MIB.txt IP-FORWARD-MIB.txt IANA-RTPROTO-MIB.txt \
	TCP-MIB.txt UDP-MIB.txt \
	INET-ADDRESS-MIB.txt HCNUM-TC.txt \
	HOST-RESOURCES-MIB.txt HOST-RESOURCES-TYPES.txt \
	RMON-MIB.txt \
	IPV6-TC.txt IPV6-MIB.txt IPV6-ICMP-MIB.txt IPV6-TCP-MIB.txt \
	IPV6-UDP-MIB.txt IPV6-FLOW-LABEL-MIB.txt TUNNEL-MIB.txt \
	DISMAN-EVENT-MIB.txt DISMAN-SCRIPT-MIB.txt DISMAN-SCHEDULE-MIB.txt \
	NOTIFICATION-LOG-MIB.txt SNMP-USM-AES-MIB.txt \
	SNMP-USM-HMAC-SHA2-MIB.txt SNMP-USM-DH-OBJECTS-MIB.txt \
	SNMP-TLS-TM-MIB.txt SNMP-TSM-MIB.txt \
	SCTP-MIB.txt BRIDGE-MIB.txt

NETSNMPMIBS = NET-SNMP-TC.txt NET-SNMP-MIB.txt NET-SNMP-AGENT-MIB.txt \
	NET-SNMP-EXAMPLES-MIB.txt NET-SNMP-EXTEND-MIB.txt NET-SNMP-PASS-MIB.txt

UCDMIBS = UCD-SNMP-MIB.txt UCD-DEMO-MIB.txt UCD-IPFWACC-MIB.txt \
	UCD-DLMOD-MIB.txt UCD-DISKIO-MIB.txt

DEFAULTMIBS =  SNMPv2-MIB.txt IF-MIB.txt IP-MIB.txt TCP-MIB.txt UDP-MIB.txt HOST-RESOURCES-MIB.txt NOTIFICATION-LOG-MIB.txt DISMAN-EVENT-MIB.txt DISMAN-SCHEDULE-MIB.txt UCD-SNMP-MIB.txt UCD-DEMO-MIB.txt SNMP-TARGET-MIB.txt NET-SNMP-AGENT-MIB.txt DISMAN-EVENT-MIB.txt HOST-RESOURCES-MIB.txt HOST-RESOURCES-TYPES.txt SNMP-FRAMEWORK-MIB.txt SNMP-MPD-MIB.txt SNMP-USER-BASED-SM-MIB.txt SNMP-USER-BASED-SM-MIB.txt SNMP-VIEW-BASED-ACM-MIB.txt SNMP-COMMUNITY-MIB.txt IF-MIB.txt IP-MIB.txt IP-FORWARD-MIB.txt TCP-MIB.txt UDP-MIB.txt NET-SNMP-PASS-MIB.txt NET-SNMP-EXTEND-MIB.txt UCD-DLMOD-MIB.txt SNMP-NOTIFICATION-MIB.txt SNMPv2-TM.txt NET-SNMP-VACM-MIB.txt DISMAN-SCHEDULE-MIB.txt

MIBS	= $(V1MIBS) $(V2MIBS) $(V3MIBS) $(RFCMIBS) \
	$(AGENTMIBS) $(IANAMIBS) \
	$(NETSNMPMIBS) $(UCDMIBS) $(DEFAULTMIBS)

all: standardall

mibsinstall: installdirs
	@for i in $(MIBS) ; do \
		$(INSTALL_DATA) $(srcdir)/$$i $(INSTALL_PREFIX)$(mibdir) ; \
		echo "install: installed $$i in $(INSTALL_PREFIX)$(mibdir)" ; \
	done

mibsuninstall: installdirs
	@for i in $(MIBS) ; do \
		rm -f $(INSTALL_PREFIX)$(mibdir)/$$i ; \
		echo "removed $$i from $(INSTALL_PREFIX)$(mibdir)" ; \
	done

installdirs:
	@$(SHELL) $(srcdir)/../mkinstalldirs $(INSTALL_PREFIX)$(mibdir)

htmldir:
	@if test ! -d html ; then \
		mkdir html ; \
	fi
	rm -f html/index.html ; \
        $(PERL) makehtml.pl -W -M `pwd` -D html $(MIBS) > html/index.html


#
# standard target definitions.  Set appropriate variables to make use of them.
#
# note: the strange use of the "it" variable is for shell parsing when
# there is no targets to install for that rule.
#

# the standard items to build: libraries, bins, and sbins
STANDARDTARGETS     =$(INSTALLLIBS) $(INSTALLBINPROGS) $(INSTALLSBINPROGS)
STANDARDCLEANTARGETS=$(INSTALLLIBS) $(INSTALLPOSTLIBS) $(INSTALLBINPROGS) $(INSTALLSBINPROGS) $(INSTALLUCDLIBS)

standardall: subdirs $(STANDARDTARGETS)

objs: ${OBJS} ${LOBJS}

# features require that subdirs be made *first* to get dependency
# collection processed in the right order
.PHONY: features ftobjs ftsubdirs
features: $(FTOTHERTARGS) ftsubdirs ftobjs $(FEATUREFILE)
ftobjs: $(FTOBJS)
$(FEATUREFILE): $(FTOBJS) $(top_builddir)/include/net-snmp/feature-details.h
	cat $(FTOBJS) > $(FEATUREFILE).in
	$(FEATUREPROCESS) $(FEATUREFILE) $(top_builddir)/include/net-snmp/feature-details.h  
ftsubdirs:
	@if test "$(FTSUBDIRS)" != ""; then \
	    SUBDIRS="$(FTSUBDIRS)" ;        \
        else 			 	    \
            SUBDIRS="$(SUBDIRS)" ;          \
        fi ;                                \
	if test "$$SUBDIRS" != ""; then \
		it="$$SUBDIRS" ; \
		for i in $$it ; do \
			echo "making features in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) features ) ; \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

.PHONY: cleanfeatures cleanfeaturessubdirs
cleanfeatures: cleanfeaturessubdirs
	       rm -f $(FTOBJS)
	       rm -f $(FEATUREFILE)
	       rm -f $(top_builddir)/include/net-snmp/feature-details.h

cleanfeaturessubdirs:
	@if test "$(FTSUBDIRS)" != ""; then \
	    SUBDIRS="$(FTSUBDIRS)" ;        \
        else 			 	    \
            SUBDIRS="$(SUBDIRS)" ;          \
        fi ;                                \
	if test "$$SUBDIRS" != ""; then \
		it="$$SUBDIRS" ; \
		for i in $$it ; do \
			echo "making cleanfeatures in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) cleanfeatures ) ; \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

# feature-check definitions
.SUFFIXES: .ft
.c.ft:
	@test -f $(top_builddir)/include/net-snmp/feature-details.h || \
	    echo "/* Generated by make. Do not modify directly */" \
		> $(top_builddir)/include/net-snmp/feature-details.h
	$(FEATURECHECK) --feature-global $(top_builddir)/include/net-snmp/feature-details.h $(mysubdir) $< $@ $(CC) -E $(CPPFLAGS) $(CFLAGS) -c

subdirs: $(SUBDIRDEPS)
	@if test "$(SUBDIRS)" != ""; then \
		it="$(SUBDIRS)" ; \
		for i in $$it ; do \
			echo "making all in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) ) ; \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

# installlibs handles local, ucd and subdir libs. need to do subdir libs
# before bins, sinze those libs may be needed for successful linking
install: installlocalheaders  \
         installlibs         install_pkgconfig   \
         installlocalbin     installlocalsbin    \
         installsubdirs      $(OTHERINSTALL)

uninstall: uninstalllibs     uninstall_pkgconfig \
           uninstallbin      uninstallsbin       \
           uninstallheaders                      \
           uninstallsubdirs  $(OTHERUNINSTALL)

installprogs: installbin installsbin

#
# headers
#
# set INSTALLHEADERS to a list of things to install in each makefile.
# set INSTALLBUILTINCLUDEHEADERS a list built and placed into include/net-snmp/
# set INSTALLBUILTHEADERS to a list of things to install from builddir
# set INSTALLSUBDIRHEADERS and INSTALLSUBDIR to subdirectory headers
# set INSTALLSUBDIRHEADERS2 and INSTALLSUBDIR2 to more subdirectory headers
# set INSTALLBUILTSUBDIRHEADERS and INSTALLBUILTSUBDIR to a list from builddir
#
installheaders: installlocalheaders  installsubdirheaders

installlocalheaders:
	@if test "$(INSTALLBUILTINCLUDEHEADERS)" != "" ; then \
		echo creating directory $(INSTALL_PREFIX)$(includedir) ; \
		it="$(INSTALLBUILTINCLUDEHEADERS)" ; \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir)/library ; \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir)/agent ; \
		for i in $$it ; do \
			$(INSTALL_DATA) include/net-snmp/$$i $(INSTALL_PREFIX)$(includedir)/$$i ; \
			echo "installing $$i in $(INSTALL_PREFIX)$(includedir)/$$i" ; \
		done \
	fi
	@if test "$(INSTALLHEADERS)" != "" ; then \
		echo creating directory $(INSTALL_PREFIX)$(includedir) ; \
		it="$(INSTALLHEADERS)" ; \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir) ; \
		for i in $$it ; do \
			$(INSTALL_DATA) $(top_srcdir)/include/net-snmp/$$i $(INSTALL_PREFIX)$(includedir) ; \
			echo "installing $$i in $(INSTALL_PREFIX)$(includedir)" ; \
		done \
	fi
	@if test "$(INSTALLBUILTHEADERS)" != "" ; then \
		echo creating directory $(INSTALL_PREFIX)$(includedir) ; \
		it="$(INSTALLBUILTHEADERS)" ; \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir) ; \
		for i in $$it ; do \
			$(INSTALL_DATA) $$i $(INSTALL_PREFIX)$(includedir) ; \
			echo "installing $$i in $(INSTALL_PREFIX)$(includedir)" ; \
		done \
	fi
	@if test "$(INCLUDESUBDIRHEADERS)" != "" ; then \
		echo creating directory $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR) ; \
		it="$(INCLUDESUBDIRHEADERS)" ; \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR) ; \
		for i in $$it ; do \
			$(INSTALL_DATA) $(top_srcdir)/include/net-snmp/$(INCLUDESUBDIR)/$$i $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR) ; \
			echo "installing $$i in $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR)" ; \
		done \
	fi
	@if test "$(INCLUDESUBDIRHEADERS2)" != "" ; then \
		echo creating directory $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR2) ; \
		it="$(INCLUDESUBDIRHEADERS2)" ; \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR2) ; \
		for i in $$it ; do \
			$(INSTALL_DATA) $(top_srcdir)/include/net-snmp/$(INCLUDESUBDIR2)/$$i $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR2) ; \
			echo "installing $$i in $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR2)" ; \
		done \
	fi
	@if test "$(INSTALLBUILTSUBDIRHEADERS)" != "" ; then \
		echo creating directory $(INSTALL_PREFIX)$(includedir)/$(INSTALLBUILTSUBDIR) ; \
		it="$(INSTALLBUILTSUBDIRHEADERS)" ; \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir)/$(INSTALLBUILTSUBDIR) ; \
		for i in $$it ; do \
			$(INSTALL_DATA) $$i $(INSTALL_PREFIX)$(includedir)/$(INSTALLBUILTSUBDIR) ; \
			echo "installing $$i in $(INSTALL_PREFIX)$(includedir)/$(INSTALLBUILTSUBDIR)" ; \
		done \
	fi

installucdheaders:
	@if test "$(INSTALLUCDHEADERS)" != "" ; then \
		echo creating directory $(INSTALL_PREFIX)$(ucdincludedir) ; \
		it="$(INSTALLUCDHEADERS)" ; \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(ucdincludedir) ; \
		for i in $$it ; do \
			$(INSTALL_DATA) $(top_srcdir)/include/ucd-snmp/$$i $(INSTALL_PREFIX)$(ucdincludedir) ; \
			echo "installing $$i in $(INSTALL_PREFIX)$(ucdincludedir)" ; \
		done \
	fi

installsubdirheaders:
	@if test "$(SUBDIRS)" != ""; then \
		it="$(SUBDIRS)" ; \
		for i in $$it ; do \
			echo "making installheaders in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) installheaders) ;   \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

uninstallheaders:
	@if test "$(INSTALLHEADERS)" != "" ; then \
		it="$(INSTALLHEADERS)" ; \
		for i in $$it ; do \
			rm -f $(INSTALL_PREFIX)$(includedir)/$$i ; \
			echo "removing $$i from $(INSTALL_PREFIX)$(includedir)" ; \
		done \
	fi
	@if test "$(INSTALLBUILTHEADERS)" != "" ; then \
		it="$(INSTALLBUILTHEADERS)" ; \
		for i in $$it ; do \
			rm -f $(INSTALL_PREFIX)$(includedir)/`basename $$i` ; \
			echo "removing $$i from $(INSTALL_PREFIX)$(includedir)" ; \
		done \
	fi
	@if test "$(INCLUDESUBDIRHEADERS)" != "" ; then \
		it="$(INCLUDESUBDIRHEADERS)" ; \
		for i in $$it ; do \
			rm -f $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR)/$$i ; \
			echo "removing $$i from $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR)" ; \
		done \
	fi
	@if test "$(INCLUDESUBDIRHEADERS2)" != "" ; then \
		it="$(INCLUDESUBDIRHEADERS2)" ; \
		for i in $$it ; do \
			rm -f $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR2)/$$i ; \
			echo "removing $$i from $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR2)" ; \
		done \
	fi
	@if test "$(INSTALLBUILTSUBDIRHEADERS)" != "" ; then \
		it="$(INSTALLBUILTSUBDIRHEADERS)" ; \
		for i in $$it ; do \
			rm -f $(INSTALL_PREFIX)$(includedir)/$(INSTALLBUILTSUBDIR)/`basename $$i` ; \
			echo "removing $$i from $(INSTALL_PREFIX)$(includedir)/$(INSTALLBUILTSUBDIR)" ; \
		done \
	fi

#
# libraries
#
# set INSTALLLIBS to a list of things to install in each makefile.
#
installlibs: installlocallibs  installsubdirlibs installpostlibs

installlocallibs: $(INSTALLLIBS)
	@if test "$(INSTALLLIBS)" != ""; then \
		it="$(INSTALLLIBS)" ; \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(libdir) ; \
		$(INSTALL) $(INSTALLLIBS) $(INSTALL_PREFIX)$(libdir) ; \
		for i in $$it ; do \
			echo "installing $$i in $(INSTALL_PREFIX)$(libdir)"; \
			$(RANLIB) $(INSTALL_PREFIX)$(libdir)/$$i ; \
		done ; \
		$(LIB_LDCONFIG_CMD) ; \
	fi

installpostlibs: $(INSTALLPOSTLIBS)
	@if test "$(INSTALLPOSTLIBS)" != ""; then \
		it="$(INSTALLPOSTLIBS)" ; \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(libdir) ; \
		$(INSTALL) $(INSTALLPOSTLIBS) $(INSTALL_PREFIX)$(libdir) ; \
		for i in $$it ; do \
			echo "installing $$i in $(INSTALL_PREFIX)$(libdir)"; \
			$(RANLIB) $(INSTALL_PREFIX)$(libdir)/$$i ; \
		done ; \
		$(LIB_LDCONFIG_CMD) ; \
	fi

installucdlibs: $(INSTALLUCDLIBS)
	@if test "$(INSTALLUCDLIBS)" != ""; then \
		it="$(INSTALLUCDLIBS)" ; \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(libdir) ; \
		$(INSTALL) $(INSTALLUCDLIBS) $(INSTALL_PREFIX)$(libdir) ; \
		for i in $$it ; do \
			echo "installing $$i in $(INSTALL_PREFIX)$(libdir)"; \
			$(RANLIB) $(INSTALL_PREFIX)$(libdir)/$$i ; \
		done ; \
		$(LIB_LDCONFIG_CMD) ; \
	fi

installsubdirlibs:
	@if test "$(SUBDIRS)" != ""; then \
		it="$(SUBDIRS)" ; \
		for i in $$it ; do \
			echo "making installlibs in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) installlibs) ;   \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

uninstalllibs:
	@if test "$(INSTALLLIBS)" != ""; then \
		it="$(INSTALLLIBS)" ; \
		for i in $$it ; do   \
			$(UNINSTALL) $(INSTALL_PREFIX)$(libdir)/$$i ; \
			echo "removing $$i from $(INSTALL_PREFIX)$(libdir)"; \
		done \
	fi

#
# pkg-config files
#
install_pkgconfig: $(INSTALL_PKGCONFIG)
	@if test "x$(INSTALL_PKGCONFIG)" != x; then			\
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(libdir)/pkgconfig; \
		for i in $(INSTALL_PKGCONFIG); do			\
			echo "installing $$i in $(INSTALL_PREFIX)$(libdir)/pkgconfig"; \
		done;							\
		$(INSTALL_DATA) $(INSTALL_PKGCONFIG) $(INSTALL_PREFIX)$(libdir)/pkgconfig; \
	fi

uninstall_pkgconfig:
	@if test "x$(INSTALL_PKGCONFIG)" != x; then			\
		for i in $(INSTALL_PKGCONFIG); do			\
			echo "removing $$i from $(INSTALL_PREFIX)$(libdir)/pkgconfig"; \
			$(UNINSTALL) $(INSTALL_PREFIX)$(libdir)/pkgconfig/$$i;\
		done;							\
	fi

#
# normal bin binaries
#
# set INSTALLBINPROGS to a list of things to install in each makefile.
#
installbin: installlocalbin installsubdirbin

installlocalbin: $(INSTALLBINPROGS)
	@if test "$(INSTALLBINPROGS) $(INSTALLBINSCRIPTS)" != " "; then \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(bindir) ; \
		it="$(INSTALLBINPROGS) $(INSTALLBINSCRIPTS)" ; \
		$(INSTALL) $(INSTALLBINPROGS) $(INSTALLBINSCRIPTS) $(INSTALL_PREFIX)$(bindir) ; \
		for i in $$it ; do   \
			echo "installing $$i in $(INSTALL_PREFIX)$(bindir)"; \
		done \
	fi

installsubdirbin:
	@if test "$(SUBDIRS)" != ""; then \
		it="$(SUBDIRS)" ; \
		for i in $$it ; do \
			echo "making installbin in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) installbin) ;   \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

uninstallbin:
	@if test "$(INSTALLBINPROGS) $(INSTALLBINSCRIPTS)" != " "; then \
		it="$(INSTALLBINPROGS) $(INSTALLBINSCRIPTS)" ; \
		for i in $$it ; do   \
			$(UNINSTALL) $(INSTALL_PREFIX)$(bindir)/$$i ; \
			echo "removing $$i from $(INSTALL_PREFIX)$(bindir)"; \
		done \
	fi

#
# sbin binaries
#
# set INSTALLSBINPROGS to a list of things to install in each makefile.
#
installsbin: installlocalsbin installsubdirsbin

installlocalsbin: $(INSTALLSBINPROGS)
	@if test "$(INSTALLSBINPROGS)" != ""; then \
		it="$(INSTALLSBINPROGS)" ; \
		$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(sbindir) ; \
		$(INSTALL) $(INSTALLSBINPROGS) $(INSTALL_PREFIX)$(sbindir) ;  \
		for i in $$it ; do   \
			echo "installing $$i in $(INSTALL_PREFIX)$(sbindir)"; \
		done \
	fi

installsubdirsbin:
	@if test "$(SUBDIRS)" != ""; then \
		it="$(SUBDIRS)" ; \
		for i in $$it ; do \
			echo "making installsbin in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) installsbin) ;   \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

uninstallsbin:
	@if test "$(INSTALLSBINPROGS)" != ""; then \
		it="$(INSTALLSBINPROGS)" ; \
		for i in $$it ; do   \
			$(UNINSTALL) $(INSTALL_PREFIX)$(sbindir)/$$i ; \
			echo "removing $$i from $(INSTALL_PREFIX)$(sbindir)"; \
		done \
	fi

#
# general make install target for subdirs
#
installsubdirs:
	@if test "$(SUBDIRS)" != ""; then \
		it="$(SUBDIRS)" ; \
		for i in $$it ; do \
			echo "making install in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) install) ;   \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

uninstallsubdirs:
	@if test "$(SUBDIRS)" != ""; then \
		it="$(SUBDIRS)" ; \
		for i in $$it ; do \
			echo "making uninstall in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) uninstall) ;   \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

#
# cleaning targets
#
clean: cleansubdirs $(OTHERCLEANTODOS)
	$(LIBTOOLCLEAN) ${OBJS} ${LOBJS}  ${FTOBJS} core $(STANDARDCLEANTARGETS) $(OTHERCLEANTARGETS)

cleansubdirs:
	@if test "$(SUBDIRS)" != ""; then \
		it="$(SUBDIRS)" ; \
		for i in $$it ; do \
			echo "making clean in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) clean) ;   \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

lint:
	lint -nhx $(CSRCS)

#
# wacky dependency building.
#
depend: dependdirs
	@if test -f Makefile.depend ; then \
		makedepend `echo $(CPPFLAGS) | \
		awk '{for(i=1;i<=NF;i++) if (match(substr($$i,1,2), "-[ID]")) print $$i}'` \
		-o .lo $(srcdir)/*.c $(srcdir)/*/*.c ; \
	fi


nosysdepend: nosysdependdirs
	@if test -f Makefile.depend ; then \
		makedepend `echo $(CPPFLAGS) | \
		awk '{for(i=1;i<=NF;i++) if (match(substr($$i,1,2), "-[ID]")) print $$i}'` \
		-o .lo $(srcdir)/*.c $(srcdir)/*/*.c ; \
		$(PERL) -n -i.bak $(top_srcdir)/makenosysdepend.pl Makefile ; \
	fi

distdepend: nosysdepend distdependdirs
	@if test -f Makefile.depend ; then \
		$(PERL) $(top_srcdir)/makefileindepend.pl ; \
	fi

dependdirs:
	@if test "$(SUBDIRS)" != ""; then \
		it="$(SUBDIRS)" ; \
		for i in $$it ; do \
			echo "making depend in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) depend) ;   \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

nosysdependdirs:
	@if test "$(SUBDIRS)" != ""; then \
		it="$(SUBDIRS)" ; \
		for i in $$it ; do \
			echo "making nosysdepend in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) nosysdepend) ;   \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

distdependdirs:
	@if test "$(SUBDIRS)" != ""; then \
		it="$(SUBDIRS)" ; \
		for i in $$it ; do \
			echo "making distdepend in `pwd`/$$i"; \
			( cd $$i ; $(MAKE) distdepend) ;   \
			if test $$? != 0 ; then \
				exit 1 ; \
			fi  \
		done \
	fi

# These aren't real targets, let gnu's make know that.
.PHONY: clean cleansubdirs lint \
	install installprogs installheaders installlibs \
	installbin installsbin installsubdirs \
	all subdirs standardall objs features \
	depend nosysdepend distdepend dependdirs nosysdependdirs distdependdirs
