XDEFINES	= -DTN3270 -Dlinux -Dunix -DUSE_TERMIO -DTERMCAP -DKLUDGELINEMODE -DNO_URGENT -DDIAGNOSTICS
RM       = rm -f
VPATH	=	../../telnet
XINCLUDES=	-I../../telnet
INCLUDES=	-I$VPATH -I. -I.. -I../.. -I/usr/include/bsd/bsd.h -I../../arpa/telnet.h -I/usr/include/bsd
OPTIMIZE=	-O
CFLAGS	=	${OPTIMIZE} ${INCLUDES} ${DEFINES}
XCFLAGS=	${XINCLUDES} ${XDEFINES}
CC       = gcc
LD	=	ld
LDFLAGS	=	-r
PRINT	= print
LIBC=	/usr/lib/libc.a
ALLH=	$VPATH/defines.h $VPATH/externs.h $VPATH/fdset.h $VPATH/general.h \
	$VPATH/ring.h $VPATH/types.h
SRCS=	$VPATH/commands.c $VPATH/main.c $VPATH/network.c $VPATH/ring.c \
	$VPATH/sys_bsd.c $VPATH/telnet.c $VPATH/terminal.c \
	tn3270.c utilities.c
ALLHC=		${ALLH} ${SRCS}
ALLPRINT =	${ALLHC}
ALLSOURCE=	${ALLHC} Makefile 
OBJS=	commands.o main.o network.o ring.o sys_bsd.o \
	telnet.o terminal.o tn3270.o utilities.o

.c.o:
	echo make -f ./Config.local WHAT=${WHAT} CC="${CC}"; \
	make -f ./Config.local WHAT=${WHAT} CC="${CC}"

telprog.o: cleantel ${OBJS} ${LIBC}
	${LD} ${LDFLAGS} -o $@ ${OBJS}

# This is because make decides he wants to use the VPATH directory to
# check if any of the *.c files have been updated against the *.o files
# also in the VPATH directory.  Unfortunately, TN3270 requires a 
# recompilation of the VPATH stuff, and if we don't do something the
# necessary files won't be recompiled for TN3270
cleantel:
	${RM} ${VPATH}/*.o

clean: 
	@echo "Cleaning tn3270/telnet..."
	@${RM} *.o ${OBJS} core telnet

