#	Copyright (c) 1985,1986,1987  EXCELAN, INC. 	
#	  All Rights Reserved.                         	

#	The copyright notice above does not evidence any 	
#	actual or intended publication. 			

#	THIS IS UNPUBLISHED COMPUTER SOFTWARE CONTAINING TRADE SECRETS 	
#	AND CONFIDENTIAL INFORMATION PROPRIETARY TO EXCELAN, INC. 	
#
# 	This Software including the documentation is provided with 
# 	RESTRICTED RIGHTS.  Use, duplication, or disclosure by the 
# 	Government is subject to restrictions in subparagraph 
# 	(c)(1)(ii) of the Rights in Technical Data and Computer 
# 	Software clause at 252.227-7013.
#
# $Header: Makefile,v 1.6 87/08/21 13:15:31 davidb Exp $
#
#
# Super Make file for Excelan TCP/IP Protocol Package
#
# Following definitions control compilation, processor and
#  system selection on all subsidiary Makefiles.

# - set SYSTEM to variant of unix that is being used
#   - altos for altos 8086 v7 system (V7)
#   - callan for a callan unistar system (V7)
#   - integrated for a Integrated Solutions system (SYSTEM3)
#   - mostek for MOSTEK 68000 system 3 VME based (SYSTEM3)
#   - plexus for PLEXUS P/35 (SYSTEM3)
#   - sgi for Silicon Graphics 68000 system 5 (SYSTEM5)
#   - tower for NCR tower (SYSTEM5)
#   - victory for victory system 3 system (SYSTEM3)
#   - xenix086 for an intel 8086/310 system (V7)
#   - xenix286 for an intel 80286/310 system (XENIX3)
#   - zehntel for a "zehntel 4.1/v7" system (V7)
#   - zilog for the Zilog System 8000 (SYSTEM3)
#   - S5vax750 for AT&T VAX 750 (SYSTEM5)
#   - your own name (add a file to src/lib/libex_driver/mdep)

SYSTEM=S5vax750

# - set VERSION to one of
#   V7 or
#   SYSTEM3 or
#   SYSTEM5
#   BSD4dot2

VERSION=SYSTEM5

# - MACHINE is used by swap.h to define byte order in shorts and longs.
# - set MACHINE to the underlying cpu type:
#	M68000
#	I8086
#	Z8000
#	VAX
#	PDP11	(also Xenix V7 on the 8086)

MACHINE=VAX

# - set BUS to your system's bus type.  At present only MULTIBUS
#   really does anything.  Use one of the following:
#
#	MULTIBUS
#	VME
#	QBUS
#	UNIBUS
#	ZBI (Zilog System 8000)

BUS=UNIBUS

# - set VCTR to the vector to be inserted on the bus 
#   for those buses that use vectored interrupts
#   (UNIBUS, Q_BUS, VME, ZBI)
#
#    presently 230(decimal) for mostek
#              96(decimal)  for isbox
#              0x1E for zilog
#	       0770 for VAX (in house 730)

VCTR=0770

#
# - set SELECT to EXOSSELECT, if the EXOS select function is to be
#   included in your drivers, or HOSTSELECT if there is a BSD 4.2
#   style select function available on your system already.
#   The effect of select may be simulated by "forking" additional
#   processes.  If this is desired, set select to NOSELECT.
#   NOSELECT may be used to save space if kernel memory is critical,
#   or if select is buggy on your system.
#
#SELECT=HOSTSELECT
#SELECT=NOSELECT
SELECT=EXOSSELECT

# - HOST_DEFINES percolate down through secondary Makefiles, for drivers,
#   libraries, and utilities.
#   	(for ISI add:	-Dmc68000 -D$(STTY))

HOST_DEFINES= -D$(MACHINE) -D$(SYSTEM) -D$(VERSION) -D$(SELECT)

