#-----------------------------------------------------------------------------
#		Makefile for tcpip library 
#
#-----------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Where to find things (include files)
#------------------------------------------------------------------------------

#ROOT	=/h/pvcs
ROOT	= junk
#PTCPDIR	= ${ROOT}/i960/tcpip
VERSION	=
# Defaults to GNU/960 tool set:
#
CC	= gcc960
ARCH	= -ACA			# -ACA:	Generate CA instructions
OPT	= -O3 -c 		# -O3: 	optimize 
				# -c:	compile only
AS	= gas960
ARFLAGS	= rs 
TARG	= libtcpip.a		# target output
#
# Essential under System V, harmless elsewhere
SHELL = /bin/sh

# Standard rules
#
.c_v.c:
	=get $(GETOPTS) $<\($@\)

.h_v.h:
	=get $(GETOPTS) $<\($@\)

.s_v.s:
	=get $(GETOPTS) $<\($@\)

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

.s.o:
	${AS} ${ASFLAGS} -o $*.o $*.s


#------------------------------------------------------------------------------
# TARG OBJECT FILES
#------------------------------------------------------------------------------


TARG:
	cd mib2; make
	cd async; make  
	cd ip; make  
	cd udp; make
	cd mpd; make
	cd drv; make
	cd tftp; make
	cd tcp; make 
	cd telnet ; make
	cd rip; make 
	cd util; make 
	cd timep; make 
	cd bootp; make 
	cd slip; make 
	cd snmp; make

TSTARG:
	cd mib2; make
	cd async; make  
	cd ip; make  
	cd udp; make
	cd mpd; make
	cd drv; make
	cd tftp; make
	cd tcp; make 
	cd telnet ; make  -f maklatv2
	cd rip; make 
	cd util; make 
	cd timep; make 
	cd bootp; make 
	cd slip; make 
	cd snmp; make

TSTARGV2:
	cd mib2; make
	cd async; make  
	cd ip; make  
	cd udp; make
	cd mpd; make
	cd drv; make
	cd tftp; make
	cd tcp; make 
	cd telnet ; make  -f makev2
	cd rip; make 
	cd util; make 
	cd timep; make 
	cd bootp; make 
	cd slip; make 
	cd snmp; make


new:	mkdir getcfg getmf

source:	mkdir getcfg getmf getsrc

mkdir:
	mkdir mib2 async ip udp mpd
	mkdir drv tftp tcp telnet rip
	mkdir util timep bootp slip snmp

getmf:
	cd mib2; get  -cpvcs.cfg Makefile 
	cd async; get  -cpvcs.cfg Makefile 
	cd ip; get  -cpvcs.cfg Makefile 
	cd udp; get  -cpvcs.cfg Makefile
	cd mpd; get  -cpvcs.cfg Makefile
	cd drv; get  -cpvcs.cfg Makefile
	cd tftp; get  -cpvcs.cfg Makefile 
	cd tcp; get  -cpvcs.cfg Makefile 
	cd telnet; get  -cpvcs.cfg Makefile
	cd rip; get  -cpvcs.cfg Makefile 
	cd util; get  -cpvcs.cfg Makefile
	cd timep ; get -cpvcs.cfg Makefile
	cd bootp ; get -cpvcs.cfg Makefile
	cd slip ; get -cpvcs.cfg Makefile 
	cd snmp; get -cpvcs.cfg Makefile

getcfg:
	cp ${PTCPDIR}/mib2/pvcs.cfg mib2/pvcs.cfg
	cp ${PTCPDIR}/async/pvcs.cfg async/pvcs.cfg
	cp ${PTCPDIR}/ip/pvcs.cfg ip/pvcs.cfg
	cp ${PTCPDIR}/udp/pvcs.cfg udp/pvcs.cfg
	cp ${PTCPDIR}/mpd/pvcs.cfg mpd/pvcs.cfg
	cp ${PTCPDIR}/drv/pvcs.cfg drv/pvcs.cfg
	cp ${PTCPDIR}/tftp/pvcs.cfg tftp/pvcs.cfg
	cp ${PTCPDIR}/tcp/pvcs.cfg tcp/pvcs.cfg
	cp ${PTCPDIR}/telnet/pvcs.cfg telnet/pvcs.cfg
	cp ${PTCPDIR}/rip/pvcs.cfg rip/pvcs.cfg
	cp ${PTCPDIR}/util/pvcs.cfg util/pvcs.cfg
	cp ${PTCPDIR}/timep/pvcs.cfg timep/pvcs.cfg
	cp ${PTCPDIR}/bootp/pvcs.cfg bootp/pvcs.cfg
	cp ${PTCPDIR}/slip/pvcs.cfg slip/pvcs.cfg
	cp ${PTCPDIR}/snmp/pvcs.cfg snmp/pvcs.cfg

getsrc:
	get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/local.lst
	cd mib2; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/mib2/local.lst
	cd async; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/async/local.lst 
	cd ip; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/ip/local.lst 
	cd udp; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/udp/local.lst
	cd mpd; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/mpd/local.lst
	cd drv; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/drv/local.lst
	cd tftp; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/tftp/local.lst 
	cd tcp; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/tcp/local.lst 
	cd telnet; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/telnet/local.lst
	cd rip; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/rip/local.lst 
	cd util; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/util/local.lst
	cd timep ; get -y -cpvcs.cfg -v${VERSION} @${PTCPDIR}/timep/local.lst
	cd bootp ; get -y -cpvcs.cfg -v${VERSION} @${PTCPDIR}/bootp/local.lst
	cd slip ; get -y -cpvcs.cfg -v${VERSION} @${PTCPDIR}/slip/local.lst 
	cd snmp; get -y -cpvcs.cfg -v${VERSION} @${PTCPDIR}/snmp/local.lst
