#
# Copyright (c) 1987 Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# distribution and use acknowledge that the software was developed
# by the University of California, Berkeley.  The name of the
# University may not be used to endorse or promote products derived
# from this software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
#	@(#)Makefile	1.17 (Berkeley) 11/14/89
#

INCLUDES= IDIR=/ IDIR=netinclude:

SRCS=	commands.c main.c network.c ring.c \
	sys_bsd.c telnet.c terminal.c \
	utilities.c $(GETOPT_SRC)

CFLAGS= nostkchk $(INCLUDES) $(DEFINES) opt ignore=85,100,161,154,62
#CFLAGS = -i/ -iinet:include -so $(DEFINES)

ALLHC=	$(SRCS) \
	defines.h externs.h fdset.h general.h \
	ring.h types.h

OBJS=	commands.o main.o network.o ring.o sys_bsd.o \
	telnet.o terminal.o utilities.o $(GETOPT_OBJ)
MAN=	telnet.0

#
# These next three lines are not needed in 4.4BSD
#
.SUFFIXES: .0 .1
.1.0:
	nroff -man -h $< > $@

all: telnet

telnet:	$(OBJS) $(LIBPATH)
	sc link pname=$@ $(OBJS)
#       ln -o $@ $(OBJS) -lc

clean: FRC
	rm -f $(OBJS) core errs l.errs telnet

cleandir: clean
	rm -f $(MAN) tags .depend

clist:	FRC $(SRCS)
	@for i in $(SRCS) ; \
		do (echo $(DIRPATH)$$i); done

hclist:	FRC $(ALLHC)
	@for i in $(ALLHC) ; \
		do (echo $(DIRPATH)$$i); done

depend: FRC $(SRCS)
	mkdep $(CFLAGS) `make clist`

install: $(MAN) FRC
	install -s -o bin -g bin -m 755 telnet $(DEST)
	install -c -o bin -g bin -m 444 telnet.0 $(DESTDIR)/usr/man/cat1

lint: FRC $(SRCS)
	lint $(CFLAGS) `make clist`

tags: FRC $(SRCS)
	ctags `make hclist`

FRC:

commands.o: commands.c defines.h externs.h general.h ring.h types.h
main.o: main.c defines.h externs.h ring.h
network.o: network.c defines.h externs.h fdset.h ring.h
ring.o: ring.c general.h ring.h
sys_bsd.o: sys_bsd.c defines.h externs.h fdset.h ring.h types.h
telnet.o: telnet.c defines.h externs.h general.h ring.h types.h
terminal.o: terminal.c externs.h ring.h types.h
# tn3270.o: tn3270.c defines.h externs.h fdset.h general.h ring.h
utilities.o: utilities.c defines.h externs.h fdset.h general.h ring.h
