#
#	Makefile for gated
#

OBJS= af.o egp.o ext.o hello.o if.o icmp.o inet.o init.o main.o \
		rip.o rt_control.o rt_egp.o rt_if.o rt_init.o \
		rt_nss.o rt_table.o sgmp.o snmp.o str.o trace.o \
		version.o

SRCS= af.c egp.c ext.c hello.c if.c icmp.c inet.c init.c main.c \
		rip.c rt_control.c rt_egp.c rt_if.c rt_init.c \
		rt_nss.c rt_table.c sgmp.c snmp.c str.c trace.c

INCLUDES= af.h defs.h egp.h egp_param.h hello.h if.h include.h \
		rip.h routed.h rt_control.h rt_table.h \
		snmp.h trace.h

DESTDIR=/etc

SNMP_INCLUDE=/usr/include/arpa/snmp

SGMP_INCLUDE=/usr/include/arpa/snmp

#
#	various compile time options....
#
#		GATEWAY 	- if this is defined in your config file this
#			  	  MUST be defined here.  This gives you bigger
#			  	  routing tables.
#
#		LOG_FACILITY	- if you don't like gated's syslog
#				  output in the LOG_DAEMON class, use
#				  this define to redirect it, for
#				  example:
#					-DLOG_FACILITY=LOG_LOCAL7
#
#		AGENT_SGMP	- define this when gated is being used
#				  with NYSERnet's SGMP code.  If you are
#				  using both SGMP and SNMP, make sure
#				  that SGMP_INCLUDE specifies the
#				  directory containing the snmp.h file.
#
#		AGENT_SNMP	- define this when gated is being used
#				  with NYSERnet's SNMP code.  If you are
#				  using both SGMP and SNMP, make sure
#				  that SNMP_INCLUDE specifies the
#				  directory containing the snmp.h file.
#
#		ULTRIX1_X 	- if you are running DEC Ultrix 1.x
#			    	  NOTE:  if you are running stock Ultrix 1.x
#			                 you will need to make some kernel mods.
#
#		ULTRIX3_X	- if you are running DEC Ultrix 3.x
#
#		BSD43	  	- if you are running 4.3BSD (final release)
#
#		RT43		- Define this for IBM PC-RT 4.3BSD
#			          look-alike.  Pleae note that you will
#				  have to use the Hi C compiler which seems to
#				  be the default C compiler on this system.
#
#		BETA_BSD43 	- for you lazy :^) beta-testers out there.
#				  This gives you all the stuff that BSD43
#				  does, except for some ICMP redirect stuff.
#				  Beta 4.3bsd didn't seem to pass the IP
#				  header with a raw ICMP message. REAL 4.3bsd
#				  does do this.
#
#		UTX32_1_X	- another 4.2ish, but not quite 4.3ish, same
#				  comments apply from BETA and ULTRIX.
#				  (Although NO kernel mods are needed!)
#
#		UTX32_2_X	- Support for Gould's UTX/32 v2.0.   This
#				  System parallels 4.3BSD quite nicely, but
#				  a few of the config file parsing routines
#				  needed special attention.  This gives you
#				  everything that BSD43 does, except for those
#				  parsing routines.
#
#		BSD42		- for 4.2BSD or any 4.2 based system.  Any
#				  person running SunOS v3.2 or earlier should
#				  use this compilation flag.  NOTE:  you will
#				  need kernel mods to run the HELLO protocol
#				  under a 4.2 based system.
#
#		SUN3_3PLUS      - use this flag for SunOS v3.3 or greater.
#                                 This SunOS understands subnetting, etc.
#
#		SUNOS		- use this flag for SunOS v4.0 or
#				  greater.  This version of SunOS is
#				  very similar to BSD 4.3
#
#
#	The following defines are for testing purposes only, i.e. use at
#		your own risk!
#
#
#		EGP_UPDATE_FORMAT - if you want the EGP network update
#				  packets to be formated.  Used for
#				  debugging EGP code.  This code does
#				  not do adequate checking for invalid
#				  packets so it should only be used when
#				  gated is being watched closely.
#
#		EGP_SKIP_SHARED - if it is not desired to include the
#				  shared network in EGP updates.  If
#				  not specified, the shared network will
#				  be included in EGP updates.
#
#		NO_HOLD_DOWN -	  disables the hold down of routes that
#				  have timed out or become unreachable.
#
DFLAGS=		-DSUNOS -DEGP_UPDATE_FORMAT -DGATEWAY -DAGENT_SNMP
CFLAGS=		-O -I${SNMP_INCLUDE}
LINTFLAGS=	${DFLAGS} -x
DEPFLAGS=	${DFLAGS} -M

.c.o:
	${CC} -c ${DFLAGS} ${CFLAGS} $*.c

all:	gated ripquery

gated: ${OBJS}
	${CC} ${DFLAGS} ${CFLAGS} ${OBJS} -o gated

