#	$Id: Makefile,v 1.11 2009/12/17 08:52:16 sjg Exp $


PROG = tn3270

.include "../../Makefile.inc"

TELNETSRC?=${.CURDIR}/../..
CFLAGS += -I${.CURDIR} -I. -I${TELNETSRC}
	
SRCS += apilib.c api_bsd.c api_exch.c asc_ebc.c astosc.c dctype.c
SRCS += disp_asc.c ebc_disp.c
SRCS += map3270.c termin.c
SRCS += api.c function.c inbound.c oia.c options.c outbound.c
SRCS += genbsubs.c globals.c system.c termout.c
SRCS += commands.c main.c network.c ring.c sys_bsd.c telnet.c terminal.c
SRCS += tn3270.c utilities.c
SRCS += authenc.c

#SRCS += pkeclnt.c

# this and the dependency hacks below to make 'depend' target
# work right...

DEPSRCS += astosc.OUT asc_disp.OUT disp_asc.OUT kbd.OUT
DEPSRCS += apilib.c api_bsd.c api_exch.c asc_ebc.c dctype.c
DEPSRCS += ebc_disp.c
DEPSRCS += map3270.c termin.c
DEPSRCS += api.c function.c inbound.c oia.c options.c outbound.c
DEPSRCS += genbsubs.c globals.c system.c termout.c
DEPSRCS += commands.c main.c network.c ring.c sys_bsd.c telnet.c terminal.c
DEPSRCS += tn3270.c utilities.c

astosc.o: astosc.out
CLEANFILES += astosc.out
astosc.out: ${.CURDIR}/../ctlr/hostctlr.h ${.CURDIR}/../ctlr/function.h \
	    ${.CURDIR}/../ctlr/${KBD} ${MKASTOSC}
	${MKASTOSC} ${.CURDIR}/../ctlr/hostctlr.h \
		${.CURDIR}/../ctlr/function.h < ${.CURDIR}/../ctlr/${KBD} \
		> ${.TARGET}

disp_asc.o: asc_disp.out disp_asc.out
CLEANFILES += asc_disp.out asc_disp.out disp_asc.out disp_asc.out
asc_disp.out: ${MKASTODS}
	${MKASTODS} > ${.TARGET}

disp_asc.out: ${MKDSTOAS}
	${MKDSTOAS} > ${.TARGET}

inbound.o: kbd.out
CLEANFILES += TMPfunc.out kbd.out
kbd.out: ${.CURDIR}/../ctlr/hostctlr.h ${.CURDIR}/../ctlr/${KBD} \
	 ${MKHITS}
	${CC} ${CFLAGS} -E ${.CURDIR}/../ctlr/function.c > TMPfunc.out
	${MKHITS} ${.CURDIR}/../ctlr/hostctlr.h \
		TMPfunc.out < ${.CURDIR}/../ctlr/${KBD} > ${.TARGET}

# astosc.out
# asc_disp.out disp_asc.out
# default.map
# kbd.out

DPLIBS = \
	${LIBTELNET} \
	${LIBCURSES} \
	${LIBTERM} \
	${LIBSSLFD} \
	${LIBSSL} \
	${LIBCRYPTO}


.include <prog.mk>

.if !empty(LIBTERMCAP)
CFLAGS += -DTERMCAP
.endif

.ifnmake obj
.PATH: ${.CURDIR}/../api ${.CURDIR}/../ascii ${.CURDIR}/../ctlr
.PATH: ${.CURDIR}/../general ${.CURDIR}/../sys_curses ${.CURDIR}/../../telnet
.endif

