all: telnetd

WARNINGS=-Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual \
	 -Wstrict-prototypes -Wmissing-prototypes \
	 -Wmissing-declarations -Wnested-externs -Winline -Wcast-align

CC=gcc
CFLAGS=-O2 $(WARNINGS) -D__USE_BSD_SIGNAL

LIBCURSES=-lncurses
LIBTERMCAP=-lncurses

# -DAUTHENTICATE

# If having unused tty devices root.root and mode 600 bugs you,
# take out -DPARANOID_TTYS.

CFLAGS += '-DISSUE_FILE="/etc/issue.net"' -DPARANOID_TTYS \
	-DTERMCAP -DUSE_TERMIO -DKLUDGELINEMODE -DDIAGNOSTICS
LIBS += -lbsd $(LIBTERMCAP)

OBJS = telnetd.o state.o termstat.o slc.o sys_term.o utility.o \
	global.o authenc.o logwtmp.o

telnetd: $(OBJS)
	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@

$(OBJS): defs.h ext.h pathnames.h telnetd.h

install: telnetd
	install -s -m755 telnetd $(BASEDIR)/usr/sbin/in.telnetd
	install -m644 issue.net.5 $(BASEDIR)/usr/man/man5/
	install -m644 telnetd.8 $(BASEDIR)/usr/man/man8/telnetd.8
	install -m644 in.telnetd.8 $(BASEDIR)/usr/man/man8/in.telnetd.8

clean:
	rm -f *.o telnetd 

