# TNET Makefile 11/08/92     Michael Temari (temari@temari.ae.ge.com)
#       updated 01/01/93     Michael Temari (temari@temari.ae.ge.com)
#       updated 01/14/93     Michael Temari (temari@temari.ae.ge.com)
#       updated 02/21/93     Michael Temari (temari@temari.ae.ge.com)
#       updated 04/21/93     Michael Temari (temari@temari.ae.ge.com)

# TNET installation main directory
tnetdir = /etc/tnet

Mos_patches:
	@echo "OS_patches should be installed before making all of TNET"
	@echo "After os_patches have been installed type: make TNET"

TNET:	Mlibrary Mkernel Mdrivers Mcommands
	@echo "TNET build is complete type: make INSTALL"

archive:
	tar cvf /usr2/tnet4.tar [A-w]*

INSTALL:
	@echo "TNET main directory is: $(tnetdir)"
	@sleep 5
	@if [ ! -s $(tnetdir) ] ; then  mkdir $(tnetdir); else echo $(tnetdir) directory already exists; fi; exit 0
	chmod 777 $(tnetdir)
	@if [ ! -s $(tnetdir)/.pipes ] ; then  mkdir $(tnetdir)/.pipes; else echo $(tnetdir)/.pipes directory already exists; fi; exit 0
	chmod 777 $(tnetdir)/.pipes
	@if [ ! -s $(tnetdir)/bin ] ; then  mkdir $(tnetdir)/bin; else echo $(tnetdir)/bin directory already exists; fi; exit 0
	chmod 755 $(tnetdir)/bin
	cp commands/alive/alive $(tnetdir)/bin
	cp commands/daytimed/daytimed $(tnetdir)/bin
	cp commands/finger/finger $(tnetdir)/bin
	cp commands/fingerd/fingerd $(tnetdir)/bin
	cp commands/ftp/ftp $(tnetdir)/bin
	cp commands/ftpd/ftpd $(tnetdir)/bin
	cp commands/host/host $(tnetdir)/bin
	cp commands/hostname/hostname $(tnetdir)/bin
	cp commands/inetd/inetd $(tnetdir)/bin
	cp commands/netcom/netcom $(tnetdir)/bin
	cp commands/netdate/netdate $(tnetdir)/bin
	cp commands/nntp/nntp $(tnetdir)/bin
	cp commands/nslookup/nslookup $(tnetdir)/bin
	cp commands/nsquery/nsquery $(tnetdir)/bin
	cp commands/nstest/nstest $(tnetdir)/bin
	cp commands/smtp/smtp $(tnetdir)/bin
#	cp commands/talk/talk $(tnetdir)/bin
	cp commands/talkd/talkd $(tnetdir)/bin
	cp commands/telnet/telnet $(tnetdir)/bin
	cp commands/telnetd/telnetd $(tnetdir)/bin
	cp commands/timed/timed $(tnetdir)/bin
	cp commands/whois/whois $(tnetdir)/bin
	chmod 755 $(tnetdir)/bin/*
	chmod 4755 $(tnetdir)/bin/ftpd
	@ln $(tnetdir)/bin/netcom $(tnetdir)/bin/attach  2> /dev/null ; exit 0
	@ln $(tnetdir)/bin/netcom $(tnetdir)/bin/ip      2> /dev/null ; exit 0
	@ln $(tnetdir)/bin/netcom $(tnetdir)/bin/tcp     2> /dev/null ; exit 0
	@ln $(tnetdir)/bin/netcom $(tnetdir)/bin/route   2> /dev/null ; exit 0
	@ln $(tnetdir)/bin/netcom $(tnetdir)/bin/arp     2> /dev/null ; exit 0
	@ln $(tnetdir)/bin/netcom $(tnetdir)/bin/halt    2> /dev/null ; exit 0
	@ln $(tnetdir)/bin/netcom $(tnetdir)/bin/pause   2> /dev/null ; exit 0
	@ln $(tnetdir)/bin/netcom $(tnetdir)/bin/restart 2> /dev/null ; exit 0
	@ln $(tnetdir)/bin/netcom $(tnetdir)/bin/detach  2> /dev/null ; exit 0
	@ln $(tnetdir)/bin/netcom $(tnetdir)/bin/netstat 2> /dev/null ; exit 0
#	cp drivers/cslip/cslip.drv $(tnetdir)
	cp drivers/ether/ether.drv $(tnetdir)
#	cp drivers/ppp/ppp.drv $(tnetdir)
	cp drivers/slip/slip.drv $(tnetdir)
	@for f in samples/*; do fd=$(tnetdir)/`basename $$f`; if [ ! -f $$fd ] ; then  cp $$f $$fd; else echo $$fd already exists, not copied ; fi; done; exit 0
	chmod 644 $(tnetdir)/*
	chmod 744 $(tnetdir)/startup
	chmod 755 $(tnetdir)/bin
	chmod 755 $(tnetdir)/*.drv
	cp kernel/tnet $(tnetdir)
	chmod 755 $(tnetdir)/tnet
	@echo
	@echo "Modify configuration files in $(tnetdir) to suit your needs"
	@echo "Add $(tnetdir)/bin to your PATH"
	@echo
	@echo "Enjoy TNET..."
	@echo "Send any comments, bug fixes, enhancements, etc... to temari@temari.ae.ge.com"
	@echo
	@echo "Michael Temari"

Mlibrary:
	@echo "Making TNET libraries"
	@(cd lib/tnet; make; cd ../..)
	@(cd lib/inet; make; cd ../..)

Mkernel:
	@echo "Making TNET kernel"
	@(cd kernel; make; cd ..)

Mdrivers:
	@echo "Making TNET drivers"
	@(cd drivers/cslip; make; cd ../..)
	@(cd drivers/ether; make; cd ../..)
	@(cd drivers/ppp; make; cd ../..)
	@(cd drivers/slip; make; cd ../..)

Mcommands:
	@echo "Making TNET commands"
	@(cd commands/alive; make; cd ../..)
	@(cd commands/daytimed; make; cd ../..)
	@(cd commands/finger; make; cd ../..)
	@(cd commands/fingerd; make; cd ../..)
	@(cd commands/ftp; make; cd ../..)
	@(cd commands/ftpd; make; cd ../..)
	@(cd commands/host; make; cd ../..)
	@(cd commands/hostname; make; cd ../..)
	@(cd commands/inetd; make; cd ../..)
	@(cd commands/netcom; make; cd ../..)
	@(cd commands/netdate; make; cd ../..)
	@(cd commands/nslookup; make; cd ../..)
	@(cd commands/nsquery; make; cd ../..)
	@(cd commands/nstest; make; cd ../..)
	@(cd commands/nntp; make; cd ../..)
	@(cd commands/smtp; make; cd ../..)
#	@(cd commands/talk; make; cd ../..)
	@(cd commands/talkd; make; cd ../..)
	@(cd commands/telnet; make; cd ../..)
	@(cd commands/telnetd; make; cd ../..)
	@(cd commands/timed; make; cd ../..)
	@(cd commands/whois; make; cd ../..)