ripquery:	ripquery.o
	${CC} ${DFLAGS} ${CFLAGS} ripquery.o -o ripquery

ripquery.o:	ripquery.c
	${CC} -c ${DFLAGS} ${CFLAGS} $*.c

version:	version.c

version.c:	${SRCS} ${INCLUDES} Makefile
	head -25 ${SRCS} ${INCLUDES} | fgrep '$$Header' | awk -f version.awk -
	@echo "char *build_date = \"`date`\";" >> version.c
	@cat version.c

version.o:	version.c
	${CC} -c ${CFLAGS} $*.c

sgmp.o:	sgmp.c
	${CC} -c ${DFLAGS} -I${SGMP_INCLUDE} ${CFLAGS} $*.c

snmp.o:	snmp.c
	${CC} -c ${DFLAGS} -I${SNMP_INCLUDE} ${CFLAGS} $*.c

clean:
	-rm -f gated ${OBJS} ripquery ripquery.o core linterrs

install: ${DESTDIR}/gated ${DESTDIR}/ripquery
	@echo "Don't forget to Customize gated.conf file for your site"
	@echo "and install it in /etc (or wherever you specified)"

${DESTDIR}/gated:	gated
	install -c -s gated ${DESTDIR}

${DESTDIR}/ripquery:	ripquery
	install -c -s ripquery ${DESTDIR}

lint:
	lint $(LINTFLAGS) $(SRCS) ripquery.c version.c | grep -v 'insque' | grep -v 'remque' | tee linterrs

depend:	
	${CC} ${DEPFLAGS} -I$(SGMP_INCLUDE) -I$(SNMP_INCLUDE) $(SRCS) ripquery.c > makedep
	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp Makefile Makefile.bak
	ex - Makefile < eddep
	rm eddep makedep

# DO NOT DELETE THIS LINE
af.o : af.c include.h routed.h defs.h egp.h egp_param.h if.h rt_table.h \
  rt_control.h af.h trace.h rip.h hello.h 
egp.o : egp.c include.h routed.h defs.h egp.h egp_param.h if.h rt_table.h \
  rt_control.h af.h trace.h rip.h hello.h 
ext.o : ext.c include.h routed.h defs.h egp.h egp_param.h if.h rt_table.h \
  rt_control.h af.h trace.h rip.h hello.h 
hello.o : hello.c include.h routed.h defs.h egp.h egp_param.h if.h \
  rt_table.h rt_control.h af.h trace.h rip.h hello.h 
if.o : if.c include.h routed.h defs.h egp.h egp_param.h if.h rt_table.h \
  rt_control.h af.h trace.h rip.h hello.h 
icmp.o : icmp.c include.h routed.h defs.h egp.h egp_param.h if.h rt_table.h \
  rt_control.h af.h trace.h rip.h hello.h 
inet.o : inet.c if.h defs.h 
init.o : init.c include.h routed.h defs.h egp.h egp_param.h if.h rt_table.h \
  rt_control.h af.h trace.h rip.h hello.h 
main.o : main.c include.h routed.h defs.h egp.h egp_param.h if.h rt_table.h \
  rt_control.h af.h trace.h rip.h hello.h 
rip.o : rip.c include.h routed.h defs.h egp.h egp_param.h if.h rt_table.h \
  rt_control.h af.h trace.h rip.h hello.h 
rt_control.o : rt_control.c include.h routed.h defs.h egp.h egp_param.h \
  if.h rt_table.h rt_control.h af.h trace.h rip.h hello.h 
rt_egp.o : rt_egp.c include.h routed.h defs.h egp.h egp_param.h if.h \
  rt_table.h rt_control.h af.h trace.h rip.h hello.h 
rt_if.o : rt_if.c include.h routed.h defs.h egp.h egp_param.h if.h \
  rt_table.h rt_control.h af.h trace.h rip.h hello.h 
rt_init.o : rt_init.c routed.h defs.h egp.h egp_param.h if.h rt_table.h \
  rt_control.h af.h trace.h rip.h hello.h 
rt_nss.o : rt_nss.c include.h routed.h defs.h egp.h egp_param.h if.h \
  rt_table.h rt_control.h af.h trace.h rip.h hello.h 
rt_table.o : rt_table.c include.h routed.h defs.h egp.h egp_param.h if.h \
  rt_table.h rt_control.h af.h trace.h rip.h hello.h 
sgmp.o : sgmp.c 
snmp.o : snmp.c 
str.o : str.c include.h routed.h defs.h egp.h egp_param.h if.h rt_table.h \
  rt_control.h af.h trace.h rip.h hello.h 
trace.o : trace.c include.h routed.h defs.h egp.h egp_param.h if.h \
  rt_table.h rt_control.h af.h trace.h rip.h hello.h 
ripquery.o : ripquery.c routed.h 