#
#	BOOTER for stanley
#
stbooter:
	cd async; make  
	cd ip; make  
	cd udp; make
	cd mpd; make
	cd drv; make
	cd tftp; make
	cd util; make 
	cd bootp; make 
	cd slip; make 

#-------------------------------------------------------------------------------
#	Boot Software for 416 R/T
#
r416boot:
	make r416dir
	make r416gcfg
	make r416gmf
	make r416i


r416i:
	cd async; make
	cd ip; make
	cd udp; make
	cd mpd; make
	cd drv; make
	cd tftp; make
	cd bootp; make
	cd slip; make
	cd util; make 
	cd rip; make


r416dir:
	mkdir async ip udp mpd drv tftp bootp slip util rip

r416gcfg:
	cp ${PTCPDIR}/async/pvcs.cfg async/pvcs.cfg
	cp ${PTCPDIR}/rip/pvcs.cfg rip/pvcs.cfg
	cp ${PTCPDIR}/ip/pvcs.cfg ip/pvcs.cfg
	cp ${PTCPDIR}/udp/pvcs.cfg udp/pvcs.cfg
	cp ${PTCPDIR}/mpd/pvcs.cfg mpd/pvcs.cfg
	cp ${PTCPDIR}/drv/pvcs.cfg drv/pvcs.cfg
	cp ${PTCPDIR}/tftp/pvcs.cfg tftp/pvcs.cfg
	cp ${PTCPDIR}/bootp/pvcs.cfg bootp/pvcs.cfg
	cp ${PTCPDIR}/slip/pvcs.cfg slip/pvcs.cfg
	cp ${PTCPDIR}/util/pvcs.cfg util/pvcs.cfg

r416gmf:
	cd async; get -cpvcs.cfg Makefile
	cd ip; get -cpvcs.cfg Makefile
	cd udp; get -cpvcs.cfg Makefile
	cd mpd; get -cpvcs.cfg Makefile
	cd drv; get -cpvcs.cfg Makefile
	cd tftp; get -cpvcs.cfg Makefile
	cd bootp; get -cpvcs.cfg Makefile
	cd slip; get -cpvcs.cfg Makefile
	cd util; get -cpvcs.cfg Makefile
	cd rip; get -cpvcs.cfg Makefile

#-------------------------------------------------------------------------------

stnew:	stmkdir stgetcfg stgetmf

stsource:
	make stmkdir
	make stgetcfg
	make stgtmf
	make stgetsrc

stmkdir:
	mkdir async ip udp mpd
	mkdir drv tftp mib2 tcp
	mkdir util bootp slip

stgetmf:
	cd mib2; get -cpvcs.cfg Makefile
	cd tcp; get -cpvcs.cfg Makefile
	cd async; get  -cpvcs.cfg Makefile 
	cd ip; get -cpvcs.cfg Makefile 
	cd udp; get -cpvcs.cfg Makefile
	cd mpd; get -cpvcs.cfg Makefile
	cd drv; get -cpvcs.cfg Makefile
	cd tftp; get -cpvcs.cfg Makefile 
	cd util; get -cpvcs.cfg Makefile
	cd bootp ; get -cpvcs.cfg Makefile
	cd slip ; get -cpvcs.cfg Makefile 

stgetcfg:
	cp ${PTCPDIR}/mib2/pvcs.cfg mib2/pvcs.cfg
	cp ${PTCPDIR}/tcp/pvcs.cfg tcp/pvcs.cfg
	cp ${PTCPDIR}/async/pvcs.cfg async/pvcs.cfg
	cp ${PTCPDIR}/ip/pvcs.cfg ip/pvcs.cfg
	cp ${PTCPDIR}/udp/pvcs.cfg udp/pvcs.cfg
	cp ${PTCPDIR}/mpd/pvcs.cfg mpd/pvcs.cfg
	cp ${PTCPDIR}/drv/pvcs.cfg drv/pvcs.cfg
	cp ${PTCPDIR}/tftp/pvcs.cfg tftp/pvcs.cfg
	cp ${PTCPDIR}/util/pvcs.cfg util/pvcs.cfg
	cp ${PTCPDIR}/bootp/pvcs.cfg bootp/pvcs.cfg
	cp ${PTCPDIR}/slip/pvcs.cfg slip/pvcs.cfg

stgetsrc:
	get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/local.lst
	cd async; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/async/local.lst 
	cd ip; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/ip/local.lst 
	cd udp; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/udp/local.lst
	cd mpd; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/mpd/local.lst
	cd drv; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/drv/local.lst
	cd tftp; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/tftp/local.lst 
	cd util; get -y  -cpvcs.cfg -v${VERSION} @${PTCPDIR}/util/local.lst
	cd bootp ; get -y -cpvcs.cfg -v${VERSION} @${PTCPDIR}/bootp/local.lst
	cd slip ; get -y -cpvcs.cfg -v${VERSION} @${PTCPDIR}/slip/local.lst 

#------------------------------------------------------------------------------
# HEADER-FILE DEPENDENCIES
#------------------------------------------------------------------------------