# - set KERN_DEFINES to the particular set of defines and flags which
#   will be needed to correctly compile kernel code on your
#   system.  Modify src/lib/libex_driver/Makefile if driver compilation
#   is especially weird.
#	for ISI: KERN_DEFINES=-DKERNEL -DXTY

KERN_DEFINES=

# - set INCL to the location of the EXOS includes, may be empty
#   if installed under /usr/include

INCL=/usr/src/EXOS/include/EXOS

# - set LIB to the proper library directory for the user subroutine
#   library libsocket.a.

LIB=/lib

# - set BINDIR to the proper directory for user programs

BINDIR=/usr/bin

# - set NET to the proper directory for network daemons and support
#   programs

NET=/net

# - set ETC to the proper directory for host database files

ETC=/etc

# - Names of compiler/assembler/linker/archiver for cross-compilation purposes
#   For zilog S8000, AS="cas -u"  and CC is not defined

CC=cc
AS=as
LD=cc
AR=ar

# - Ranlib for systems that have it

#RANLIB=ranlib
RANLIB=echo ranlib not available for:

# - default destination for binary distributions
BDISTDEST=../bdist

# - combination of all of the above passed down to other makefiles

DEFS=CC=$(CC) AS=$(AS) LD=$(LD) AR=$(AR)\
     SYSTEM=$(SYSTEM) VERSION=$(VERSION) MACHINE=$(MACHINE)\
     BUS=$(BUS)\
     VCTR=$(VCTR)\
     RANLIB="$(RANLIB)" \
     SELECT=$(SELECT)\
     HOST_DEFINES="$(HOST_DEFINES)" KERN_DEFINES="$(KERN_DEFINES)"\
     INCL="$(INCL)" LIB=$(LIB) BINDIR=$(BINDIR) NET=$(NET) ETC=$(ETC)

# - set PRINT to local print incantation
#   and PF to output filter(s) if any

PRINT=pr
PF=| lpr

# Now for the rules to generate and install everything

help:
	@echo "Use one of:"
	@echo " make bdist"
	@echo " make install"
	@echo " make install_libs"
	@echo " make install_net"
	@echo " make clean"
	@echo " make libraries"
	@echo " make binaries"
	@echo " make devices"
	@echo " make unisoft3"
	@echo " make shortids"

