#	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 15:39:41 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=pcxenix

# - 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=I8086

# - 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=PCBUS

# - 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
#

VCTR=32

#
# - 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
# definition moved to various files
#SELECT=EXSOSELECT

#
# - set SYNC to EXOSASYNCIO, if the EXOS async io function is to be
#   included in your drivers.
#
# definition moved to various files
# - use NULLSWITCH so that so that when -DSELECT is evoked it will
#   not become -D , which will sometimes cause the compiler to
#   skip the next -D switch.
#SYNC=EXOSASYNCIO

# - HOST_DEFINES percolate down through secondary Makefiles, for drivers,
#   libraries, and utilities.
#   NOTE for xenix on pc's: cc defines M_I286 if it gets "-M2"; else it
#	defines M_I86.  -Me enables "far", "near", ...
HOST_DEFINES= -D$(MACHINE) -D$(SYSTEM) -D$(VERSION) -Dxenix286 \
	-F 8000 -Me2 -DM_OLDSIGN -Dscoxenix5
# removed -DM_KERNEL which is not needed for HOST_DEFINES
#	-F 8000 -Me2 -LARGE -DM_OLDSIGN -Dscoxenix5 -DM_KERNEL

# - 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.

KERN_DEFINES= -K -Mem2 -Dxenix286 -Dscoxenix5

#
# removed -DM_OLDSIGN and -DM_KERNEL to avoid the too many defined symbols
# problem.  These symbols are put in the config.h of libex_driver.  They 
# are used by scoxenix system include files.
#
# KERN_DEFINES= -K -Mem2 -Dxenix286 -LARGE -DM_OLDSIGN -Dscoxenix5 -DM_KERNEL

# - 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 libex_driver directory

LIBEXDIR=/usr/src/EXOS/src/lib/libex_driver

# - 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 -i -F 8000"
AR=ar

# - Ranlib for systems that have it

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

# - 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)" \
     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 clean"
	@echo " make libraries"
	@echo " make install_libs"
	@echo " make binaries"
	@echo " make devices"
	@echo " make install"
	@echo " make unisoft3"
	@echo " make shortids"
	@echo " make bdist BDISTDEST=<destination directory>"

clean:
	cd include/EXOS; make clean
	cd src/bin; make clean
	cd src/bin/init205; make clean
	cd src/bin/test; make clean
	cd src/bin/test/udp; 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/bin/netser/whois; 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/init205; 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)
#	cd src/bin/test/udp; 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)
	cd src/bin/test/udp; make $(DEFS)
udp:
	cd src/bin/test/udp; make $(DEFS)

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

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

libraries:
#	echo "Host Utilities: Release 3.3 (Nov 1986)"
	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)
#	cd src/lib/libex_driver/mdep; make $(DEFS)
	cd src/lib/libex_driver; make $(DEFS)
#	cd src/lib/xlib/xgenlib; make $(DEFS) Lxgenlib.a
#	cd src/lib/xlib/xgenlib; make $(DEFS) Mxgenlib.a
	cd src/lib/xlib/xgenlib; make $(DEFS)
#	cd src/lib/xlib/xoslib; make $(DEFS) Lxoslib.a
#	cd src/lib/xlib/xoslib; make $(DEFS) Mxoslib.a
	cd src/lib/xlib/xoslib; make $(DEFS)
	cd src/lib/libsocket;    make $(DEFS) Llibsocket.a
	cd src/lib/libsocket;    make $(DEFS) Mlibsocket.a
	cd src/lib/libsocket;    make $(DEFS)
#	cd src/lib/libndir;    make $(DEFS) Llibndir.a
#	cd src/lib/libndir;    make $(DEFS) Mlibndir.a
	cd src/lib/libndir;    make $(DEFS)

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

init:
	cd src/bin/init205; 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)

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

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}

install_bins:
	cd src/bin; make install $(DEFS)
	cd src/bin/init205; make install $(DEFS)
	cd src/bin/netser; make install $(DEFS)
	cd src/bin/netser/netstat; make install ${DEFS}
	cd src/bin/netser/tools; make install $(DEFS)

install:
	rm -rf $(NET)
	mkdir $(NET)
	cp src/sys/net/start $(NET)/start
	chmod +x $(NET)/start
	cd src/bin; make install $(DEFS)
	cd src/bin/init205; make install $(DEFS)
	cd src/bin/netser; make install $(DEFS)
	cd src/bin/netser/netstat; 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

print:
#	list below is out of date.
	$(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)
	$(PRINT) src/sys/callan/Makefile src/sys/callan/*.c \
		src/sys/zehntel/Makefile src/sys/zehntel/*.c $(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

bdist:
	-cp $(LIBEXDIR)/ex_config.o $(LIBEXDIR)/ex_config.oDEF
	sh bin/makebdist /usr/src/EXOS ${BDISTDEST}

sources :
	cd include/EXOS/sys/mdep; make sources
	cd include/EXOS/sys; make sources
	cd include/EXOS/net; make sources
	cd include/EXOS; make sources
	cd src/lib/libex_driver/mdep; make sources
	cd src/lib/libex_driver; make sources $(DEFS)
	cd src/lib/libsocket;    make sources
	cd src/bin; make sources
	cd src/bin/init205; make sources
	cd src/bin/netser; make sources
	cd src/bin/netser/ftp;  make sources
	cd src/bin/netser/telnet; make sources
	cd src/bin/netser/netstat; make sources
	cd src/bin/netser/ud; make sources
	cd src/bin/test; make sources
#	cd src/bin/test/udp; make sources
	cd src/bin/netser/tools; make sources
	cd src/bin/netser/rwho; make sources

SCCSclean :
#	list below is out of date
	cd include/EXOS/sys/mdep; sccs clean ; sccs get Makefile
	cd include/EXOS/sys; sccs clean ; sccs get Makefile
	cd include/EXOS/net; sccs clean ; sccs get Makefile
	cd include/EXOS; sccs clean ; sccs get Makefile
	cd src/lib/libex_driver/mdep; sccs clean ; sccs get Makefile
	cd src/lib/libex_driver; sccs clean ; sccs get Makefile
	cd src/lib/libsocket; sccs clean ; sccs get Makefile
	cd src/bin; sccs clean ; sccs get Makefile
	cd src/bin/init205; sccs clean ; sccs get Makefile
	cd src/bin/netser; sccs clean ; sccs get Makefile
	cd src/bin/netser/ftp; sccs clean ; sccs get Makefile
	cd src/bin/netser/telnet; sccs clean ; sccs get Makefile
	cd src/bin/netser/netstat; sccs clean ; sccs get Makefile
	cd src/bin/netser/ud; sccs clean ; sccs get Makefile
	cd src/bin/test; sccs clean ; sccs get Makefile
	cd src/bin/test/udp; sccs clean ; sccs get Makefile
	cd src/bin/netser/tools; sccs clean ; sccs get Makefile
	cd src/bin/netser/rwho; sccs clean ; sccs get Makefile
