# %%% copyright-cmetz-97
# This software is Copyright 1997 by Craig Metz, All Rights Reserved.
# The Inner Net License Version 2 applies to this software.
# You should have received a copy of the license with this software. If
# you didn't get a copy, you may request one from <license@inner.net>.
#

ifndef CONFIG_DIR
CONFIG_DIR=/usr/inet6/lib/
endif

include $(CONFIG_DIR)GNUmakefile.inc

ifneq ($(44BSD),0)
OSTARGET=4.4bsd
endif
ifeq ($(OS),Linux)
OSTARGET=linux
endif

CFLAGS+=$(DINET6) $(DNETSEC)

all:
	cd libtelnet; make XCFLAGS="$(CFLAGS)" XLIBS="$(LOADLIBES)" $(OSTARGET)
	cd telnet; make XCFLAGS="$(CFLAGS)" XLIBS="$(LOADLIBES)" $(OSTARGET)
	cd telnetd; make XCFLAGS="$(CFLAGS)" XLIBS="$(LOADLIBES)" $(OSTARGET)

install: all
	@echo "telnet -> $(DESTDIR)$(USR_BINDIR)/telnet"
	@install -m 711 telnet/telnet $(DESTDIR)$(USR_BINDIR)
	@echo "telnetd -> $(DESTDIR)$(LIBEXECDIR)/telnetd"
	@install -m 711 telnetd/telnetd $(DESTDIR)$(LIBEXECDIR)
	@echo "telnet.1 -> $(DESTDIR)$(MANDIR)/man1/telnet.1"
	@install -m 644 telnet/telnet.1 $(DESTDIR)$(MANDIR)/man1/telnet.1
	@echo "telnetd.8 -> $(DESTDIR)$(MANDIR)/man8/telnetd.8"
	@install -m 644 telnetd/telnetd.8 $(DESTDIR)$(MANDIR)/man8/telnetd.8

clean:
	cd libtelnet; make clean
	cd telnet; make clean
	cd telnetd; make clean