clean:
	cd include/EXOS; make clean
	cd src/bin; make clean
	cd src/bin/test; make clean
	cd src/bin/netser; make clean
	cd src/bin/netser/ftp; make clean
	cd src/bin/netser/telnet; make clean
	cd src/bin/netser/tools; make clean
	cd src/bin/netser/rwho; make clean
	cd src/bin/netser/netstat; make clean
	cd src/bin/netser/ud; make clean
	cd src/lib/libex_driver; make clean
	cd src/lib/libsocket; make clean
	cd src/lib/libndir; make clean
	cd src/lib/xlib/xgenlib; make clean
	cd src/lib/xlib/xoslib; make clean
	-rm -f lib/*
	echo > lib/placeholder

binaries:
	cd include/EXOS; make $(DEFS)
	cd src/bin; make $(DEFS)
	cd src/bin/netser; make $(DEFS)
	cd src/bin/netser/ftp;  make $(DEFS)
	cd src/bin/netser/telnet; make $(DEFS)
	cd src/bin/netser/netstat; make $(DEFS)
	cd src/bin/netser/ud; make $(DEFS)
	cd src/bin/netser/rwho; make $(DEFS)
	cd src/bin/netser/tools; make $(DEFS)
	cd src/bin/test; make $(DEFS)

tools:
	cd src/bin/netser/tools; make $(DEFS)

route:
	cd src/bin/netser/tools; make route $(DEFS)

ftp:
	cd src/bin/netser/ftp; make $(DEFS)

telnet:
	cd src/bin/netser/telnet; make $(DEFS)

rwho:
	cd src/bin/netser/rwho; make $(DEFS)

ud:
	cd src/bin/netser/ud; make $(DEFS)

whois:
	cd src/bin/netser/whois; make $(DEFS)

test:
	cd src/bin/test; make $(DEFS)

recv:
	cd src/bin/test ; make recv LIBRARY=$(LIB)/libsocket.a $(DEFS)	

send:
	cd src/bin/test ; make send LIBRARY=$(LIB)/libsocket.a $(DEFS)	

netload:
	cd src/bin; make $(DEFS)

netstat:
	cd src/bin/netser/netstat; make $(DEFS)

libraries:
	cd include/EXOS/sys; make $(DEFS)
	cd include/EXOS/net; make $(DEFS)
	cd include/EXOS/netinet; make $(DEFS)
#	cd include/EXOS/exos; make $(DEFS)
	cd include/EXOS; make $(DEFS)
	make setrel
#	cd src/lib/libex_driver/mdep; make $(DEFS)
	cd src/lib/libex_driver; make $(DEFS)
	cd src/lib/xlib/xgenlib; make $(DEFS)
	cd src/lib/xlib/xoslib; make $(DEFS)
	cd src/lib/libsocket;    make $(DEFS)
	cd src/lib/libndir;    make $(DEFS)

setdefaults:
	cd src/lib/libex_driver; make setdefaults $(DEFS)

drivers:
	cd src/lib/libex_driver; make $(DEFS)

xlib:
	cd src/lib/xlib/xgenlib; make $(DEFS)
	cd src/lib/xlib/xoslib; make $(DEFS)

libsocket:
	cd src/lib/libsocket; make $(DEFS)

libndir:
	cd src/lib/libndir; make $(DEFS)

setrel:
	sh bin/setrel

devices:
	/bin/sh src/bin/dist/MKNODS

bdist:
	cd bin; ./makebdist /usr/src/EXOS $(BDISTDEST)

install:
	cd bin; make install /usr/src/EXOS /

install_libs:
	cd src/lib/libex_driver; make install $(DEFS)
	cd src/lib/libsocket; make install $(DEFS)

install_net:
	cd src/bin/netser; make install ${DEFS}
	cd src/bin; make install $(DEFS)
	cd src/bin/netser; make install $(DEFS)
	cd src/bin/netser/tools; make install $(DEFS)
	cd src/lib/libex_driver; make install $(DEFS)
	cd src/lib/libsocket; make install $(DEFS)

# - unisoft system 3 has u-pointers instead of u-dots; system 5 
#   went back to dots.

unisoft3:
	cd src/lib/libex_driver; make unisoft3

ununisoft3:
	cd src/lib/libex_driver; make ununisoft3

# - not complete.
#print:
#	$(PRINT) Makefile include/EXOS/*.h include/EXOS/sys/*.h \
#		include/EXOS/net/*.h $(PF)
#	$(PRINT) src/bin/Makefile src/bin/*.c src/bin/dist/MKNODS $(PF)
#	$(PRINT) src/bin/test/Makefile src/bin/test/*.c $(PF)
#	$(PRINT) src/bin/netser/Makefile src/bin/netser/*.c $(PF)
#	$(PRINT) src/bin/netser/tools/Makefile src/bin/netser/tools/*.c $(PF)
#	$(PRINT) src/bin/netser/ftp/*.c $(PF)
#	$(PRINT) src/bin/netser/telnet/*.c $(PF)
#	$(PRINT) src/bin/netser/ud/*.c $(PF)
#	$(PRINT) src/lib/libsocket/Makefile src/lib/libsocket/*.c $(PF)
#	$(PRINT) src/lib/libex_driver/Makefile src/lib/libex_driver/*.[hcs] \
#		src/lib/libex_driver/mdep/*.[cs] $(PF)

rlogin rlogind rsh rshd rcp:
	cd src/bin/netser; make $@ $(DEFS)

netser:
	cd src/bin/netser; make $(DEFS)

libex:
	cd src/lib/libex_driver; make $(DEFS)

socket:
	cd src/lib/libsocket; make $(DEFS)

shortids:
	sh bin/idchange.sh

